The InputMethod class defines the interface of the Kanzi input methods. More...
#include <kanzi/core.ui/input_method/input_method.hpp>
Public Member Functions | |
void | connect (InputMethodListener &listener, Node &attachedNode) |
Connects an input method listener to this input method. | |
void | disconnect (InputMethodListener &listener) |
Disconnects the listener passed as argument. | |
void | ensureAvailable (InputMethodListener &listener) |
Ensures that the input method is available for the input method listener. | |
InputMethodListener * | getListener () const |
Returns the active listener of the input method. | |
bool | isBlocked () const |
Checks whether the input method is blocked by another input method that is in the text composition state. | |
void | notifyCompositionEnd (InputMethodListener &listener) |
Notifies the input method that text composition is completed or canceled on the listener. | |
void | notifyCompositionStart (InputMethodListener &listener) |
Notifies the input method that text composition is started on the listener. | |
void | notifyCursorMove (InputMethodListener &listener, size_t position) |
Notifies the input method about the cursor position change in a listener. | |
void | notifyInputMethodActionChange (InputMethodListener &listener, InputMethodAction action) |
Notifies the input method that the input method action associated with the input method listener changed. | |
bool | notifyInputTypeAttributesChange (InputMethodListener &listener, EchoMode echoMode, InputType inputType) |
Notifies the input method that the input type attributes of the listener changed. | |
void | notifyReadOnlyChange (InputMethodListener &listener, bool readOnly) |
Notifies the input method that the input method listener read-only state is changed. | |
void | notifySelectionChange (InputMethodListener &listener, size_t start, size_t end) |
Notifies the input method about changes in text selection in a listener. | |
void | notifyTextChange (InputMethodListener &listener, string_view text, size_t position) |
Notifies the input method about the text change in a listener passed as argument. | |
virtual | ~InputMethod ()=default |
Destructor. | |
Input Method Listener notification interface | |
Use these methods to notify the active Input Method Listener about the events occurring on the Input Method. | |
bool | disconnectListener () |
Disconnects the input method from its active input method listener. | |
void | setText (string_view text) |
Tells the active input method listener to replace its cached text with the content passed in the text argument. | |
void | insertText (size_t position, string_view text) |
Tells the active input method listener to add a text to its cached text. | |
void | deleteText (size_t start, size_t end) |
Tells the active input method listener to remove the text between the start and end positions. | |
void | startTextComposition () |
Tells the active input method listener to enter text composition state at the current cursor position. | |
void | updateCompositionText (string_view text) |
Tells the active input method listener to update the composition text. | |
void | commitCompositionText () |
Tells the active input method listener to add the composition text received by previous calls of updateCompositionText() into the cached text. | |
void | cancelTextComposition () |
Tells the active input method listener to cancel the text composition and discard the composition text. | |
void | moveCursor (size_t position) |
Tells the active input method listener to update the cursor position. | |
void | updateSelection (size_t start, size_t end) |
Tells the active input method listener to update the cursor positions at the start and end of the text selection. | |
void | updateInputType (InputType inputType) |
Tells the active input method listener to update its input type. | |
void | executeInputMethodAction () |
Tells the active input method listener to execute the input method action. | |
Protected Member Functions | |
NodeSharedPtr | getAttachedNode () const |
Returns the node to which the input method is attached. | |
InputMethod ()=default | |
Default constructor. | |
Overridables | |
virtual void | connectOverride ()=0 |
To connect the active input method listener, override this method. | |
virtual void | disconnectOverride ()=0 |
To clear the state of the input method from previously active input method listener, override this method. | |
virtual void | ensureAvailableOverride () |
To esure the input method is available for the active input method listener, override this method. | |
virtual void | notifyTextChangeOverride (string_view text, size_t position)=0 |
To handle the text change in an active input method listener, override this method. | |
virtual void | notifyCompositionStartOverride ()=0 |
To handle the start of the text composition on an active input method listener, override this method. | |
virtual void | notifyCompositionEndOverride ()=0 |
To handle the completion or cancellation of the text composition on an active input method listener, override this method. | |
virtual void | notifyCursorMoveOverride (size_t position)=0 |
To handle the cursor position change in an active input method listener, override this method. | |
virtual void | notifySelectionChangeOverride (size_t start, size_t end)=0 |
To handle the changes in text selection in an active input method listener, override this method. | |
virtual bool | notifyInputTypeAttributesChangeOverride (EchoMode echoMode, InputType inputType) |
To handle the change in the input type of the active input method listener, override this method. | |
virtual void | notifyReadOnlyChangeOverride (bool readOnly) |
To handle the change in the read-only state of the active input method listener, override this method. | |
virtual void | notifyInputMethodActionChangeOverride (InputMethodAction action) |
Notifies the active input method that the input method action associated with the input method listener changed. | |
The InputMethod class defines the interface of the Kanzi input methods.
You must derive your input method implementations from this interface.
|
virtualdefault |
Destructor.
|
explicitprotecteddefault |
Default constructor.
void kanzi::InputMethod::connect | ( | InputMethodListener & | listener, |
Node & | attachedNode ) |
Connects an input method listener to this input method.
Passes the node which attaches to the input methods.
listener | The input method listener to connect to the input method. |
attachedNode | The Node to which the input method is attached. |
void kanzi::InputMethod::disconnect | ( | InputMethodListener & | listener | ) |
Disconnects the listener passed as argument.
listener | The input method listener to disconnect. |
void kanzi::InputMethod::ensureAvailable | ( | InputMethodListener & | listener | ) |
Ensures that the input method is available for the input method listener.
listener | The input method listener for which the input method is ensured to be available. |
|
inline |
Returns the active listener of the input method.
|
inline |
Checks whether the input method is blocked by another input method that is in the text composition state.
void kanzi::InputMethod::notifyTextChange | ( | InputMethodListener & | listener, |
string_view | text, | ||
size_t | position ) |
Notifies the input method about the text change in a listener passed as argument.
listener | The input method listener in which the text changed. |
text | The text in the input method listener to update. |
position | The cursor position in the input method listener. |
void kanzi::InputMethod::notifyCompositionStart | ( | InputMethodListener & | listener | ) |
Notifies the input method that text composition is started on the listener.
listener | The input method listener where text composition is started. |
void kanzi::InputMethod::notifyCompositionEnd | ( | InputMethodListener & | listener | ) |
Notifies the input method that text composition is completed or canceled on the listener.
listener | The input method listener where text composition is completed or canceled. |
void kanzi::InputMethod::notifyCursorMove | ( | InputMethodListener & | listener, |
size_t | position ) |
Notifies the input method about the cursor position change in a listener.
listener | The input method listener where the cursor position changed. |
position | The cursor position in the input method listener. |
void kanzi::InputMethod::notifySelectionChange | ( | InputMethodListener & | listener, |
size_t | start, | ||
size_t | end ) |
Notifies the input method about changes in text selection in a listener.
If both the start and the end position have the same value, the selection is cleared.
listener | The input method listener where text selection changed. |
start | The position of the start of text selection in the input method listener. |
end | The position of the end of text selection in the input method listener. |
bool kanzi::InputMethod::notifyInputTypeAttributesChange | ( | InputMethodListener & | listener, |
EchoMode | echoMode, | ||
InputType | inputType ) |
Notifies the input method that the input type attributes of the listener changed.
listener | The input method listener whose input type changed. |
echoMode | The echo mode of the input method listener. |
inputType | The input type of the input method listener. |
void kanzi::InputMethod::notifyReadOnlyChange | ( | InputMethodListener & | listener, |
bool | readOnly ) |
Notifies the input method that the input method listener read-only state is changed.
listener | The input method listener whose read-only state changed. |
readOnly | The read-only state of the input method listener. |
void kanzi::InputMethod::notifyInputMethodActionChange | ( | InputMethodListener & | listener, |
InputMethodAction | action ) |
Notifies the input method that the input method action associated with the input method listener changed.
Override this method if the input method supports changing the input method action.
listener | The input method listener whose input method action changed. |
action | The input method action associated to the input method listener. |
bool kanzi::InputMethod::disconnectListener | ( | ) |
Disconnects the input method from its active input method listener.
Do not call this method from disconnectOverride().
void kanzi::InputMethod::setText | ( | string_view | text | ) |
Tells the active input method listener to replace its cached text with the content passed in the text argument.
text | The new text to set. |
void kanzi::InputMethod::insertText | ( | size_t | position, |
string_view | text ) |
Tells the active input method listener to add a text to its cached text.
position | The position at which to add the text. |
text | The text to append to the cached text. |
void kanzi::InputMethod::deleteText | ( | size_t | start, |
size_t | end ) |
Tells the active input method listener to remove the text between the start and end positions.
start | The start position of the text to remove. |
end | The end position of the text to remove. |
void kanzi::InputMethod::startTextComposition | ( | ) |
Tells the active input method listener to enter text composition state at the current cursor position.
void kanzi::InputMethod::updateCompositionText | ( | string_view | text | ) |
Tells the active input method listener to update the composition text.
text | The text to append to the cached text. |
void kanzi::InputMethod::commitCompositionText | ( | ) |
Tells the active input method listener to add the composition text received by previous calls of updateCompositionText() into the cached text.
void kanzi::InputMethod::cancelTextComposition | ( | ) |
Tells the active input method listener to cancel the text composition and discard the composition text.
void kanzi::InputMethod::moveCursor | ( | size_t | position | ) |
Tells the active input method listener to update the cursor position.
position | The position of the cursor to set. |
void kanzi::InputMethod::updateSelection | ( | size_t | start, |
size_t | end ) |
Tells the active input method listener to update the cursor positions at the start and end of the text selection.
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. |
Tells the active input method listener to update its input type.
inputType | The input type to set. |
void kanzi::InputMethod::executeInputMethodAction | ( | ) |
Tells the active input method listener to execute the input method action.
|
inlineprotected |
Returns the node to which the input method is attached.
To connect the active input method listener, override this method.
Implemented in kanzi::WindowsIme.
To clear the state of the input method from previously active input method listener, override this method.
Do not call getListener() or getAttachedNode() inside disconnectOverride(). Kanzi can be already destroying the attached node and previously active listener.
Implemented in kanzi::WindowsIme.
To esure the input method is available for the active input method listener, override this method.
|
protectedpure virtual |
To handle the text change in an active input method listener, override this method.
text | The text in the input method listener to update. |
position | The cursor position in the input method listener. |
Implemented in kanzi::WindowsIme.
To handle the start of the text composition on an active input method listener, override this method.
Implemented in kanzi::WindowsIme.
To handle the completion or cancellation of the text composition on an active input method listener, override this method.
Implemented in kanzi::WindowsIme.
To handle the cursor position change in an active input method listener, override this method.
position | The cursor position in the input method listener. |
Implemented in kanzi::WindowsIme.
|
protectedpure virtual |
To handle the changes in text selection in an active input method listener, override this method.
If both the start and the end position have the same value, Kanzi clears the selection.
start | The position of the start of text selection in the input method listener. |
end | The position of the end of text selection in the input method listener. |
Implemented in kanzi::WindowsIme.
|
inlineprotectedvirtual |
To handle the change in the input type of the active input method listener, override this method.
The implementation must validate the input type and echo mode combination. If the combination is not valid, the implementation must update the input type of the input method listener.
echoMode | The echo mode of the input method listener. |
inputType | The input type of the input method listener. |
|
inlineprotectedvirtual |
To handle the change in the read-only state of the active input method listener, override this method.
readOnly | The read-only state of the input method listener. |
|
inlineprotectedvirtual |
Notifies the active input method that the input method action associated with the input method listener changed.
Override this method if the input method supports changing the input method action.
action | The input method action associated to the input method listener. |