IMContext
Object Hierarchy:
Description:
[
CCode ( type_id =
"gtk_im_context_get_type ()" ) ]
public abstract class IMContext :
Object
The interface for GTK input methods.
`GtkIMContext` is used by GTK text input widgets like `GtkText` 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 `GtkIMContext` will emit [signal@Gtk.IMContext:GtkIMContext:preedit-start], [signal@Gtk.IMContext:
GtkIMContext:preedit-changed] and [signal@Gtk.IMContext:GtkIMContext:preedit-end] signals.
For instance, the built-in GTK input method [class@Gtk.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 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 [class@Gtk.IMMulticontext].
Content:
Properties:
Creation methods:
Methods:
- public virtual bool filter_keypress (EventKey event)
Allow an input method to internally handle key press and release
events.
- public virtual void focus_in ()
Notify the input method that the widget to which this input context
corresponds has gained focus.
- public virtual void focus_out ()
Notify the input method that the widget to which this input context
corresponds has lost focus.
- public virtual void get_preedit_string (out string str, out AttrList attrs, out int cursor_pos)
Retrieve the current preedit string for the input context, and a list
of attributes to apply to the string.
- public virtual bool get_surrounding (out string text, out int cursor_index)
Retrieves context around the insertion point.
- public virtual void reset ()
Notify the input method that a change such as a change in cursor
position has been made.
- public virtual void set_client_window (Window? window)
Set the client window for the input context; this is the
Window in which the input appears.
- public virtual void set_cursor_location (Rectangle area)
Notify the input method that a change in cursor position has been
made.
- public virtual void set_surrounding (string text, int len, int cursor_index)
Sets surrounding context around the insertion point and preedit
string.
- public virtual void set_use_preedit (bool use_preedit)
Sets whether the IM context should use the preedit string to display
feedback.
Signals:
- public virtual signal void commit (string str)
The commit signal is emitted when a
complete input sequence has been entered by the user.
- public virtual signal bool delete_surrounding (int offset, int n_chars)
The delete_surrounding signal is emitted
when the input method needs to delete all or part of the context surrounding the cursor.
- public virtual signal void preedit_changed ()
The preedit_changed signal is emitted
whenever the preedit sequence currently being entered has changed.
- public virtual signal void preedit_end ()
The preedit_end signal is emitted when a
preediting sequence has been completed or canceled.
- public virtual signal void preedit_start ()
The preedit_start signal is emitted when a
new preediting sequence starts.
- public virtual signal bool retrieve_surrounding ()
The retrieve_surrounding signal is emitted
when the input method requires the context surrounding the cursor.
Inherited Members:
All known members inherited from class GLib.Object