ShortcutActionProtocol

public protocol ShortcutActionProtocol : ObjectProtocol

GtkShortcutAction encodes an action that can be triggered by a keyboard shortcut.

GtkShortcutActions contain functions that allow easy presentation to end users as well as being printed for debugging.

All GtkShortcutActions are immutable, you can only specify their properties during construction. If you want to change a action, you have to replace it with a new one. If you need to pass arguments to an action, these are specified by the higher-level GtkShortcut object.

To activate a GtkShortcutAction manually, [methodGtk.ShortcutAction.activate] can be called.

GTK provides various actions:

  • [classGtk.MnemonicAction]: a shortcut action that calls gtk_widget_mnemonic_activate()
  • [classGtk.CallbackAction]: a shortcut action that invokes a given callback
  • [classGtk.SignalAction]: a shortcut action that emits a given signal
  • [classGtk.ActivateAction]: a shortcut action that calls gtk_widget_activate()
  • [classGtk.NamedAction]: a shortcut action that calls gtk_widget_activate_action()
  • [classGtk.NothingAction]: a shortcut action that does nothing

The ShortcutActionProtocol protocol exposes the methods and properties of an underlying GtkShortcutAction instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see ShortcutAction. Alternatively, use ShortcutActionRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkShortcutAction instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • shortcut_action_ptr Default implementation

    Typed pointer to the underlying GtkShortcutAction instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkShortcutAction instance.

    Declaration

    Swift

    var shortcut_action_ptr: UnsafeMutablePointer<GtkShortcutAction>! { get }
  • Required Initialiser for types conforming to ShortcutActionProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

ShortcutAction Class: ShortcutActionProtocol extension (methods and fields)

  • activate(flags:widget:args:) Extension method

    Activates the action on the widget with the given args.

    Note that some actions ignore the passed in flags, widget or args.

    Activation of an action can fail for various reasons. If the action is not supported by the widget, if the args don’t match the action or if the activation otherwise had no effect, false will be returned.

    Declaration

    Swift

    @inlinable
    func activate<WidgetT>(flags: ShortcutActionFlags, widget: WidgetT, args: GLib.VariantRef? = nil) -> Bool where WidgetT : WidgetProtocol
  • activate(flags:widget:args:) Extension method

    Activates the action on the widget with the given args.

    Note that some actions ignore the passed in flags, widget or args.

    Activation of an action can fail for various reasons. If the action is not supported by the widget, if the args don’t match the action or if the activation otherwise had no effect, false will be returned.

    Declaration

    Swift

    @inlinable
    func activate<VariantT, WidgetT>(flags: ShortcutActionFlags, widget: WidgetT, args: VariantT?) -> Bool where VariantT : VariantProtocol, WidgetT : WidgetProtocol
  • print(string:) Extension method

    Prints the given action into a string for the developer.

    This is meant for debugging and logging.

    The form of the representation may change at any time and is not guaranteed to stay identical.

    Declaration

    Swift

    @inlinable
    func print<StringTypeT>(string: StringTypeT) where StringTypeT : StringProtocol
  • toString() Extension method

    Prints the given action into a human-readable string.

    This is a small wrapper around [methodGtk.ShortcutAction.print] to help when debugging.

    Declaration

    Swift

    @inlinable
    func toString() -> String!