#
# $Id: drawscrollarea.icn,v 1.3 2004/11/06 21:06:14 rparlett Exp $
#
# This file is in the public domain.
#
# Author: Robert Parlett (parlett@dial.pipex.com)
#

package gui
link graphics

$include "guih.icn"

class DrawScrollAreaView : Component()
   method display(buffer_flag)
      EraseRectangle(self.cbwin, self.x, self.y, self.w, self.h)
      # As we delegate drawing to the parent, we clip on the parent cbwin.
      Clip(self.parent.cbwin, self.x, self.y, self.w, self.h)
      parent.draw(parent.get_areax(), parent.get_areay(), self.x, self.y, self.w, self.h)
      Clip(self.parent.cbwin)
      self.do_shading(self.cbwin)
      if /buffer_flag then
         CopyArea(self.cbwin, self.cwin, self.x, self.y, self.w, self.h, self.x, self.y)
   end
end

#
# This is a scroll area where the object is displayed by overriding
# an abstract method defined below.
#
class DrawScrollArea : ScrollArea()
   #
   # Draw the object at its offset subject_x, subject_y, into self.cbwin
   # at vx, vy, with size vw, vh; the latter parameters are the size
   # and position of the view.
   #
   abstract method draw(subject_x, subject_y, vx, vy, vw, vh)

   method create_view()
      return DrawScrollAreaView()
   end
end