Synopsis#include <gtk/gtk.h> GtkAccelGroup; GtkAccelGroup* gtk_accel_group_new (void); #define gtk_accel_group_ref #define gtk_accel_group_unref void gtk_accel_group_connect (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags, GClosure *closure); void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group, const gchar *accel_path, GClosure *closure); gboolean (*GtkAccelGroupActivate) (GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier); gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey *key, GClosure *closure, gpointer data); gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group, GClosure *closure); gboolean gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods); GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, guint *n_entries); gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group, GQuark accel_quark, GObject *acceleratable, guint accel_key, GdkModifierType accel_mods); void gtk_accel_group_lock (GtkAccelGroup *accel_group); void gtk_accel_group_unlock (GtkAccelGroup *accel_group); gboolean gtk_accel_group_get_is_locked (GtkAccelGroup *accel_group); GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure *closure); GdkModifierType gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group); gboolean gtk_accel_groups_activate (GObject *object, guint accel_key, GdkModifierType accel_mods); GSList* gtk_accel_groups_from_object (GObject *object); GtkAccelKey* gtk_accel_group_find (GtkAccelGroup *accel_group, GtkAccelGroupFindFunc find_func, gpointer data); GtkAccelKey; gboolean gtk_accelerator_valid (guint keyval, GdkModifierType modifiers); void gtk_accelerator_parse (const gchar *accelerator, guint *accelerator_key, GdkModifierType *accelerator_mods); gchar* gtk_accelerator_name (guint accelerator_key, GdkModifierType accelerator_mods); gchar* gtk_accelerator_get_label (guint accelerator_key, GdkModifierType accelerator_mods); void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask); guint gtk_accelerator_get_default_mod_mask (void); Description
A GtkAccelGroup represents a group of keyboard accelerators,
typically attached to a toplevel GtkWindow (with
Note that accelerators are different from
mnemonics. Accelerators are shortcuts for
activating a menu item; they appear alongside the menu item they're a
shortcut for. For example "Ctrl+Q" might appear alongside the "Quit"
menu item. Mnemonics are shortcuts for GUI elements such as text
entries or buttons; they appear as underlined characters. See
DetailsGtkAccelGrouptypedef struct _GtkAccelGroup GtkAccelGroup; An object representing and maintaining a group of accelerators. gtk_accel_group_new ()GtkAccelGroup* gtk_accel_group_new (void); Creates a new GtkAccelGroup.
gtk_accel_group_ref#define gtk_accel_group_ref g_object_ref Warning
Deprecated equivalent of
gtk_accel_group_unref#define gtk_accel_group_unref g_object_unref Warning
Deprecated equivalent of gtk_accel_group_connect ()void gtk_accel_group_connect (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags, GClosure *closure);
Installs an accelerator in this group. When
The signature used for the Note that, due to implementation details, a single closure can only be connected to one accelerator group.
gtk_accel_group_connect_by_path ()void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group, const gchar *accel_path, GClosure *closure);
Installs an accelerator in this group, using an accelerator path to look
up the appropriate key and modifiers (see
The signature used for the
Note that
GtkAccelGroupActivate ()gboolean (*GtkAccelGroupActivate) (GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval, GdkModifierType modifier);
GtkAccelGroupFindFunc ()gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey *key, GClosure *closure, gpointer data);
Since 2.2 gtk_accel_group_disconnect ()gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group, GClosure *closure);
Removes an accelerator previously installed through
gtk_accel_group_disconnect_key ()gboolean gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods);
Removes an accelerator previously installed through
gtk_accel_group_query ()GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, guint *n_entries);
Queries an accelerator group for all entries matching
gtk_accel_group_activate ()gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group, GQuark accel_quark, GObject *acceleratable, guint accel_key, GdkModifierType accel_mods);
Finds the first accelerator in
gtk_accel_group_lock ()void gtk_accel_group_lock (GtkAccelGroup *accel_group); Locks the given accelerator group.
Locking an acelerator group prevents the accelerators contained
within it to be changed during runtime. Refer to
If called more than once,
gtk_accel_group_unlock ()void gtk_accel_group_unlock (GtkAccelGroup *accel_group);
Undoes the last call to
gtk_accel_group_get_is_locked ()gboolean gtk_accel_group_get_is_locked (GtkAccelGroup *accel_group);
Locks are added and removed using
Since 2.14 gtk_accel_group_from_accel_closure ()GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure *closure);
Finds the GtkAccelGroup to which
gtk_accel_group_get_modifier_mask ()GdkModifierType gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group);
Gets a GdkModifierType representing the mask for this
Since 2.14 gtk_accel_groups_activate ()gboolean gtk_accel_groups_activate (GObject *object, guint accel_key, GdkModifierType accel_mods);
Finds the first accelerator in any GtkAccelGroup attached
to
gtk_accel_groups_from_object ()GSList* gtk_accel_groups_from_object (GObject *object);
Gets a list of all accel groups which are attached to
gtk_accel_group_find ()GtkAccelKey* gtk_accel_group_find (GtkAccelGroup *accel_group, GtkAccelGroupFindFunc find_func, gpointer data);
Finds the first entry in an accelerator group for which
GtkAccelKeytypedef struct { guint accel_key; GdkModifierType accel_mods; guint accel_flags : 16; } GtkAccelKey;
gtk_accelerator_valid ()gboolean gtk_accelerator_valid (guint keyval, GdkModifierType modifiers); Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For example, the GDK_a keyval plus GDK_CONTROL_MASK is valid - this is a "Ctrl+a" accelerator. But, you can't, for instance, use the GDK_Control_L keyval as an accelerator.
gtk_accelerator_parse ()void gtk_accelerator_parse (const gchar *accelerator, guint *accelerator_key, GdkModifierType *accelerator_mods); Parses a string representing an accelerator. The format looks like "<Control>a" or "<Shift><Alt>F1" or "<Release>z" (the last one is for key release). The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>".
If the parse fails,
gtk_accelerator_name ()gchar* gtk_accelerator_name (guint accelerator_key, GdkModifierType accelerator_mods);
Converts an accelerator keyval and modifier mask
into a string parseable by
If you need to display accelerators in the user interface,
see
gtk_accelerator_get_label ()gchar* gtk_accelerator_get_label (guint accelerator_key, GdkModifierType accelerator_mods); Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.
Since 2.6 gtk_accelerator_set_default_mod_mask ()void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask); Sets the modifiers that will be considered significant for keyboard accelerators. The default mod mask is GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK, that is, Control, Shift, Alt, Super, Hyper and Meta. Other modifiers will by default be ignored by GtkAccelGroup. You must include at least the three modifiers Control, Shift and Alt in any value you pass to this function. The default mod mask should be changed on application startup, before using any accelerator groups.
gtk_accelerator_get_default_mod_mask ()guint gtk_accelerator_get_default_mod_mask (void);
Gets the value set by
Property DetailsThe
|
|
the GtkAccelGroup which received the signal |
|
the object on which the accelerator was activated |
|
the accelerator keyval |
|
the modifier combination of the accelerator |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the accelerator was activated
|
"accel-changed"
signalvoid user_function (GtkAccelGroup *accel_group, guint keyval, GdkModifierType modifier, GClosure *accel_closure, gpointer user_data) : Run First / Has Details
The accel-changed signal is emitted when a GtkAccelGroupEntry is added to or removed from the accel group.
Widgets like GtkAccelLabel which display an associated
accelerator should connect to this signal, and rebuild
their visual representation if the accel_closure
is theirs.
|
the GtkAccelGroup which received the signal |
|
the accelerator keyval |
|
the modifier combination of the accelerator |
|
the GClosure of the accelerator |
|
user data set when the signal handler was connected. |