class GUIInputCaret

Inherits: GUIInputTool

Helper class for dealing with caret for text input boxes and similar controls.

Public

Constructors

GUIInputCaret

GUIInputCaret()

Methods

~GUIInputCaret

~GUIInputCaret()

GetSprite

ImageSprite *GetSprite() const

Returns sprite used for rendering the caret.

GetBounds

GUIPhysicalArea GetBounds() const

Returns the bounds of the caret, relative to the current parent GUI element.

UpdateSprite

void UpdateSprite()

Rebuilts internal caret sprite using current properties.

MoveCaretToStart

void MoveCaretToStart()

Moves caret to the start of text.

MoveCaretToEnd

void MoveCaretToEnd()

Moves caret to the end of text.

MoveCaretLeft

void MoveCaretLeft()

Moves caret one character to the left, if not at start already.

MoveCaretRight

void MoveCaretRight()

Moves caret one character to the right, if not at end already.

MoveCaretUp

void MoveCaretUp()

Moves caret one line up if possible.

MoveCaretDown

void MoveCaretDown()

Moves caret one line down if possible.

MoveCaretToPos

void MoveCaretToPos(const GUIPhysicalPoint &pos)

Moves caret to the character nearest to the specified position.

Position is relative to parent GUI element.

MoveCaretToChar

void MoveCaretToChar(u32 characterIndex, CaretPos caretPos)

Moves the caret to a specific character index.

characterIndex
Index of the character to move the caret to.
caretPos
Whether to place the caret before or after the character.

GetCharIdxAtCaretPos

u32 GetCharIdxAtCaretPos() const

Returns character index after the current caret position.

GetCaretPosition

GUIPhysicalPoint GetCaretPosition() const

Returns current caret position, relative to parent GUI element.

GetCaretHeight

GUIPhysicalUnit GetCaretHeight() const

Returns height of the caret, in pixels.

IsCaretAtNewline

bool IsCaretAtNewline() const

Returns true if the character after the caret is newline.

GetMaxCaretPos

u32 GetMaxCaretPos() const

Returns maximum valid caret index.

GetCaretPos

u32 GetCaretPos() const

Returns current caret index (not equal to character index).

Private

Fields

mCaretPos

u32 mCaretPos

mCaretSprite

ImageSprite * mCaretSprite