ShortcutRef

public struct ShortcutRef : ShortcutProtocol, GWeakCapturing

A GtkShortcut describes a keyboard shortcut.

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

The actual work is usually done via [classGtk.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 GtkWidgets 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.

The ShortcutRef type acts as a lightweight Swift reference to an underlying GtkShortcut instance. It exposes methods that can operate on this data type through ShortcutProtocol conformance. Use ShortcutRef only as an unowned reference to an existing GtkShortcut instance.

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

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

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Shortcut Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkShortcut>?)
  • 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 ShortcutProtocol

    Declaration

    Swift

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

    Declaration

    Swift

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

    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 ShortcutProtocol.

    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 ShortcutProtocol.

    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 ShortcutProtocol.

    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 ShortcutProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new `GtkShortcut` that is triggered by
    

    trigger and then activates action.

    Declaration

    Swift

    @inlinable
    init<ShortcutActionT, ShortcutTriggerT>(trigger: ShortcutTriggerT?, action: ShortcutActionT?) where ShortcutActionT : ShortcutActionProtocol, ShortcutTriggerT : ShortcutTriggerProtocol