text editor interface
More...
#include <ctexteditor.h>
|
| enum class | Command : uint32_t {
Undo
, Redo
, Cut
, Copy
,
Paste
, FindNext
, FindPrevious
, SelectAll
,
UseSelectionForFind
, ShiftLeft
, ShiftRight
, ShowFindPanel
,
TakeFocus
} |
| | Editor command enumeration. More...
|
| |
| enum class | FindOption : uint32_t { CaseSensitive
, WholeWords
} |
| | Find options for searching text. More...
|
| |
| using | FindOptions = EnumBitset<FindOption> |
| |
|
| virtual | ~ITextEditor () noexcept=default |
| |
| virtual bool | setPlainText (std::string_view utf8Text, bool clearSelection=false) const =0 |
| | Set the plain text content of the editor.
|
| |
| virtual std::string | getPlainText () const =0 |
| | Get the plain text content of the editor.
|
| |
| virtual void | resetController () const =0 |
| | Reset the controller associated with this text editor.
|
| |
| virtual void | setStyle (const Style &style) const =0 |
| | Set the style of the text editor.
|
| |
| virtual bool | canHandleCommand (Command cmd) const =0 |
| | Query if a command can be handled by the editor.
|
| |
| virtual bool | handleCommand (Command cmd) const =0 |
| | Handle a command in the editor.
|
| |
| virtual bool | setCommandKeyBinding (Command cmd, char32_t character, VirtualKey virt, Modifiers modifiers) const =0 |
| | Set a key binding for a command.
|
| |
| virtual void | setFindOptions (FindOptions opt) const =0 |
| | Set the find options for searching text.
|
| |
| virtual void | setFindString (std::string_view utf8Text) const =0 |
| | Set the string to search for.
|
| |
◆ FindOptions
◆ Command
Editor command enumeration.
| Enumerator |
|---|
| Undo | Undo the last action.
|
| Redo | Redo the last undone action.
|
| Cut | Cut the selected text.
|
| Copy | Copy the selected text.
|
| Paste | Paste text from the clipboard.
|
| FindNext | Find the next occurrence.
|
| FindPrevious | Find the previous occurrence.
|
| SelectAll | Select all text.
|
| UseSelectionForFind | Use the current selection for find.
|
| ShiftLeft | Shift selection left.
|
| ShiftRight | Shift selection right.
|
| ShowFindPanel | Show the find panel.
|
| TakeFocus | Take keyboard focus.
|
◆ FindOption
Find options for searching text.
| Enumerator |
|---|
| CaseSensitive | Match case when searching.
|
| WholeWords | Match whole words only.
|
◆ ~ITextEditor()
◆ canHandleCommand()
| virtual bool canHandleCommand |
( |
Command | cmd | ) |
const |
|
pure virtual |
Query if a command can be handled by the editor.
- Parameters
-
- Returns
- True if the command can be handled, false otherwise.
Implemented in TextEditorView.
◆ getPlainText()
| virtual std::string getPlainText |
( |
| ) |
const |
|
pure virtual |
Get the plain text content of the editor.
- Returns
- The current text as a UTF-8 string.
Implemented in TextEditorView.
◆ handleCommand()
| virtual bool handleCommand |
( |
Command | cmd | ) |
const |
|
pure virtual |
Handle a command in the editor.
- Parameters
-
| cmd | The command to handle. |
- Returns
- True if the command was handled, false otherwise.
Implemented in TextEditorView.
◆ resetController()
| virtual void resetController |
( |
| ) |
const |
|
pure virtual |
Reset the controller associated with this text editor.
Implemented in TextEditorView.
◆ setCommandKeyBinding()
Set a key binding for a command.
- Parameters
-
| cmd | The command to bind. |
| character | The character to bind. |
| virt | The virtual key code. |
| modifiers | The key modifiers. |
- Returns
- True if the key binding was set, false otherwise.
Implemented in TextEditorView.
◆ setFindOptions()
Set the find options for searching text.
- Parameters
-
| opt | The find options to set. |
Implemented in TextEditorView.
◆ setFindString()
| virtual void setFindString |
( |
std::string_view | utf8Text | ) |
const |
|
pure virtual |
Set the string to search for.
- Parameters
-
| utf8Text | The search string as a UTF-8 string view. |
Implemented in TextEditorView.
◆ setPlainText()
| virtual bool setPlainText |
( |
std::string_view | utf8Text, |
|
|
bool | clearSelection = false ) const |
|
pure virtual |
Set the plain text content of the editor.
- Parameters
-
| utf8Text | The new text to set, as a UTF-8 string view. |
| clearSelection | If true, clears the current selection after setting the text. |
- Returns
- True if the text was set successfully, false otherwise.
Implemented in TextEditorView.
◆ setStyle()
| virtual void setStyle |
( |
const Style & | style | ) |
const |
|
pure virtual |
Set the style of the text editor.
- Parameters
-
| style | The style configuration to apply. |
Implemented in TextEditorView.
The documentation for this struct was generated from the following file: