Gnome::Gtk4::Shortcut
Description
A Gnome::Gtk4::Shortcut describes a keyboard shortcut.
It contains a description of how to trigger the shortcut via a Gnome::Gtk4::ShortcutTrigger and a way to activate the shortcut on a widget via a Gnome::Gtk4::ShortcutAction.
The actual work is usually done via Gnome::Gtk4::ShortcutController, which decides if and when to activate a shortcut. Using that controller directly however is rarely necessary as various higher level convenience APIs exist on Gnome::Gtk4::Widgets that make it easier to use shortcuts in GTK.
Gnome::Gtk4::Shortcut does provide functionality to make it easy for users to work with shortcuts, either by providing informational strings for display purposes or by allowing shortcuts to be configured.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-shortcut
Creates a new Gnome::Gtk4::Shortcut that is triggered by $trigger
and then activates $action
.
method new-shortcut ( N-Object() $trigger, N-Object() $action --> Gnome::Gtk4::Shortcut \)
$trigger; (transfer ownership: full) The trigger that will trigger the shortcut.
$action; (transfer ownership: full) The action that will be activated upon triggering.
new-with-arguments This function is not yet available
Creates a new Gnome::Gtk4::Shortcut that is triggered by $trigger
and then activates $action
with arguments given by $format-string
.
method new-with-arguments ( N-Object() $trigger, N-Object() $action, Str $format-string, … --> Gnome::Gtk4::Shortcut \)
$trigger; (transfer ownership: full) The trigger that will trigger the shortcut.
$action; (transfer ownership: full) The action that will be activated upon triggering.
$format-string; GVariant format string for arguments or undefined for no arguments.
…; …. Note that each argument must be specified as a type followed by its value!
Methods
get-action
Gets the action that is activated by this shortcut.
method get-action (--> N-Object )
Return value; the action.
get-arguments
Gets the arguments that are passed when activating the shortcut.
method get-arguments (--> N-Object )
Return value; the arguments.
get-trigger
Gets the trigger used to trigger $self
.
method get-trigger (--> N-Object )
Return value; the trigger used.
set-action
Sets the new action for $self
to be $action
.
method set-action ( N-Object() $action )
$action; (transfer ownership: full) The new action. If the
$action
is undefined, the nothing action will be used..
set-arguments
Sets the arguments to pass when activating the shortcut.
method set-arguments ( N-Object $args )
$args; arguments to pass when activating
$self
set-trigger
Sets the new trigger for $self
to be $trigger
.
method set-trigger ( N-Object() $trigger )
$trigger; (transfer ownership: full) The new trigger. If the
$trigger
is undefined, the never trigger will be used..