abstract class vaseGui::TextAreaModel

sys::Obj
  vaseGui::TextAreaModel

@Js

TextAreaModel models the document and styling of a TextArea document.

charCount

abstract Int charCount()

Return the number of characters in the content.

line

abstract Str line(Int lineIndex)

Return the line at the given zero based line index without delimiters.

lineAtOffset

abstract Int lineAtOffset(Int offset)

Return the zero based line index at the given character offset.

lineBackground

virtual Color? lineBackground(Int lineIndex)

Return the color to use for the specified line's background. Normal lineStyling backgrounds only cover the width of the text. However, the lineBackground covers the width of the entire edit area. Return null for no special background.

lineCount

abstract Int lineCount()

Return the number of lines.

lineDelimiter

virtual Str lineDelimiter()

Return the line delimiter that should be used when inserting new lines. The default is "\n".

lineStyling

virtual List<Obj>? lineStyling(Int lineIndex)

Return the styled segments for the given zero based line index. The result is a list of Int/RichTextStyle pairs where the Int specifies a zero based char offset of the line using a pattern such as:

[Int, RichTextStyle, Int, RichTextStyle, ...]
modify

abstract Void modify(Int start, Int replaceLen, Str newText)

Replace the text with newText starting at position start for a length of replaceLen. The model implementation must fire the onModify event.

modifyLine

abstract Void modifyLine(Int lineIndex, Str? line, Bool add)

offsetAtLine

abstract Int offsetAtLine(Int lineIndex)

Return the character offset of the first character of the given zero based line index.

onModify

EventListeners onModify()

Callback model generated when the text is modified.

Event id fired:

Event fields:

posAtOffset

abstract Point posAtOffset(Int offset)

text

abstract Str text

Get or set the entire text document.

textRange

virtual Str textRange(Int start, Int len)

Returns a string representing the content at the given range. The default implementation of textRange is optimized to assume the backing store is based on lines.