The InputMethodListener defines the communication interface of Kanzi input methods. More...
#include <kanzi/core.ui/input_method/input_method_listener.hpp>
Public Member Functions | |
void | cancelTextComposition () |
Tells the input method, which provides the text composition, to cancel the text composition. More... | |
void | commitCompositionText () |
Commits the composition text. More... | |
bool | isComposingText () const |
Returns the text composition state of the input method listener. More... | |
bool | isInputMethodAvailable (InputMethod &source) const |
Returns whether the input method is available. More... | |
void | onCompositionTextCommitted (InputMethod &source) |
The input method source tells the input method listener to add the composition text received by previous calls of onCompositionTextUpdated() into the cached text. More... | |
void | onCompositionTextUpdated (InputMethod &source, string_view text) |
The input method source tells the input method listener to update the composition text. More... | |
void | onCursorMoved (InputMethod &source, size_t position) |
The input method source tells the input method listener to update the cursor position. More... | |
void | onExecuteInputMethodAction (InputMethod &source) |
The input method source tells the input method listener to execute the input method action. More... | |
void | onInputMethodAvailable (InputMethod &source, bool available) |
The input method source informs its active input method listener about the available state. More... | |
bool | onInputMethodDisconnected (InputMethod &source) |
The input method source tells its active input method listener that it disconnected itself from the input method listener. More... | |
void | onInputTypeChanged (InputMethod &source, InputType inputType) |
The input method source tells the input method listener to update its input type. More... | |
void | onSelectionChanged (InputMethod &source, size_t start, size_t end) |
The input method source tells the input method listener to update the cursor positions at the start and end of the text selection. More... | |
void | onTextAdded (InputMethod &source, size_t position, string_view text) |
The input method source tells the input method listener to add a text to its cached text. More... | |
void | onTextChanged (InputMethod &source, string_view text) |
The input method source tells the input method listener to replace its cached text with the content passed in the text argument. More... | |
void | onTextCompositionCanceled (InputMethod &source) |
The input method source tells the input method listener to cancel the text composition, and remove the composition text from the content. More... | |
void | onTextCompositionStarted (InputMethod &source) |
The input method source tells the input method listener to enter the text composition state at the current cursor position. More... | |
void | onTextDeleted (InputMethod &source, size_t start, size_t end) |
The input method source tells the input method listener to remove the text between the start and end positions. More... | |
virtual | ~InputMethodListener () |
Destructor. More... | |
Input status methods | |
These methods provide the status of the input to the input methods to which the InputMethodListener is connected. | |
const TextEditBuffer & | getText () const |
Returns the text buffer that holds edited UTF-8 content. More... | |
InputType | getInputType () const |
Returns the input type used by the text input methods. More... | |
InputMethodAction | getInputMethodAction () const |
Returns the input method action of the text input methods. More... | |
bool | isReadOnly () const |
Returns whether the text of the TextEditBuffer of an InputMethodListener is unaffected by user input. More... | |
Protected Member Functions | |
void | connectInputMethods (Node &attachedNode) |
Connects the input methods to this listener. More... | |
void | disconnectInputMethods () |
Disconnects the input methods from this listener. More... | |
InputMethodListener (Domain *domain) | |
Constructor. More... | |
bool | isComposingText (InputMethod &inputMethod) const |
Checks whether the inputMethod is in the text composition state. More... | |
template<typename Method , typename... Arguments> | |
void | updateInputMethods (InputMethod *excludeInputMethod, Method method, const Arguments &... arguments) |
Calls a method of each input method with the arguments passed. More... | |
Overridable operations | |
virtual void | onInputMethodAvailableOverride (InputMethod &source, bool available)=0 |
To receive a notification about the availability of an input method source, override this method. More... | |
virtual bool | onInputMethodDisconnectedOverride (InputMethod &source)=0 |
To deactivate an input method listener, implement this method. More... | |
virtual bool | onTextAddedOverride (InputMethod &source, size_t position, string_view text)=0 |
To add text at a given position in the cached text, implement this method. More... | |
virtual bool | onTextChangedOverride (InputMethod &source, string_view text)=0 |
To replace the cached text with the text passed as argument, implement this method. More... | |
virtual bool | onTextDeletedOverride (InputMethod &source, size_t start, size_t end)=0 |
To delete the characters between the start and the end positions from the cached text, implement this method. More... | |
virtual bool | onTextCompositionStartedOverride (InputMethod &source)=0 |
To make the input method listener enter the text composition state, implement this method. More... | |
virtual bool | onCompositionTextUpdatedOverride (InputMethod &source, string_view text)=0 |
To update the composition text, implement this method. More... | |
virtual bool | onCompositionTextCommitedOverride (InputMethod &source)=0 |
To commit the composition text to the cached text, implement this method. More... | |
virtual void | onTextCompositionCanceledOverride (InputMethod &source)=0 |
To cancel text composition, implement this method. More... | |
virtual bool | onCursorMovedOverride (InputMethod &source, size_t position)=0 |
To update the cursor position, implement this method. More... | |
virtual bool | onSelectionChangedOverride (InputMethod &source, size_t start, size_t end)=0 |
To update the text selection, implement this method. More... | |
virtual void | onInputTypeChangedOverride (InputMethod &source, InputType inputType)=0 |
To update the input type, implement this method. More... | |
virtual void | onExecuteInputMethodActionOverride (InputMethod &source)=0 |
To execute the input action, implement this method. More... | |
Protected Attributes | |
InputMethodWeakPtr | m_composingInputMethod |
The input method that provides the text composition. More... | |
TextEditBuffer | m_editBuffer |
The buffer where the text input is stored. More... | |
InputMethodAction | m_inputMethodAction |
The label of the input action. More... | |
vector< pair< InputMethodSharedPtr, bool > > | m_inputMethods |
The input method instances with which the input method listener interacts. More... | |
InputType | m_inputType |
The input type. More... | |
bool | m_isReadOnly |
The read-only state. More... | |
The InputMethodListener defines the communication interface of Kanzi input methods.
Input methods use this interface to update the active client about the changes occurring on the input method. The input method listener implementation must use the InputMethod interface to initiate updates, and to notify the input methods about changes that occur on the client side.
|
virtual |
Destructor.
|
explicitprotected |
Constructor.
void kanzi::InputMethodListener::onInputMethodAvailable | ( | InputMethod & | source, |
bool | available | ||
) |
The input method source informs its active input method listener about the available state.
The input method stays connected also when it is temporarily unavailable.
source | The input method source that informs its active input method listener about the available state. |
available | The available state of the input method. |
bool kanzi::InputMethodListener::isInputMethodAvailable | ( | InputMethod & | source | ) | const |
Returns whether the input method is available.
For example, returns whether an on-screen keyboard is visible.
source | The input method source availability to check. |
bool kanzi::InputMethodListener::onInputMethodDisconnected | ( | InputMethod & | source | ) |
The input method source tells its active input method listener that it disconnected itself from the input method listener.
source | The input method source that tells its active input method listener that it disconnected. |
void kanzi::InputMethodListener::onTextChanged | ( | InputMethod & | source, |
string_view | text | ||
) |
The input method source tells the input method listener to replace its cached text with the content passed in the text argument.
source | The input method source that tells the input method listener to replace the cached text. |
text | The new text to set. |
void kanzi::InputMethodListener::onTextAdded | ( | InputMethod & | source, |
size_t | position, | ||
string_view | text | ||
) |
The input method source tells the input method listener to add a text to its cached text.
source | The input method source that tells the input method listener to add a text to the cached text. |
position | The position where the text is added. |
text | The text to append to the cached text. |
void kanzi::InputMethodListener::onTextDeleted | ( | InputMethod & | source, |
size_t | start, | ||
size_t | end | ||
) |
The input method source tells the input method listener to remove the text between the start and end positions.
source | The input method source that tells the input method listener to remove the text. |
start | The start position of the text to remove. |
end | The end position of the text to remove. |
bool kanzi::InputMethodListener::isComposingText | ( | ) | const |
Returns the text composition state of the input method listener.
void kanzi::InputMethodListener::onTextCompositionStarted | ( | InputMethod & | source | ) |
The input method source tells the input method listener to enter the text composition state at the current cursor position.
source | The input method source that tells the input method listener to prepare for receiving composition text. |
void kanzi::InputMethodListener::onCompositionTextUpdated | ( | InputMethod & | source, |
string_view | text | ||
) |
The input method source tells the input method listener to update the composition text.
source | The input method source that tells the input method listener to update the composition text. |
text | The text to insert into the cached text. |
void kanzi::InputMethodListener::onCompositionTextCommitted | ( | InputMethod & | source | ) |
The input method source tells the input method listener to add the composition text received by previous calls of onCompositionTextUpdated() into the cached text.
source | The input method source that tells the input method listener to commit the composition text. |
void kanzi::InputMethodListener::onTextCompositionCanceled | ( | InputMethod & | source | ) |
The input method source tells the input method listener to cancel the text composition, and remove the composition text from the content.
source | The input method source that tells the input method listener to cancel the text composition. |
void kanzi::InputMethodListener::onCursorMoved | ( | InputMethod & | source, |
size_t | position | ||
) |
The input method source tells the input method listener to update the cursor position.
source | The input method source that tells the input method listener to update the cursor position. |
position | The position of the cursor to set. |
void kanzi::InputMethodListener::onSelectionChanged | ( | InputMethod & | source, |
size_t | start, | ||
size_t | end | ||
) |
The input method source tells the input method listener to update the cursor positions at the start and end of the text selection.
source | The input method that tells the input method listener to update the cursor positions. |
start | The cursor position at the start of the text selection to set. |
end | The cursor position at the end of the text selection to set. |
void kanzi::InputMethodListener::onInputTypeChanged | ( | InputMethod & | source, |
InputType | inputType | ||
) |
The input method source tells the input method listener to update its input type.
source | The input method source that tells the input method listener to update its input type. |
inputType | The input type to set. |
void kanzi::InputMethodListener::onExecuteInputMethodAction | ( | InputMethod & | source | ) |
The input method source tells the input method listener to execute the input method action.
source | The input method source that tells the input method listener to execute the input method action. |
void kanzi::InputMethodListener::cancelTextComposition | ( | ) |
Tells the input method, which provides the text composition, to cancel the text composition.
void kanzi::InputMethodListener::commitCompositionText | ( | ) |
Commits the composition text.
const TextEditBuffer& kanzi::InputMethodListener::getText | ( | ) | const |
Returns the text buffer that holds edited UTF-8 content.
InputType kanzi::InputMethodListener::getInputType | ( | ) | const |
Returns the input type used by the text input methods.
InputMethodAction kanzi::InputMethodListener::getInputMethodAction | ( | ) | const |
Returns the input method action of the text input methods.
bool kanzi::InputMethodListener::isReadOnly | ( | ) | const |
Returns whether the text of the TextEditBuffer of an InputMethodListener is unaffected by user input.
|
protected |
Connects the input methods to this listener.
|
protected |
Disconnects the input methods from this listener.
|
protected |
Checks whether the inputMethod is in the text composition state.
|
protectedpure virtual |
To receive a notification about the availability of an input method source, override this method.
source | The input method source whose available state changed. |
available | The available state of the input method. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To deactivate an input method listener, implement this method.
source | The input method source that tells the input method listener to deactivate. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To add text at a given position in the cached text, implement this method.
This method is called by the InputMethodListener::onTextAdded() method.
source | The input method source that tells the input method listener to add a text to the cached text. |
position | The position where to add the text. |
text | The text to append to the cached text. Kanzi expects the input method listener to move the cursor to the end of the text added to the cached text. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To replace the cached text with the text passed as argument, implement this method.
This method is called by the InputMethodListener::onTextChanged() method.
source | The input method source that tells the input method listener to replace the cached text. |
text | The text to set. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To delete the characters between the start and the end positions from the cached text, implement this method.
This method is called by the InputMethodListener::onTextDeleted() method.
source | The input method source that tells the input method listener to remove the text. |
start | The start position of the text to remove. |
end | The end position of the text to remove. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To make the input method listener enter the text composition state, implement this method.
This method is called by the InputMethodListener::onTextCompositionStarted() method.
source | The input method source that tells the input method listener to enter the text composition state. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To update the composition text, implement this method.
This method is called by the InputMethodListener::onCompositionTextUpdated() method.
source | The input method source that tells the input method listener to update the composition text. |
text | The text to insert into the cached text. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To commit the composition text to the cached text, implement this method.
This method is called by the InputMethodListener::onCompositionTextCommitted() method.
source | The input method source that tells the input method listener to commit the composition text. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To cancel text composition, implement this method.
This method is called by the InputMethodListener::onTextCompositionCanceled() method.
source | The input method source that tells the input method listener to cancel text composition. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To update the cursor position, implement this method.
This method is called by the InputMethodListener::onCursorMoved() method.
source | The input method source that tells the input method listener to update the cursor position. |
position | The position of the cursor to set. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To update the text selection, implement this method.
This method is called by the InputMethodListener::onSelectionChanged() method.
source | The input method that tells the input method listener to update the cursor positions. |
start | The cursor position at the start of the text selection to set. |
end | The cursor position at the end of the text selection to set. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To update the input type, implement this method.
This method is called by the InputMethodListener::onInputTypeChanged() method.
source | The input method that tells the input method listener to update the input type. |
inputType | The input type to set. |
Implemented in kanzi::TextInputManipulator.
|
protectedpure virtual |
To execute the input action, implement this method.
This method is called by the InputMethodListener::onExecuteInputMethodAction() method.
source | The input method that tells the input method listener to execute the input action. |
Implemented in kanzi::TextInputManipulator.
|
inlineprotected |
Calls a method of each input method with the arguments passed.
Method | The method type. |
Arguments | The argument types. |
excludeInputMethod | The input method to exclude. The method is not called on this input method. |
method | The address of the method to call. |
arguments | The arguments to pass to the method. |
|
protected |
The input method instances with which the input method listener interacts.
|
protected |
The input method that provides the text composition.
|
protected |
The buffer where the text input is stored.
|
protected |
The label of the input action.
|
protected |
The input type.
|
protected |
The read-only state.