type Gtk_IM_Context_Record is new GObject_Record with null record;
type Gtk_IM_Context is access all Gtk_IM_Context_Record'Class;
type Cb_Gtk_IM_Context_UTF8_String_Void is not null access procedure (Self : access Gtk_IM_Context_Record'Class; Str : UTF8_String);
type Cb_GObject_UTF8_String_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Str : UTF8_String);
type Cb_Gtk_IM_Context_Gint_Gint_Boolean is not null access function (Self : access Gtk_IM_Context_Record'Class; Offset : Gint; N_Chars : Gint) return Boolean;
type Cb_GObject_Gint_Gint_Boolean is not null access function (Self : access Glib.Object.GObject_Record'Class; Offset : Gint; N_Chars : Gint) return Boolean;
type Cb_Gtk_IM_Context_Void is not null access procedure (Self : access Gtk_IM_Context_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_IM_Context_Boolean is not null access function (Self : access Gtk_IM_Context_Record'Class) return Boolean;
type Cb_GObject_Boolean is not null access function (Self : access Glib.Object.GObject_Record'Class) return Boolean;
Input_Hints_Property : constant Gtk.Enums.Property_Gtk_Input_Hints;
Input_Purpose_Property : constant Gtk.Enums.Property_Gtk_Input_Purpose;
Signal_Commit : constant Glib.Signal_Name := "commit";
Signal_Delete_Surrounding : constant Glib.Signal_Name := "delete-surrounding";
Signal_Preedit_Changed : constant Glib.Signal_Name := "preedit-changed";
Signal_Preedit_End : constant Glib.Signal_Name := "preedit-end";
Signal_Preedit_Start : constant Glib.Signal_Name := "preedit-start";
Signal_Retrieve_Surrounding : constant Glib.Signal_Name := "retrieve-surrounding";
function Get_Type return Glib.GType;
function Delete_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Offset | : Gint; | |
N_Chars | : Gint) return Boolean; |
function Filter_Keypress
( | Self | : not null access Gtk_IM_Context_Record; |
Event | : Gdk.Event.Gdk_Event_Key) return Boolean; |
procedure Focus_In
( | Self | : not null access Gtk_IM_Context_Record); |
procedure Focus_Out
( | Self | : not null access Gtk_IM_Context_Record); |
procedure Reset
( | Self | : not null access Gtk_IM_Context_Record); |
procedure Set_Client_Window
( | Self | : not null access Gtk_IM_Context_Record; |
Window | : Gdk.Gdk_Window); |
procedure Set_Cursor_Location
( | Self | : not null access Gtk_IM_Context_Record; |
Area | : Gdk.Rectangle.Gdk_Rectangle); |
procedure Set_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Text | : UTF8_String; | |
Len | : Gint; | |
Cursor_Index | : Gint); |
procedure Set_Use_Preedit
( | Self | : not null access Gtk_IM_Context_Record; |
Use_Preedit | : Boolean); |
procedure On_Commit
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_UTF8_String_Void; | |
After | : Boolean := False); |
procedure On_Commit
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_UTF8_String_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Delete_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_Gint_Gint_Boolean; | |
After | : Boolean := False); |
procedure On_Delete_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_Gint_Gint_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Preedit_Changed
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_Void; | |
After | : Boolean := False); |
procedure On_Preedit_Changed
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Preedit_End
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_Void; | |
After | : Boolean := False); |
procedure On_Preedit_End
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Preedit_Start
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_Void; | |
After | : Boolean := False); |
procedure On_Preedit_Start
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
procedure On_Retrieve_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_Gtk_IM_Context_Boolean; | |
After | : Boolean := False); |
procedure On_Retrieve_Surrounding
( | Self | : not null access Gtk_IM_Context_Record; |
Call | : Cb_GObject_Boolean; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
Gtk.IM_Context.Gtk_IM_Context defines the interface for GTK+ input methods. An input method is used by GTK+ text input widgets like Gtk.GEntry.Gtk_Entry to map from key events to Unicode character strings.
The user may change the current input method via a context menu, unless the Gtk.Settings.Gtk_Settings:gtk-show-input-method-menu GtkSettings property is set to FALSE. The default input method can be set programmatically via the Gtk.Settings.Gtk_Settings:gtk-im-module GtkSettings property. Alternatively, you may set the GTK_IM_MODULE environment variable as documented in gtk-running.
The Gtk.GEntry.Gtk_Entry Gtk.GEntry.Gtk_Entry:im-module and Gtk.Text_View.Gtk_Text_View Gtk.Text_View.Gtk_Text_View:im-module properties may also be used to set input methods for specific widget instances. For instance, a certain entry widget might be expected to contain certain characters which would be easier to input with a certain input method.
An input method may consume multiple key events in sequence and finally output 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. For instance, the default GTK+ 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.
Ctrl+Shift+u20AC for example results in the euro symbol.
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 implements a subclass of Gtk.IM_Context.Gtk_IM_Context or Gtk.IM_Context_Simple.Gtk_IM_Context_Simple and exports these four functions: void im_module_init(Gtype.Module.Gtype_Module *module); This function should register the GType of the Gtk.IM_Context.Gtk_IM_Context subclass which implements the input method by means of g_type_module_register_type. Note that g_type_register_static cannot be used as the type needs to be registered dynamically. void im_module_exit(void); Here goes any cleanup code your input method might require on module unload. void im_module_list(const Gtk_IMContext_Info ***contexts, int *n_contexts) { *contexts = info_list; *n_contexts = G_N_ELEMENTS (info_list); } This function returns the list of input methods provided by the module.
The example implementation above shows a common solution and simply returns a pointer to statically defined array of Gtk_IMContext_Info items for each provided input method. Gtk.IM_Context.Gtk_IM_Context * im_module_create(const Gchar *context_id); This function should return a pointer to a newly created instance of the Gtk.IM_Context.Gtk_IM_Context subclass identified by Context_Id. The context ID is the same as specified in the Gtk_IMContext_Info array returned by im_module_list.
After a new loadable input method module has been installed on the system, the configuration file 'gtk.immodules' needs to be regenerated by <link linkend="gtk-query-immodules-3.0">gtk-query-immodules-3.0</link>, in order for the new input method to become available to GTK+ applications.