Action
open class Action : GLibObject.Object, ActionProtocol
> In GTK+ 3.10, GtkAction has been deprecated. Use
GAction> instead, and associate actions withGtkActionablewidgets. Use >GMenuModelfor creating menus withgtk_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 Action type acts as a reference-counted owner of an underlying GtkAction instance.
It provides the methods that can operate on this data type through ActionProtocol conformance.
Use Action as a strong reference or owner of a GtkAction instance.
-
Designated initialiser from the underlying `C` data type.This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
Actioninstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkAction>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkAction>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkAction>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkAction>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkAction. i.e., ownership is transferred to theActioninstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkAction>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
ActionProtocolWill retainGtkAction.Declaration
Swift
@inlinable public init<T>(action other: T) where T : ActionProtocolParameters
otheran instance of a related type that implements
ActionProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)Parameters
praw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init(retainingRaw 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 public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ActionProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new
GtkActionobject. To add the action to aGtkActionGroupand set the accelerator for the action, callgtk_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 public init(name: UnsafePointer<gchar>!, label: UnsafePointer<gchar>? = nil, tooltip: UnsafePointer<gchar>? = nil, stockID: UnsafePointer<gchar>? = nil)
View on GitHub
Install in Dash
Action Class Reference