ZFormatRange

class Tui::ZFormatRange

This class is copyable and movable. It does not define comparison operators.

A range of text to be associated with a set of formating parameters.

This is used by Tui::ZTextLayout for coloring specific parts of the text.

Constructors

ZFormatRange()

Creates an empty format range.

ZFormatRange(int start, int length, ZTextStyle format, ZTextStyle formattingChar, int userData = 0)

Constructs a format range and sets its data.

This is a short form that has the same result as calling void setStart(int start), void setLength(int length), void setFormat(const ZTextStyle &format), void setFormattingChar(const ZTextStyle &formattingChar) and void setUserData(int userData) with the passed parameters.

Functions

int start() const
void setStart(int start)

The start of the range in code units.

int length() const
void setLength(int length)

The length of the range in code units.

ZTextStyle format() const
void setFormat(const ZTextStyle &format)

The text style

ZTextStyle formattingChar() const
void setFormattingChar(const ZTextStyle &formattingChar)

The style to use for displaying tabs and spaces when Tui::ZTextOption::ShowTabsAndSpaces is used.

int userData() const
void setUserData(int userData)

The user data property can be used by the application to store additional data in a format range.

This may serve as a additional input for the color mapping functions in ZTextOption.