TextEditor(introws,intcols,inttabsize,inthighlight)~TextEditor()
Create or destroy an instance of TextEditor. The natural size of a TextEditor is specified by
rows and columns. The TextEditor will be tall enough to display rows lines of text in the current
font, and it will be wide enough to display columns characters. For proportionally-spaced fonts,
the width of the character 'n' is taken to be representative. Tab characters in the text are
expanded to multiples of tabsize character widths. The current selection highlighted with the
text style highlight.
voidEdit(TextBuffer*,intindex=0)
Specify the text buffer to edit. A text buffer must be specified before the TextEditor is
displayed. The optional index parameter specifies the initial selection point. If necessary, the
TextEditor is scrolled so that the selection point is visible.
intDot()intMark()
The current selection is bounded by two indices into the text buffer. By convention these indices
are called dot and mark. Dot is the position at which text will be inserted and deleted. Mark
locates the end of the selection that moves as the selection is modified. When the selection is
empty (an insertion point), dot and mark are equal.
voidInsertText(constchar*string,intcount)voidDeleteText(intcount)voidDeleteSelection()
Edit the text buffer at the current selection. InsertText inserts count characters from string
after dot. The selection becomes an insertion point following the newly inserted text.
DeleteText deletes count characters at dot. If count is positive, the characters following dot
are deleted; if count is negative the characters before dot are deleted. The selection becomes an
insertion point in the place of the deleted text. DeleteSelection deletes the text between dot
and mark, changing the selection to an insertion point.
voidBackwardCharacter(intcount)voidForwardCharacter(intcount)voidBackwardLine(intcount)voidForwardLine(intcount)voidBackwardWord(intcount)voidForwardWord(intcount)voidBackwardPage(intcount)voidForwardPage(intcount)
Move the current selection forward or backward by the specified number of the specified units.
The default movement is one unit. The selection is not moved before the beginning of after the
end of the text.
voidBeginningOfLine()voidEndOfLine()voidBeginningOfWord()voidEndOfWord()voidBeginningOfSelection()voidEndOfSelection()voidBeginningOfText()voidEndOfText()
Move the current selection forwards or backwards to the specified feature of the text.
voidScrollToSelection(booleanalways=false)voidSetScrollAlignment(Alignment)AlignmentGetScrollAlignment()
ScrollToSelction scrolls the display so that dot will be visible. If dot is currently visible and
always is false, no scrolling takes place; if dot is not visible or always is true, the display is
scrolled so that dot will be positioned as close as possible to the position specified by
SetScrollAlignment. GetScrollAlignment returns the current scroll alignment. The default
alignment is Center.
voidScrollToView(Coordx,Coordy)voidScrollBy(Coorddx,Coorddy)
ScrollToView scrolls the display so that the text currently at the position (x, y) will be
visible. If the specified point is currently visible, no scrolling takes place. ScrollBy
specifies an amount by which to scroll the display. Positive values scroll the display upwards
and to the right. In each case, the final position of the display is limited so that some text
will be visible.
voidGrabScroll(Event&)voidRateScroll(Event&)
Initiate grab scrolling or rate scrolling. Once called, GrabScroll (RateScroll) polls the current
mouse position as long as the middle (right) button is pressed. As GrabScroll polls, it scrolls
the text to follow the mouse position, making it appear as though the user is dragging the text
itself. Each time RateScroll polls the mouse, it scrolls the text by an amount corresponding to
the differential between the current and initial mouse positions. This creates the illusion of a
joystick interface: the further away the mouse is from its initial position, the greater the
scrolling increment and the faster the text appears to scroll; scrolling slows down, stops, and
reverses direction as the user drags the mouse back towards and past the initial position.
voidSelect(intdot)voidSelect(intdot,intmark)voidSelectMore(intmark)voidSelectAll()
Modify the current selection in terms of text indices. With a single parameter, Select moves both
dot and mark to the specified index. With two parameters, dot and mark can be controlled
independently. SelectMore leaves dot unchanged and moves mark. SelectAll sets dot to the end of
the text and mark to the beginning.
intLocate(Coordx,Coordy)
Return the text index most closely matching the point (x, y).