(*
StaticText, or non-editable text in the sense that it is not TextEdit text,
is text that is meant for display only. StaticText remembers everything it
needs to draw itself including the position in the window, the font, fontsize,
etc. StaticText is also a selection class so it will follow our standard
protocol. A maximum of 16 characters will fit in a StaticText object.
Note the heavy reliance on multiple inheritance.
*)
need $16
need font
need point+
need nullselect
:class staticText super{ $16 font point+ nullselect }
:m classinit:
" Static Text" put: super> $16
50 50 moveto: super> point+
;m
:m new: ( wptr -- )
drop
getnew: super> font
;m
:m draw:
get: super> point+ MoveTo \ move graphics pen with MoveTo
set: super> font \ must always set: the font before
\ drawing because we have no idea
\ what the current graphport
\ settings are
get: super> $16 mDrawString
;m
:m erase: \ simply erases the screen display,
\ does not change the string itself
get: mode \ font ivar data, save on stack
\ for subsequent restore
konst srcBic put: mode
draw: self
put: mode \ restore mode
;m
;class
endload
戻る