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
GtkActionable
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
actionable_ptr
Default implementationTyped pointer to the underlying
GtkActionable
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkActionable
instance.Declaration
Swift
var actionable_ptr: UnsafeMutablePointer<GtkActionable>! { get }
-
Required Initialiser for types conforming to
ActionableProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ActionablePropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Actionable property
Declaration
Swift
@inlinable func get(property: ActionablePropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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_name
isnil
then 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
GtkApplicationWindow
or its associatedGtkApplication
, respectively. This is the same form used for actions in theGMenu
associated 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_value
isnil
then 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
GtkActionable
widget. 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
GAction
with 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_value
isnil
then 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
GtkActionable
widget. 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
GAction
with 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_name
is a string in the format accepted byg_action_parse_detailed_name()
.Declaration
Swift
@inlinable func set(detailedActionName: UnsafePointer<CChar>!)
-
actionName
Extension methodGets the action name for
actionable
.Declaration
Swift
@inlinable var actionName: String! { get nonmutating set }
-
actionTargetValue
Extension methodGets the current target value of
actionable
.Declaration
Swift
@inlinable var actionTargetValue: GLib.VariantRef! { get nonmutating set }