#
# $Id: textdisplay.icn,v 1.2 2004/11/06 00:28:13 rparlett Exp $
#
# This file is in the public domain.
#
# Author: Robert Parlett (parlett@dial.pipex.com)
#

package gui
link graphics

$include "guih.icn"

#
# This class displays a list of strings.
#
class TextDisplay : DisplayScrollArea()
   method get_line_height()
      return WAttrib(self.cwin, "fheight")
   end

   method get_view_x_padding()
      return DEFAULT_TEXT_X_SURROUND
   end

   method get_view_y_padding()
      return DEFAULT_TEXT_Y_SURROUND
   end

   method get_subject_width()
      mw := 0
      every s := !self.contents do
         mw <:= TextWidth(self.cwin, detab(s))
      return mw
   end

   method draw_line(xp, yp, i)
      local s
      s := contents[i]

      left_string(self.cbwin, xp, yp, detab(s))
   end

   initially(a[])
      self.DisplayScrollArea.initially()
      set_fields(a)
end