TextDisplay()~TextDisplay(booleanautosized=false)
Create or destroy a TextDisplay. If autosized is true, the TextDisplay will automatically grow
its size as text is added. The default is to keep the size constant.
voidLineHeight(Coordlineheight)voidTabWidth(Coordtabwidth)
Lines of text will be positioned with baselines separated by lineheight. Tab characters in the
text will cause the following character to be positioned an integral multiple of tabwidth from the
beginning of the line.
voidResize(Coordxmin,Coordymin,Coordxmax,Coordymax)voidBounds(Coord&xmin,Coord&ymin,Coord&xmax,Coord&ymax)
Specify or query the size of the display. Only lines of text that fall completely inside the
specified region will be displayed. TextDisplay will not draw on any part of the canvas outside
the specified bounds. Conversely, TextDisplay is free to draw on any part of the canvas within
the specified bounds.
voidDraw(Painter*,Canvas*)
Specify the painter and canvas to use for drawing operations; the painter specifies the font,
colors, and geometric transformation. Draw should be called before performing any operation on
the TextDisplay which produces output or requires graphical information, or when there is a
possibility that the painter or canvas has changed since the function was last called.
voidRedraw(Coordleft,Coordbottom,Coordright,Coordtop)
Redraw a specified region of the display.
voidScroll(intline,Coordx,Coordy)
Scroll the display so that line line is positioned with its upper-left corner at (x, y). There
are no restrictions on the arguments: it is possible to scroll the display so that no lines are
visible.
voidInsertLinesAfter(intline,intcount)voidInsertLinesBefore(intline,intcount)voidDeleteLinesAfter(intline,intcount)voidDeleteLinesBefore(intline,intcount)
Insert or delete whole lines of text. Line line is not affected by the operation. Other lines
will move up or down to accommodate the changes. Newly inserted lines are blank. The specified
line need not refer to an existing line.
voidInsertText(intline,intindex,constchar*,intcount)voidDeleteText(intline,intindex,intcount)voidReplaceText(intline,constchar*,intcount)
Modify the text within line line. InsertText and DeleteText will cause the following characters
on the line to move to accommodate the changes. ReplaceText replaces the entire text of the line.
If the specified line is non-existent, a new line will be created.
voidStyle(intline1,intindex1,intline2,intindex2,intstyle)voidAddStyle(intline1,intindex1,intline2,intindex2,intstyle)voidRemoveStyle(intline1,intindex1,intline2,intindex2,intstyle)
Modify the styling of a range of text. Style replaces any existing style; AddStyle adds style
style in addition to any existing styles; RemoveStyle removes style style without affecting other
existing styles. Styles are specified as any combination of the constants Plain, Boldface,
Underlined, and Reversed.
voidCaretStyle(intstyle)voidCaret(intline,intindex)
Control the shape and position of a caret. Valid caret styles are currently NoCaret, BarCaret,
UnderscoreCaret and OutlineCaret. TextDisplay does not automatically adjust the position of the
caret following insertions and deletions.
intLineNumber(Coordy)intLineIndex(intline,Coordx)
Map x and y display coordinates into line and index text coordinates. LineNumber returns the
number of the line that contains the specified vertical position y. LineIndex returns the index
into line line that best corresponds to the specified horizontal position x.
CoordWidth()CoordHeight()
Return the width or the height of the text currently displayed by the TextDisplay. Width returns
the width of the longest line in the display. Height returns the distance from the top of the
topmost line to the bottom of the bottommost line. Note that these dimensions do not necessarily
correspond to the TextDisplay's bounds as returned by Bounds.
CoordBase(intline)CoordTop(intline)CoordLeft(intline,intindex)CoordRight(intline,intindex)
Map line and index text coordinates into x and y display coordinates. The return values define a
bounding box for the character specified by line and index.