Package: gtk

Class gtk:shortcut-controller

Superclasses

gtk:event-controller, gtk:buildable, gio:list-model, gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

item-type
The item-type property of type g:type-t (Read)
The type of items. Since 4.8
mnemonic-modifiers
The mnemonic-modifiers property of type gdk:modifier-type (Read / Write)
The modifiers that need to be pressed to allow mnemonics activation.
Default value: :alt-mask
model
The model property of type g:list-model (Write / Construct Only)
The list model to take shortcuts from.
n-items
The n-items property of type :uint (Read)
The number of items in the list model. Since 4.8
Default value: 0
scope
The scope property of type gtk:shortcut-scope (Read / Write)
What scope the shortcuts will be handled in.
Default value: :local

Details

The gtk:shortcut-controller class is an event controller that manages shortcuts. Most common shortcuts are using this controller implicitly, for example, by adding a mnemonic underline to a gtk:label widget, or by installing a key binding using the gtk:widget-class-add-binding function, or by adding accelerators to global actions using the gtk:application-accels-for-action function. But it is possible to create your own shortcut controller, and add shortcuts to it.

The gtk:shortcut-controller class implements the g:list-model interface for querying the shortcuts that have been added to it.

GtkShortcutController as a GtkBuildable
The gtk:shortcut-controller object can be created in UI files to set up shortcuts in the same place as the widgets. An example of a UI definition fragment with a gtk:shortcut-controller object:
<object class='GtkButton'>
  <child>
    <object class='GtkShortcutController'>
      <property name='scope'>managed</property>
      <child>
        <object class='GtkShortcut'>
          <property name='trigger'>&lt;Control&gt;k</property>
          <property name='action'>activate</property>
        </object>
      </child>
    </object>
  </child>
</object>  
This example creates a gtk:activate-action object for triggering the activate signal of the gtk:button widget. See the gtk:shortcut-action-parse-string function for the syntax for other kinds of gtk:shortcut-action objects. See the gtk:shortcut-trigger-parse-string function to learn more about the syntax for triggers.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2023-7-23