VSTGUI 4.10
Graphical User Interface Framework not only for VST plugins
Loading...
Searching...
No Matches
ITextEditor Struct Referenceabstract

text editor interface More...

#include <ctexteditor.h>

+ Inheritance diagram for ITextEditor:

Classes

struct  Style
 Style configuration for the text editor. More...
 

Public Types

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>
 

Public Member Functions

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.
 

Detailed Description

text editor interface

Member Typedef Documentation

◆ FindOptions

Member Enumeration Documentation

◆ Command

enum class Command : uint32_t
strong

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

enum class FindOption : uint32_t
strong

Find options for searching text.

Enumerator
CaseSensitive 

Match case when searching.

WholeWords 

Match whole words only.

Constructor & Destructor Documentation

◆ ~ITextEditor()

virtual ~ITextEditor ( )
virtualdefaultnoexcept

Member Function Documentation

◆ canHandleCommand()

virtual bool canHandleCommand ( Command cmd) const
pure virtual

Query if a command can be handled by the editor.

Parameters
cmdThe command to query.
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
cmdThe 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()

virtual bool setCommandKeyBinding ( Command cmd,
char32_t character,
VirtualKey virt,
Modifiers modifiers ) const
pure virtual

Set a key binding for a command.

Parameters
cmdThe command to bind.
characterThe character to bind.
virtThe virtual key code.
modifiersThe key modifiers.
Returns
True if the key binding was set, false otherwise.

Implemented in TextEditorView.

◆ setFindOptions()

virtual void setFindOptions ( FindOptions opt) const
pure virtual

Set the find options for searching text.

Parameters
optThe 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
utf8TextThe 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
utf8TextThe new text to set, as a UTF-8 string view.
clearSelectionIf 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
styleThe style configuration to apply.

Implemented in TextEditorView.


The documentation for this struct was generated from the following file: