Package: gtk

Class gtk:im-context

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

input-hints
The input-hints property of type gtk:input-hints (Read / Write)
Hints for the text field behaviour.
input-purpose
The input-purpose property of type gtk:input-purpose (Read / Write)
Purpose of the text field.
Default value: :free-from

Details

The gtk:im-context class defines the interface for GTK input methods. An input method is used by GTK text input widgets like the gtk:entry widget to map from key events to Unicode character strings.

An input method may consume multiple key events in sequence before finally outputting the composed result. This is called preediting, and an input method may provide feedback about this process by displaying the intermediate composition states as preedit text. To do so, the gtk:im-context object will emit the "preedit-start", "preedit-changed" and "preedit-end" signals.

For instance, the built-in GTK gtk:im-context-simple input method implements the input of arbitrary Unicode code points by holding down the Control and Shift keys and then typing u followed by the hexadecimal digits of the code point. When releasing the Control and Shift keys, preediting ends and the character is inserted as text. For example,
Ctrl+Shift+u 2 0 A C  
results in the € sign.

Additional input methods can be made available for use by GTK widgets as loadable modules. An input method module is a small shared library which provides a GIOExtension for the extension point named gtk-im-module.

To connect a widget to the users preferred input method, you should use the gtk:im-multicontext class.

Signal Details

The "commit" signal
lambda (context str)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
str
The string with the completed character(s) entered by the user.
The signal is emitted when a complete input sequence has been entered by the user. This can be a single character immediately after a key press or the final result of preediting.
The "delete-surrounding" signal
lambda (context offset n-chars)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
offset
The integer with the character offset from the cursor position of the text to be deleted. A negative value indicates a position before the cursor.
n-chars
The integer with the number of characters to be deleted.
Returns
True if the signal was handled.
The signal is emitted when the input method needs to delete all or part of the context surrounding the cursor.
The "preedit-changed" signal
lambda (context)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
The signal is emitted whenever the preedit sequence currently being entered has changed. It is also emitted at the end of a preedit sequence, in which case the gtk:im-context-preedit-string function returns the empty string.
The "preedit-end" signal
lambda (context)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
The signal is emitted when a preediting sequence has been completed or canceled.
The "preedit-start" signal
lambda (context)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
The signal is emitted when a new preediting sequence starts.
The "retrieve-surrounding" signal
lambda (context)    :run-last      
context
The gtk:im-context object on which the signal is emitted.
Returns
True if the signal was handled.
The signal is emitted when the input method requires the context surrounding the cursor. The callback should set the input method surrounding context by calling the gtk:im-context-surrounding function.
 

Slot Access Functions

Inherited Slot Access Functions

See also

2023-8-29