gtk.imcontext
Module for [IMContext] class
Types 3
[gtk.imcontext.IMContext] defines the interface for GTK input methods.
[gtk.imcontext.IMContext] is used by GTK text input widgets like [gtk.text.Text] 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.imcontext.IMContext] will emit signal@Gtk.IMContext::preedit-start, signal@Gtk.IMContext::preedit-changed and signal@Gtk.IMContext::preedit-end signals.
For instance, the built-in GTK input method [gtk.imcontext_simple.IMContextSimple] implements the input of arbitrary Unicode code points by holding down the
<kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>u</kbd>followed by the hexadecimal digits of the code point. When releasing the
<kbd>Control</kbd> and <kbd>Shift</kbd> keys, preediting ends and thecharacter 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 [gio.ioextension.IOExtension] for the extension point named "gtk-im-module".
To connect a widget to the users preferred input method, you should use [gtk.immulticontext.IMMulticontext].
IMContextGidBuilder builder()Get builder for [gtk.imcontext.IMContext] Returns: New builder objectgtk.types.InputHints inputHints() @propertyGet `inputHints` property. Returns: Additional hints that allow input methods to fine-tune their behaviour.void inputHints(gtk.types.InputHints propval) @propertySet `inputHints` property. Params: propval = Additional hints that allow input methods to fine-tune their behaviour.gtk.types.InputPurpose inputPurpose() @propertyGet `inputPurpose` property. Returns: The purpose of the text field that the `GtkIMContext is connected to.void inputPurpose(gtk.types.InputPurpose propval) @propertySet `inputPurpose` property. Params: propval = The purpose of the text field that the `GtkIMContext is connected to.bool activateOsk(gdk.event.Event event = null)Requests the platform to show an on-screen keyboard for user input.bool deleteSurrounding(int offset, int nChars)Asks the widget that the input context is attached to delete characters around the cursor position by emitting the `::delete_surrounding` signal.bool filterKey(bool press, gdk.surface.Surface surface, gdk.device.Device device, uint time, uint keycode, gdk.types.ModifierType state, int group)Allow an input method to forward key press and release events to another input method without necessarily having a [gdk.event.Event] available.bool filterKeypress(gdk.event.Event event)Allow an input method to internally handle key press and release events.void focusIn()Notify the input method that the widget to which this input context corresponds has gained focus.void focusOut()Notify the input method that the widget to which this input context corresponds has lost focus.void getPreeditString(out string str, out pango.attr_list.AttrList attrs, out int cursorPos)Retrieve the current preedit string for the input context, and a list of attributes to apply to the string.bool getSurrounding(out string text, out int cursorIndex)Retrieves context around the insertion point.bool getSurroundingWithSelection(out string text, out int cursorIndex, out int anchorIndex)Retrieves context around the insertion point.void reset()Notify the input method that a change such as a change in cursor position has been made.void setClientWidget(gtk.widget.Widget widget = null)Set the client widget for the input context.void setCursorLocation(gdk.rectangle.Rectangle area)Notify the input method that a change in cursor position has been made.void setSurrounding(string text, int cursorIndex)Sets surrounding context around the insertion point and preedit string.void setSurroundingWithSelection(string text, int cursorIndex, int anchorIndex)Sets surrounding context around the insertion point and preedit string. This function is expected to be called in response to the `signalGtk.IMContext::retrieve_surrounding` signal, and will likely...void setUsePreedit(bool usePreedit)Sets whether the IM context should use the preedit string to display feedback.gulong connectCommit(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == string)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 3)Connect to `Commit` signal.gulong connectDeleteSurrounding(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 4)Connect to `DeleteSurrounding` signal.gulong connectPreeditChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 2)Connect to `PreeditChanged` signal.gulong connectPreeditEnd(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 2)Connect to `PreeditEnd` signal.gulong connectPreeditStart(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 2)Connect to `PreeditStart` signal.gulong connectRetrieveSurrounding(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.imcontext.IMContext)))
&& Parameters!T.length < 2)Connect to `RetrieveSurrounding` signal.T inputHints(gtk.types.InputHints propval)Set `inputHints` property. Params: propval = Additional hints that allow input methods to fine-tune their behaviour. Returns: Builder instance for fluent chainingT inputPurpose(gtk.types.InputPurpose propval)Set `inputPurpose` property. Params: propval = The purpose of the text field that the `GtkIMContext is connected to.