Fan

 

abstract class

fwt::RichTextModel

sys::Obj
  fwt::RichTextModel

RichTextModel models the document and styling of a RichText document.

Slots

charCountSource

abstract Int charCount()

Return the number of characters in the content.

lineSource

abstract Str line(Int lineIndex)

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

lineAtOffsetSource

abstract Int lineAtOffset(Int offset)

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

lineBackgroundSource

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.

lineCountSource

abstract Int lineCount()

Return the number of lines.

lineDelimiterSource

virtual Str lineDelimiter()

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

lineStylingSource

virtual 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.

modifySource

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.

offsetAtLineSource

abstract Int offsetAtLine(Int lineIndex)

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

onModifySource

readonly EventListeners onModify := EventListeners.()

Callback model generated when the text is modified.

Event id fired:

Event fields:

textSource

abstract Str text

Get or set the entire text document.

textRangeSource

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.