ShortcutController


Object Hierarchy:

Gtk.ShortcutController Gtk.ShortcutController Gtk.ShortcutController Gtk.EventController Gtk.EventController Gtk.EventController->Gtk.ShortcutController GLib.Object GLib.Object GLib.Object->Gtk.EventController GLib.ListModel GLib.ListModel GLib.ListModel->Gtk.ShortcutController Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.ShortcutController

Description:

[ CCode ( type_id = "gtk_shortcut_controller_get_type ()" ) ]
public class ShortcutController : EventController, ListModel, Buildable

`GtkShortcutController` is an event controller that manages shortcuts.

Most common shortcuts are using this controller implicitly, e.g. by adding a mnemonic underline to a `GtkLabel`, or by installing a key binding using [[email protected]_binding], or by adding accelerators to global actions using [ [email protected]_accels_for_action].

But it is possible to create your own shortcut controller, and add shortcuts to it.

`GtkShortcutController` implements `GListModel` for querying the shortcuts that have been added to it.

GtkShortcutController as a GtkBuildable

`GtkShortcutControllers` can be creates in ui files to set up shortcuts in the same place as the widgets.

An example of a UI definition fragment with `GtkShortcutController`: ```xml <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 [[email protected]] for triggering the `activate` signal of the `GtkButton`. See [ [email protected]_string] for the syntax for other kinds of `GtkShortcutAction`. See [[email protected]_string] to learn more about the syntax for triggers.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class GLib.Object
All known members inherited from interface GLib.ListModel



2022 vala-language.org