ShortcutActionRef

public struct ShortcutActionRef : ShortcutActionProtocol, GWeakCapturing

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 ShortcutActionRef type acts as a lightweight Swift reference to an underlying GtkShortcutAction instance. It exposes methods that can operate on this data type through ShortcutActionProtocol conformance. Use ShortcutActionRef only as an unowned reference to an existing GtkShortcutAction instance.

  • ptr
    Untyped pointer to the underlying `GtkShortcutAction` instance.
    

    For type-safe access, use the generated, typed pointer shortcut_action_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

ShortcutAction Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkShortcutAction>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkShortcutAction>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkShortcutAction>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkShortcutAction>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements ShortcutActionProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : ShortcutActionProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> ShortcutActionRef where T : ShortcutActionProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ShortcutActionProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ShortcutActionProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ShortcutActionProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ShortcutActionProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ShortcutActionProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Tries to parse the given string into an action.
    

    On success, the parsed action is returned. When parsing failed, nil is returned.

    The accepted strings are:

    • nothing, for GtkNothingAction
    • activate, for GtkActivateAction
    • mnemonic-activate, for GtkMnemonicAction
    • action(NAME), for a GtkNamedAction for the action named NAME
    • signal(NAME), for a GtkSignalAction for the signal NAME

    Declaration

    Swift

    @inlinable
    init(string: UnsafePointer<CChar>!)
  • Tries to parse the given string into an action.

    On success, the parsed action is returned. When parsing failed, nil is returned.

    The accepted strings are:

    • nothing, for GtkNothingAction
    • activate, for GtkActivateAction
    • mnemonic-activate, for GtkMnemonicAction
    • action(NAME), for a GtkNamedAction for the action named NAME
    • signal(NAME), for a GtkSignalAction for the signal NAME

    Declaration

    Swift

    @inlinable
    static func parse(string: UnsafePointer<CChar>!) -> ShortcutActionRef!