type Gtk_Accel_Map_Record is new GObject_Record with null record;
type Gtk_Accel_Map is access all Gtk_Accel_Map_Record'Class;
type Gtk_Accel_Map_Foreach is access procedure (Accel_Path : UTF8_String; Accel_Key : Gdk.Types.Gdk_Key_Type; Accel_Mods : Gdk.Types.Gdk_Modifier_Type; Changed : Boolean);
type Cb_Gtk_Accel_Map_UTF8_String_Gdk_Key_Type_Gdk_Modifier_Type_Void is not null access procedure (Self : access Gtk_Accel_Map_Record'Class; Accel_Path : UTF8_String; Accel_Key : Gdk.Types.Gdk_Key_Type; Accel_Mods : Gdk.Types.Gdk_Modifier_Type);
type Cb_GObject_UTF8_String_Gdk_Key_Type_Gdk_Modifier_Type_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Accel_Path : UTF8_String; Accel_Key : Gdk.Types.Gdk_Key_Type; Accel_Mods : Gdk.Types.Gdk_Modifier_Type);
Signal_Changed : constant Glib.Signal_Name := "changed";
function Get_Type return Glib.GType;
procedure Foreach
( | Foreach_Func | : Gtk_Accel_Map_Foreach); |
procedure Foreach_Unfiltered
( | Foreach_Func | : Gtk_Accel_Map_Foreach); |
procedure Add_Entry
( | Accel_Path | : UTF8_String; |
Accel_Key | : Gdk.Types.Gdk_Key_Type; | |
Accel_Mods | : Gdk.Types.Gdk_Modifier_Type); |
procedure Add_Filter
( | Filter_Pattern | : UTF8_String); |
function Change_Entry
( | Accel_Path | : UTF8_String; |
Accel_Key | : Gdk.Types.Gdk_Key_Type; | |
Accel_Mods | : Gdk.Types.Gdk_Modifier_Type; | |
Replace | : Boolean) return Boolean; |
function Get return Gtk_Accel_Map;
procedure Load
( | File_Name | : UTF8_String); |
procedure Load_Fd
( | Fd | : Gint); |
procedure Lock_Path
( | Accel_Path | : UTF8_String); |
procedure Lookup_Entry
( | Accel_Path | : UTF8_String; |
Key | : out Gtk.Accel_Group.Gtk_Accel_Key; | |
Found | : out Boolean); |
procedure Save
( | File_Name | : UTF8_String); |
procedure Save_Fd
( | Fd | : Gint); |
procedure Unlock_Path
( | Accel_Path | : UTF8_String); |
procedure On_Changed
( | Self | : not null access Gtk_Accel_Map_Record; |
Call | : Cb_Gtk_Accel_Map_UTF8_String_Gdk_Key_Type_Gdk_Modifier_Type_Void; | |
After | : Boolean := False); |
procedure On_Changed
( | Self | : not null access Gtk_Accel_Map_Record; |
Call | : Cb_GObject_UTF8_String_Gdk_Key_Type_Gdk_Modifier_Type_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
Accelerator maps are used to define runtime configurable accelerators.
Functions for manipulating them are are usually used by higher level convenience mechanisms like Gtk.UI_Manager.Gtk_UI_Manager and are thus considered "low-level". You'll want to use them if you're manually creating menus that should have user-configurable accelerators.
Accelerator is uniquely defined by: * accelerator path * accelerator key * accelerator modifiers The accelerator path must consist of "<WINDOWTYPE>/Category1/Category2/.../Action", where WINDOWTYPE should be a unique application-specific identifier that corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image", "Abiword-Document" or "Gnumeric-Settings". The "Category1/.../Action" portion is most appropriately chosen by the action the accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path, e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All". So a full valid accelerator path may look like: "<Gimp-Toolbox>/File/Dialogs/Tool Options...".
All accelerators are stored inside one global Gtk.Accel_Map.Gtk_Accel_Map that can be obtained using Gtk.Accel_Map.Get. See <link linkend="monitoring-changes">Monitoring changes</link> for additional details. == Manipulating accelerators == New accelerators can be added using Gtk.Accel_Map.Add_Entry. To search for specific accelerator, use Gtk.Accel_Map.Lookup_Entry. Modifications of existing accelerators should be done using Gtk.Accel_Map.Change_Entry.
In order to avoid having some accelerators changed, they can be locked using Gtk.Accel_Map.Lock_Path. Unlocking is done using Gtk.Accel_Map.Unlock_Path. == Saving and loading accelerator maps == Accelerator maps can be saved to and loaded from some external resource.
For simple saving and loading from file, Gtk.Accel_Map.Save and Gtk.Accel_Map.Load are provided. Saving and loading can also be done by providing file descriptor to Gtk.Accel_Map.Save_Fd and Gtk.Accel_Map.Load_Fd. == Monitoring changes == Gtk.Accel_Map.Gtk_Accel_Map object is only useful for monitoring changes of accelerators. By connecting to Gtk.Accel_Map.Gtk_Accel_Map::changed signal, one can monitor changes of all accelerators. It is also possible to monitor only single accelerator path by using it as a detail of the Gtk.Accel_Map.Gtk_Accel_Map::changed signal.