Class: Gtk::ShortcutController

Inherits:
EventController show all
Defined in:
(unknown)

Instance Method Summary collapse

Methods inherited from EventController

#current_event, #current_event_device, #current_event_state, #current_event_time, #name, #name=, #propagation_limit, #propagation_limit=, #propagation_phase, #propagation_phase=, #reset, #static_name=, #widget, #widget=

Constructor Details

#initialize(model) ⇒ Gtk::EventController

Creates a new shortcut controller that takes its shortcuts from the given list model.

A controller created by this function does not let you add or remove individual shortcuts using the shortcut controller api, but you can change the contents of the model.

Parameters:

  • model (Gio::ListModel)

    a GListModel containing shortcuts

Instance Method Details

#add_shortcut(shortcut) ⇒ nil

Adds shortcut to the list of shortcuts handled by self.

If this controller uses an external shortcut list, this function does nothing.

Parameters:

Returns:

  • (nil)

#item_typeGLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Returns:

  • (GLib::Type)

    item-type

#item_type=(item_type) ⇒ GLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Parameters:

  • item_type (GLib::Type)

Returns:

  • (GLib::Type)

    item-type

  • (GLib::Type)

    item-type

#mnemonic_modifiersGdk::ModifierType

The modifiers that need to be pressed to allow mnemonics activation.

Returns:

#mnemonic_modifiers=(mnemonic_modifiers) ⇒ Gdk::ModifierType

The modifiers that need to be pressed to allow mnemonics activation.

Parameters:

Returns:

#mnemonics_modifiersGdk::ModifierType

Gets the mnemonics modifiers for when this controller activates its shortcuts.

Returns:

#mnemonics_modifiers=(modifiers) ⇒ nil

Sets the controller to use the given modifier for mnemonics.

The mnemonics modifiers determines which modifiers need to be pressed to allow activation of shortcuts with mnemonics triggers.

GTK normally uses the Alt modifier for mnemonics, except in GtkPopoverMenus, where mnemonics can be triggered without any modifiers. It should be very rarely necessary to change this, and doing so is likely to interfere with other shortcuts.

This value is only relevant for local shortcut controllers. Global and managed shortcut controllers will have their shortcuts activated from other places which have their own modifiers for activating mnemonics.

Parameters:

Returns:

  • (nil)

#model=(model) ⇒ Gio::ListModel

A list model to take shortcuts from.

Parameters:

  • model (Gio::ListModel)

Returns:

  • (Gio::ListModel)

    model

#n_itemsInteger

The number of items. See [methodGio.ListModel.get_n_items].

Returns:

  • (Integer)

    n-items

#n_items=(n_items) ⇒ Integer

The number of items. See [methodGio.ListModel.get_n_items].

Parameters:

  • n_items (Integer)

Returns:

  • (Integer)

    n-items

  • (Integer)

    n-items

#remove_shortcut(shortcut) ⇒ nil

Removes shortcut from the list of shortcuts handled by self.

If shortcut had not been added to controller or this controller uses an external shortcut list, this function does nothing.

Parameters:

Returns:

  • (nil)

#scopeGtk::ShortcutScope

What scope the shortcuts will be handled in.

Returns:

#scope=(scope) ⇒ Gtk::ShortcutScope

What scope the shortcuts will be handled in.

Parameters:

Returns: