ActionableProtocol
public protocol ActionableProtocol : WidgetProtocol
The GtkActionable interface provides a convenient way of asscociating
widgets with actions.
It primarily consists of two properties: [propertyGtk.Actionable:action-name]
and [propertyGtk.Actionable:action-target]. There are also some convenience
APIs for setting these properties.
The action will be looked up in action groups that are found among
the widgets ancestors. Most commonly, these will be the actions with
the “win.” or “app.” prefix that are associated with the
GtkApplicationWindow or GtkApplication, but other action groups that
are added with [methodGtk.Widget.insert_action_group] will be consulted
as well.
The ActionableProtocol protocol exposes the methods and properties of an underlying GtkActionable 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 Actionable.
Alternatively, use ActionableRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkActionableinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
actionable_ptrDefault implementationTyped pointer to the underlying
GtkActionableinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkActionableinstance.Declaration
Swift
var actionable_ptr: UnsafeMutablePointer<GtkActionable>! { get } -
Required Initialiser for types conforming to
ActionableProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ActionablePropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ActionablePropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Actionable property
Declaration
Swift
@inlinable func get(property: ActionablePropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Actionable property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ActionablePropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getActionName()Extension methodGets the action name for
actionable.Declaration
Swift
@inlinable func getActionName() -> String! -
getActionTargetValue()Extension methodGets the current target value of
actionable.Declaration
Swift
@inlinable func getActionTargetValue() -> GLib.VariantRef! -
set(actionName:Extension method) Specifies the name of the action with which this widget should be associated.
If
action_nameisnilthen the widget will be unassociated from any previous action.Usually this function is used when the widget is located (or will be located) within the hierarchy of a
GtkApplicationWindow.Names are of the form “win.save” or “app.quit” for actions on the containing
GtkApplicationWindowor its associatedGtkApplication, respectively. This is the same form used for actions in theGMenuassociated with the window.Declaration
Swift
@inlinable func set(actionName: UnsafePointer<CChar>? = nil) -
setAction(targetValue:Extension method) Sets the target value of an actionable widget.
If
target_valueisnilthen the target value is unset.The target value has two purposes. First, it is used as the parameter to activation of the action associated with the
GtkActionablewidget. Second, it is used to determine if the widget should be rendered as “active” — the widget is active if the state is equal to the given target.Consider the example of associating a set of buttons with a
GActionwith string state in a typical “radio button” situation. Each button will be associated with the same action, but with a different target value for that action. Clicking on a particular button will activate the action with the target of that button, which will typically cause the action’s state to change to that value. Since the action’s state is now equal to the target value of the button, the button will now be rendered as active (and the other buttons, with different targets, rendered inactive).Declaration
Swift
@inlinable func setAction(targetValue: GLib.VariantRef? = nil) -
setAction(targetValue:Extension method) Sets the target value of an actionable widget.
If
target_valueisnilthen the target value is unset.The target value has two purposes. First, it is used as the parameter to activation of the action associated with the
GtkActionablewidget. Second, it is used to determine if the widget should be rendered as “active” — the widget is active if the state is equal to the given target.Consider the example of associating a set of buttons with a
GActionwith string state in a typical “radio button” situation. Each button will be associated with the same action, but with a different target value for that action. Clicking on a particular button will activate the action with the target of that button, which will typically cause the action’s state to change to that value. Since the action’s state is now equal to the target value of the button, the button will now be rendered as active (and the other buttons, with different targets, rendered inactive).Declaration
Swift
@inlinable func setAction<VariantT>(targetValue: VariantT?) where VariantT : VariantProtocol -
set(detailedActionName:Extension method) Sets the action-name and associated string target value of an actionable widget.
detailed_action_nameis a string in the format accepted byg_action_parse_detailed_name().Declaration
Swift
@inlinable func set(detailedActionName: UnsafePointer<CChar>!) -
actionNameExtension methodGets the action name for
actionable.Declaration
Swift
@inlinable var actionName: String! { get nonmutating set } -
actionTargetValueExtension methodGets the current target value of
actionable.Declaration
Swift
@inlinable var actionTargetValue: GLib.VariantRef! { get nonmutating set }
View on GitHub
Install in Dash
ActionableProtocol Protocol Reference