ActionableProtocol

public protocol ActionableProtocol : WidgetProtocol

This interface provides a convenient way of associating widgets with actions on a GtkApplicationWindow or GtkApplication.

It primarily consists of two properties: GtkActionable:action-name and GtkActionable: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 gtk_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.

  • ptr

    Untyped pointer to the underlying GtkActionable instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • actionable_ptr Default implementation

    Typed 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)

Actionable Interface

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

Actionable Interface: ActionableProtocol extension (methods and fields)

  • getActionName() Extension method

    Gets the action name for actionable.

    See gtk_actionable_set_action_name() for more information.

    Declaration

    Swift

    @inlinable
    func getActionName() -> String!
  • getActionTargetValue() Extension method

    Gets the current target value of actionable.

    See gtk_actionable_set_action_target_value() for more information.

    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 is nil 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 associated GtkApplication, respectively. This is the same form used for actions in the GMenu associated with the window.

    Declaration

    Swift

    @inlinable
    func set(actionName: UnsafePointer<gchar>? = nil)
  • setAction(targetValue:) Extension method

    Sets the target value of an actionable widget.

    If target_value is nil 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 is nil 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 by g_action_parse_detailed_name().

    (Note that prior to version 3.22.25, this function is only usable for actions with a simple “s” target, and detailed_action_name must be of the form "actiontarget" where action is the action name and target is the string to use as the target.)

    Declaration

    Swift

    @inlinable
    func set(detailedActionName: UnsafePointer<gchar>!)
  • actionName Extension method

    Gets the action name for actionable.

    See gtk_actionable_set_action_name() for more information.

    Declaration

    Swift

    @inlinable
    var actionName: String! { get nonmutating set }
  • actionTargetValue Extension method

    Gets the current target value of actionable.

    See gtk_actionable_set_action_target_value() for more information.

    Declaration

    Swift

    @inlinable
    var actionTargetValue: GLib.VariantRef! { get nonmutating set }