Gtk.AccelGroup - Classes - Gtk 3.0 (original) (raw)
g GObject.Object GObject.Object Gtk.AccelGroup Gtk.AccelGroup GObject.Object->Gtk.AccelGroup
Subclasses:
None
Methods¶
Inherited:
Structs:
class | from_accel_closure (closure) |
---|---|
class | new () |
activate (accel_quark, acceleratable, accel_key, accel_mods) | |
connect (accel_key, accel_mods, accel_flags, closure) | |
connect_by_path (accel_path, closure) | |
disconnect (closure) | |
disconnect_key (accel_key, accel_mods) | |
find (find_func, *data) | |
get_is_locked () | |
get_modifier_mask () | |
lock () | |
query (accel_key, accel_mods) | |
unlock () |
Virtual Methods¶
Inherited:
do_accel_changed (keyval, modifier, accel_closure) |
---|
Properties¶
Name | Type | Flags | Short Description |
---|---|---|---|
is-locked | bool | r | Is the accel group locked |
modifier-mask | Gdk.ModifierType | r | Modifier Mask |
Signals¶
Inherited:
Name | Short Description |
---|---|
accel-activate | The accel-activate signal is an implementation detail of Gtk.AccelGroup and not meant to be used by applications. |
accel-changed | The accel-changed signal is emitted when an entry is added to or removed from the accel group. |
Fields¶
Inherited:
Name | Type | Access | Description |
---|---|---|---|
parent | GObject.Object | r |
Class Details¶
class Gtk.AccelGroup(**kwargs)¶
Bases:
Abstract:
No
Structure:
A Gtk.AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Gtk.Window (withGtk.Window.add_accel_group()). Usually you won’t need to create aGtk.AccelGroup directly; instead, when using Gtk.UIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager’s Gtk.AccelGroup.
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. SeeGtk.Label.new_with_mnemonic(). Menu items can have both accelerators and mnemonics, of course.
classmethod from_accel_closure(closure)[source]¶
Parameters:
closure (GObject.Closure) – a GObject.Closure
Returns:
the Gtk.AccelGroup to which closureis connected, or None
Return type:
Finds the Gtk.AccelGroup to which closure is connected; see Gtk.AccelGroup.connect().
Returns:
a new Gtk.AccelGroup object
Return type:
Creates a new Gtk.AccelGroup.
activate(accel_quark, acceleratable, accel_key, accel_mods)[source]¶
Parameters:
- accel_quark (int) – the quark for the accelerator name
- acceleratable (GObject.Object) – the GObject.Object, usually a Gtk.Window, on which to activate the accelerator
- accel_key (int) – accelerator keyval from a key event
- accel_mods (Gdk.ModifierType) – keyboard state mask from a key event
Returns:
True if an accelerator was activated and handled this keypress
Return type:
Finds the first accelerator in self that matchesaccel_key and accel_mods, and activates it.
connect(accel_key, accel_mods, accel_flags, closure)[source]¶
Parameters:
- accel_key (int) – key value of the accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
- accel_flags (Gtk.AccelFlags) – a flag mask to configure this accelerator
- closure (GObject.Closure) – closure to be executed upon accelerator activation
Installs an accelerator in this group. When self is being activated in response to a call to Gtk.accel_groups_activate(),closure will be invoked if the accel_key and accel_mods fromGtk.accel_groups_activate() match those of this connection.
The signature used for the closure is that of Gtk.AccelGroupActivate.
Note that, due to implementation details, a single closure can only be connected to one accelerator group.
connect_by_path(accel_path, closure)[source]¶
Parameters:
- accel_path (str) – path used for determining key and modifiers
- closure (GObject.Closure) – closure to be executed upon accelerator activation
Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (seeGtk.AccelMap.add_entry()). When self is being activated in response to a call to Gtk.accel_groups_activate(), closure will be invoked if the accel_key and accel_mods fromGtk.accel_groups_activate() match the key and modifiers for the path.
The signature used for the closure is that of Gtk.AccelGroupActivate.
Note that accel_path string will be stored in a #GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with GLib.intern_static_string().
Parameters:
closure (GObject.Closure or None) – the closure to remove from this accelerator group, or None to remove all closures
Returns:
True if the closure was found and got disconnected
Return type:
Removes an accelerator previously installed throughGtk.AccelGroup.connect().
Since 2.20 closure can be None.
disconnect_key(accel_key, accel_mods)[source]¶
Parameters:
- accel_key (int) – key value of the accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
Returns:
True if there was an accelerator which could be removed, False otherwise
Return type:
Removes an accelerator previously installed throughGtk.AccelGroup.connect().
find(find_func, *data)[source]¶
Parameters:
- find_func (Gtk.AccelGroupFindFunc) – a function to filter the entries of self with
- data (object or None) – data to pass to find_func
Returns:
the key of the first entry passingfind_func. The key is owned by GTK+ and must not be freed.
Return type:
Finds the first entry in an accelerator group for whichfind_func returns True and returns its Gtk.AccelKey.
Returns:
True if there are 1 or more locks on the self,False otherwise.
Return type:
Locks are added and removed using Gtk.AccelGroup.lock() andGtk.AccelGroup.unlock().
New in version 2.14.
Returns:
the modifier mask for this accel group.
Return type:
Gets a Gdk.ModifierType representing the mask for thisself. For example, Gdk.ModifierType.CONTROL_MASK, Gdk.ModifierType.SHIFT_MASK, etc.
New in version 2.14.
Locks the given accelerator group.
Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer toGtk.AccelMap.change_entry() about runtime accelerator changes.
If called more than once, self remains locked untilGtk.AccelGroup.unlock() has been called an equivalent number of times.
query(accel_key, accel_mods)[source]¶
Parameters:
- accel_key (int) – key value of the accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
Returns:
an array ofn_entries Gtk.AccelGroupEntry elements, or None. The array is owned by GTK+ and must not be freed.
Return type:
[Gtk.AccelGroupEntry] or None
Queries an accelerator group for all entries matching accel_keyand accel_mods.
Undoes the last call to Gtk.AccelGroup.lock() on this self.
do_accel_changed(keyval, modifier, accel_closure) virtual¶
Parameters:
- keyval (int) –
- modifier (Gdk.ModifierType) –
- accel_closure (GObject.Closure) –
Signal emitted when an entry is added to or removed from the accel group.
Signal Details¶
Gtk.AccelGroup.signals.accel_activate(accel_group, acceleratable, keyval, modifier)¶
Signal Name:
accel-activate
Flags:
Parameters:
- accel_group (Gtk.AccelGroup) – The object which received the signal
- acceleratable (GObject.Object) – the object on which the accelerator was activated
- keyval (int) – the accelerator keyval
- modifier (Gdk.ModifierType) – the modifier combination of the accelerator
Returns:
True if the accelerator was activated
Return type:
The accel-activate signal is an implementation detail ofGtk.AccelGroup and not meant to be used by applications.
Gtk.AccelGroup.signals.accel_changed(accel_group, keyval, modifier, accel_closure)¶
Signal Name:
accel-changed
Flags:
Parameters:
- accel_group (Gtk.AccelGroup) – The object which received the signal
- keyval (int) – the accelerator keyval
- modifier (Gdk.ModifierType) – the modifier combination of the accelerator
- accel_closure (GObject.Closure) – the GObject.Closure of the accelerator
The accel-changed signal is emitted when an entry is added to or removed from the accel group.
Widgets like Gtk.AccelLabel which display an associated accelerator should connect to this signal, and rebuild their visual representation if the accel_closure is theirs.
Property Details¶
Gtk.AccelGroup.props.is_locked¶
Name:
is-locked
Type:
Default Value:
Flags:
Is the accel group locked
Gtk.AccelGroup.props.modifier_mask¶
Name:
modifier-mask
Type:
Default Value:
Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK | Gdk.ModifierType.SUPER_MASK | Gdk.ModifierType.HYPER_MASK | Gdk.ModifierType.META_MASK | Gdk.ModifierType.MODIFIER_MASK
Flags:
Modifier Mask