ActionRef

public struct ActionRef : ActionProtocol, GWeakCapturing

> In GTK+ 3.10, GtkAction has been deprecated. Use GAction > instead, and associate actions with GtkActionable widgets. Use > GMenuModel for creating menus with gtk_menu_new_from_model().

Actions represent operations that the user can be perform, along with some information how it should be presented in the interface. Each action provides methods to create icons, menu items and toolbar items representing itself.

As well as the callback that is called when the action gets activated, the following also gets associated with the action:

  • a name (not translated, for path lookup)

  • a label (translated, for display)

  • an accelerator

  • whether label indicates a stock id

  • a tooltip (optional, translated)

  • a toolbar label (optional, shorter than label)

The action will also have some state information:

  • visible (shown/hidden)

  • sensitive (enabled/disabled)

Apart from regular actions, there are toggle actions, which can be toggled between two states and radio actions, of which only one in a group can be in the “active” state. Other actions can be implemented as GtkAction subclasses.

Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement GtkActivatable interface. Proxies mirror the state of the action and should change when the action’s state changes. Properties that are always mirrored by proxies are GtkAction:sensitive and GtkAction:visible. GtkAction:gicon, GtkAction:icon-name, GtkAction:label, GtkAction:short-label and GtkAction:stock-id properties are only mirorred if proxy widget has GtkActivatable:use-action-appearance property set to true.

When the proxy is activated, it should activate its action.

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

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

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

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Action Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

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

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

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

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

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new `GtkAction` object. To add the action to a
    

    GtkActionGroup and set the accelerator for the action, call gtk_action_group_add_action_with_accel(). See the UI Definition section for information on allowed action names.

    new is deprecated: Use #GAction instead, associating it to a widget with

    GtkActionable or creating a #GtkMenu with gtk_menu_new_from_model()

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    init(name: UnsafePointer<gchar>!, label: UnsafePointer<gchar>? = nil, tooltip: UnsafePointer<gchar>? = nil, stockID: UnsafePointer<gchar>? = nil)