Class: Gtk::AccelGroup

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#activate(accel_quark, acceleratable, accel_key, accel_mods) ⇒ TrueClass

Finds the first accelerator in accel_group that matches accel_key and accel_mods, and activates it.

Parameters:

  • accel_quark (GLib::Quark)

    the quark for the accelerator name

  • acceleratable (GObject::Object)

    the #GObject, usually a Gtk::Window, on which to activate the accelerator

  • accel_key (Integer)

    accelerator keyval from a key event

  • accel_mods (Gdk::ModifierType)

    keyboard state mask from a key event

Returns:

  • (TrueClass)

    true if an accelerator was activated and handled this keypress

#connect(accel_key, accel_mods, accel_flags, closure) ⇒ nil

Installs an accelerator in this group. When accel_group is being activated in response to a call to gtk_accel_groups_activate(), closure will be invoked if the accel_key and accel_mods from gtk_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.

Parameters:

  • accel_key (Integer)

    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

Returns:

  • (nil)

#connect_by_path(accel_path, closure) ⇒ nil

Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see gtk_accel_map_add_entry()). When accel_group is being activated in response to a call to gtk_accel_groups_activate(), closure will be invoked if the accel_key and accel_mods from gtk_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 g_intern_static_string().

Parameters:

  • accel_path (String)

    path used for determining key and modifiers

  • closure (GObject::Closure)

    closure to be executed upon accelerator activation

Returns:

  • (nil)

#disconnect(closure) ⇒ TrueClass

Removes an accelerator previously installed through gtk_accel_group_connect().

Since 2.20 closure can be nil.

Parameters:

  • closure (GObject::Closure)

    the closure to remove from this accelerator group, or nil to remove all closures

Returns:

  • (TrueClass)

    true if the closure was found and got disconnected

#disconnect_key(accel_key, accel_mods) ⇒ TrueClass

Removes an accelerator previously installed through gtk_accel_group_connect().

Parameters:

  • accel_key (Integer)

    key value of the accelerator

  • accel_mods (Gdk::ModifierType)

    modifier combination of the accelerator

Returns:

  • (TrueClass)

    true if there was an accelerator which could be removed, false otherwise

#find(find_func, data) ⇒ Gtk::AccelKey

Finds the first entry in an accelerator group for which find_func returns true and returns its Gtk::AccelKey.

Parameters:

  • find_func (Gtk::AccelGroupFindFunc)

    a function to filter the entries of accel_group with

  • data (GObject)

    data to pass to find_func

Returns:

  • (Gtk::AccelKey)

    the key of the first entry passing find_func. The key is owned by GTK+ and must not be freed.

#is_lockedTrueClass

Locks are added and removed using gtk_accel_group_lock() and gtk_accel_group_unlock().

Returns:

  • (TrueClass)

    true if there are 1 or more locks on the accel_group, false otherwise.

#is_locked=(is_locked) ⇒ TrueClass

Parameters:

  • is_locked (TrueClass)

Returns:

  • (TrueClass)

    is-locked

  • (TrueClass)

    is-locked

#is_locked?TrueClass

Returns is-locked.

Returns:

  • (TrueClass)

    is-locked

#locknil

Locks the given accelerator group.

Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to gtk_accel_map_change_entry() about runtime accelerator changes.

If called more than once, accel_group remains locked until gtk_accel_group_unlock() has been called an equivalent number of times.

Returns:

  • (nil)

#modifier_maskGdk::ModifierType

Returns modifier-mask.

Returns:

#modifier_mask=(modifier_mask) ⇒ Gdk::ModifierType

Parameters:

Returns:

#newGtk::AccelGroup

Creates a new Gtk::AccelGroup.

Returns:

#query(accel_key, accel_mods, n_entries) ⇒ Array<Gtk::AccelGroupEntry>

Queries an accelerator group for all entries matching accel_key and accel_mods.

Parameters:

  • accel_key (Integer)

    key value of the accelerator

  • accel_mods (Gdk::ModifierType)

    modifier combination of the accelerator

  • n_entries (Integer)

    location to return the number of entries found, or nil

Returns:

  • (Array<Gtk::AccelGroupEntry>)

    an array of n_entries Gtk::AccelGroupEntry elements, or nil. The array is owned by GTK+ and must not be freed.

#unlocknil

Undoes the last call to gtk_accel_group_lock() on this accel_group.

Returns:

  • (nil)