Class Shortcut

All Implemented Interfaces:
PointerInterface

public class Shortcut extends Object
A `GtkShortcut` describes a keyboard shortcut.

It contains a description of how to trigger the shortcut via a
[class@Gtk.ShortcutTrigger] and a way to activate the shortcut
on a widget via a [class@Gtk.ShortcutAction].

The actual work is usually done via [class@Gtk.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 `GtkWidget`s that make it easier to use
shortcuts in GTK.

`GtkShortcut` 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.

https://docs.gtk.org/gtk4/class.Shortcut.html

  • Constructor Details

    • Shortcut

      public Shortcut(PointerContainer pointer)
    • Shortcut

      public Shortcut(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action)
      Creates a new `GtkShortcut` that is triggered by
      @trigger and then activates @action.
      Parameters:
      trigger - The trigger that will trigger the shortcut
      action - The action that will be activated upon triggering
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newWithArgumentsShortcut

      public static Shortcut newWithArgumentsShortcut(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action, @Nullable Str format_string, Object... _elipse)
      Creates a new `GtkShortcut` that is triggered by @trigger and then activates
      @action with arguments given by @format_string.
      Parameters:
      trigger - The trigger that will trigger the shortcut
      action - The action that will be activated upon triggering
      format_string - GVariant format string for arguments or %NULL for no arguments
      _elipse - arguments, as given by format string.
      Returns:
      a new `GtkShortcut`
    • newWithArgumentsShortcut

      public static Shortcut newWithArgumentsShortcut(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action, String format_string, Object... _elipse)
      Creates a new `GtkShortcut` that is triggered by @trigger and then activates
      @action with arguments given by @format_string.
      Parameters:
      trigger - The trigger that will trigger the shortcut
      action - The action that will be activated upon triggering
      format_string - GVariant format string for arguments or %NULL for no arguments
      _elipse - arguments, as given by format string.
      Returns:
      a new `GtkShortcut`
    • getAction

      public ShortcutAction getAction()
      Gets the action that is activated by this shortcut.
      Returns:
      the action
    • getArguments

      public Variant getArguments()
      Gets the arguments that are passed when activating the shortcut.
      Returns:
      the arguments
    • getTrigger

      public ShortcutTrigger getTrigger()
      Gets the trigger used to trigger @self.
      Returns:
      the trigger used
    • setAction

      public void setAction(@Nullable ShortcutAction action)
      Sets the new action for @self to be @action.
      Parameters:
      action - The new action. If the @action is %NULL, the nothing action will be used.
    • setArguments

      public void setArguments(@Nullable Variant args)
      Sets the arguments to pass when activating the shortcut.
      Parameters:
      args - arguments to pass when activating @self
    • setTrigger

      public void setTrigger(@Nullable ShortcutTrigger trigger)
      Sets the new trigger for @self to be @trigger.
      Parameters:
      trigger - The new trigger. If the @trigger is %NULL, the never trigger will be used.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()