TextEdit

Plain text input view.

Header#include "nativeui/text_edit.h"
Namespacenamespace nu
Typeclass (RefCounted)
InheritsView

Constructors

TextEdit()

Create a new TextEdit.

Class properties

const char* kClassName

The class name of this view.

Methods

void SetText(const std::string& text)

Change the text in the view.

Parameters

std::string GetText() const

Return currently displayed text.

Return

std::string

void Undo()

Undo the last edit operation in the undo queue.

void CanUndo() const

Return whether there are any actions in undo queue.

void Redo()

Redo the next action in the redo queue

void CanRedo() const

Return whether there are any actions in redo queue.

void Cut()

Delete (cut) the current selection, if any, copy the deleted text to the clipboard.

void Copy()

Copy current selection to clipboard.

void Paste()

Copy the current content of the clipboard to current caret position.

void SelectAll()

Select all text.

std::tuple<int, int> GetSelectionRange() const

Return the start position and end position of current selection.

If nothing is selected, (-1, -1) would be returned.

Return

std::tuple

void SelectRange(int start, int end)

Select text between start and end positions.

Parameters

std::string GetTextInRange(int start, int end) const

Return the text between start and end positions.

Parameters

Return

std::string

void InsertText(const std::string& text)

Insert text at current caret position.

Parameters

void InsertTextAt(const std::string& text, int position)

Insert text at the position.

Parameters

void Delete()

Delete text of current selection.

void DeleteRange(int start, int end)

Delete text between start and end positions.

Parameters

Events

void on_text_change(TextEdit* self)

Emitted when user has changed text.

Parameters

Preventable

No.