ShortcutActionProtocol
public protocol ShortcutActionProtocol : ObjectProtocol
GtkShortcutAction
encodes an action that can be triggered by a
keyboard shortcut.
GtkShortcutActions
contain functions that allow easy presentation
to end users as well as being printed for debugging.
All GtkShortcutActions
are immutable, you can only specify their
properties during construction. If you want to change a action, you
have to replace it with a new one. If you need to pass arguments to
an action, these are specified by the higher-level GtkShortcut
object.
To activate a GtkShortcutAction
manually, [methodGtk.ShortcutAction.activate
]
can be called.
GTK provides various actions:
- [class
Gtk.MnemonicAction
]: a shortcut action that callsgtk_widget_mnemonic_activate()
- [class
Gtk.CallbackAction
]: a shortcut action that invokes a given callback - [class
Gtk.SignalAction
]: a shortcut action that emits a given signal - [class
Gtk.ActivateAction
]: a shortcut action that callsgtk_widget_activate()
- [class
Gtk.NamedAction
]: a shortcut action that callsgtk_widget_activate_action()
- [class
Gtk.NothingAction
]: a shortcut action that does nothing
The ShortcutActionProtocol
protocol exposes the methods and properties of an underlying GtkShortcutAction
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 ShortcutAction
.
Alternatively, use ShortcutActionRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkShortcutAction
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
shortcut_action_ptr
Default implementationTyped pointer to the underlying
GtkShortcutAction
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkShortcutAction
instance.Declaration
Swift
var shortcut_action_ptr: UnsafeMutablePointer<GtkShortcutAction>! { get }
-
Required Initialiser for types conforming to
ShortcutActionProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
activate(flags:
Extension methodwidget: args: ) Activates the action on the
widget
with the givenargs
.Note that some actions ignore the passed in
flags
,widget
orargs
.Activation of an action can fail for various reasons. If the action is not supported by the
widget
, if theargs
don’t match the action or if the activation otherwise had no effect,false
will be returned.Declaration
Swift
@inlinable func activate<WidgetT>(flags: ShortcutActionFlags, widget: WidgetT, args: GLib.VariantRef? = nil) -> Bool where WidgetT : WidgetProtocol
-
activate(flags:
Extension methodwidget: args: ) Activates the action on the
widget
with the givenargs
.Note that some actions ignore the passed in
flags
,widget
orargs
.Activation of an action can fail for various reasons. If the action is not supported by the
widget
, if theargs
don’t match the action or if the activation otherwise had no effect,false
will be returned.Declaration
Swift
@inlinable func activate<VariantT, WidgetT>(flags: ShortcutActionFlags, widget: WidgetT, args: VariantT?) -> Bool where VariantT : VariantProtocol, WidgetT : WidgetProtocol
-
print(string:
Extension method) Prints the given action into a string for the developer.
This is meant for debugging and logging.
The form of the representation may change at any time and is not guaranteed to stay identical.
Declaration
Swift
@inlinable func print<StringTypeT>(string: StringTypeT) where StringTypeT : StringProtocol
-
toString()
Extension methodPrints the given action into a human-readable string.
This is a small wrapper around [method
Gtk.ShortcutAction.print
] to help when debugging.Declaration
Swift
@inlinable func toString() -> String!