ActionGroupProtocol
public protocol ActionGroupProtocol : ObjectProtocol, BuildableProtocol
Actions are organised into groups. An action group is essentially a
map from names to GtkAction objects.
All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window’s menus would be constructed from a combination of two action groups.
Accelerators ##
Accelerators are handled by the GTK+ accelerator map. All actions are
assigned an accelerator path (which normally has the form
<Actions>/group-name/action-name) and a shortcut is associated with
this accelerator path. All menuitems and toolitems take on this accelerator
path. The GTK+ accelerator map code makes sure that the correct shortcut
is displayed next to the menu item.
GtkActionGroup as GtkBuildable #
The GtkActionGroup implementation of the GtkBuildable interface accepts
GtkAction objects as <child> elements in UI definitions.
Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do.
The GtkActionGroup implementation of the GtkBuildable interface supports
a custom <accelerator> element, which has attributes named “key“ and
“modifiers“ and allows to specify accelerators. This is similar to the
<accelerator> element of GtkWidget, the main difference is that
it doesn’t allow you to specify a signal.
A GtkDialog UI definition fragment.
<object class="GtkActionGroup" id="actiongroup">
<child>
<object class="GtkAction" id="About">
<property name="name">About</property>
<property name="stock_id">gtk-about</property>
<signal handler="about_activate" name="activate"/>
</object>
<accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
</child>
</object>
The ActionGroupProtocol protocol exposes the methods and properties of an underlying GtkActionGroup 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 ActionGroup.
Alternatively, use ActionGroupRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkActionGroupinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
action_group_ptrDefault implementationTyped pointer to the underlying
GtkActionGroupinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkActionGroupinstance.Declaration
Swift
var action_group_ptr: UnsafeMutablePointer<GtkActionGroup>! { get } -
Required Initialiser for types conforming to
ActionGroupProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer) -
gActionGroupPointerExtension methodTyped pointer to the underlying
GActionGroupinstance.Declaration
Swift
@inlinable var gActionGroupPointer: UnsafeMutablePointer<GActionGroup>! { get }
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ActionGroupPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ActionGroupPropertyName, 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 ActionGroup property
Declaration
Swift
@inlinable func get(property: ActionGroupPropertyName) -> 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 ActionGroup property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ActionGroupPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
ActionGroupSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ActionGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
ActionGroupSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ActionGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onConnectProxy(flags:Extension methodhandler: ) The
connect-proxysignal is emitted after connecting a proxy to an action in the group. Note that the proxy may have been connected to a different action before.This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar.
GtkUIManagerproxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.Note
This represents the underlyingconnect-proxysignalDeclaration
Swift
@discardableResult @inlinable func onConnectProxy(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ action: ActionRef, _ proxy: WidgetRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
actionthe action
proxythe proxy
handlerThe signal handler to call Run the given callback whenever the
connectProxysignal is emitted -
connectProxySignalExtension methodTyped
connect-proxysignal for using theconnect(signal:)methodsDeclaration
Swift
static var connectProxySignal: ActionGroupSignalName { get } -
onDisconnectProxy(flags:Extension methodhandler: ) The
disconnect-proxysignal is emitted after disconnecting a proxy from an action in the group.GtkUIManagerproxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.Note
This represents the underlyingdisconnect-proxysignalDeclaration
Swift
@discardableResult @inlinable func onDisconnectProxy(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ action: ActionRef, _ proxy: WidgetRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
actionthe action
proxythe proxy
handlerThe signal handler to call Run the given callback whenever the
disconnectProxysignal is emitted -
disconnectProxySignalExtension methodTyped
disconnect-proxysignal for using theconnect(signal:)methodsDeclaration
Swift
static var disconnectProxySignal: ActionGroupSignalName { get } -
onPostActivate(flags:Extension methodhandler: ) The
post-activatesignal is emitted just after theactionin theaction_groupis activatedThis is intended for
GtkUIManagerto proxy the signal and provide global notification just after any action is activated.Note
This represents the underlyingpost-activatesignalDeclaration
Swift
@discardableResult @inlinable func onPostActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ action: ActionRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
actionthe action
handlerThe signal handler to call Run the given callback whenever the
postActivatesignal is emitted -
postActivateSignalExtension methodTyped
post-activatesignal for using theconnect(signal:)methodsDeclaration
Swift
static var postActivateSignal: ActionGroupSignalName { get } -
onPreActivate(flags:Extension methodhandler: ) The
pre-activatesignal is emitted just before theactionin theaction_groupis activatedThis is intended for
GtkUIManagerto proxy the signal and provide global notification just before any action is activated.Note
This represents the underlyingpre-activatesignalDeclaration
Swift
@discardableResult @inlinable func onPreActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ action: ActionRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
actionthe action
handlerThe signal handler to call Run the given callback whenever the
preActivatesignal is emitted -
preActivateSignalExtension methodTyped
pre-activatesignal for using theconnect(signal:)methodsDeclaration
Swift
static var preActivateSignal: ActionGroupSignalName { get } -
onNotifyAccelGroup(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::accel-groupsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyAccelGroup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyAccelGroupsignal is emitted -
notifyAccelGroupSignalExtension methodTyped
notify::accel-groupsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyAccelGroupSignal: ActionGroupSignalName { get } -
onNotifyName(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::namesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyNamesignal is emitted -
notifyNameSignalExtension methodTyped
notify::namesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyNameSignal: ActionGroupSignalName { get } -
onNotifySensitive(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::sensitivesignalDeclaration
Swift
@discardableResult @inlinable func onNotifySensitive(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySensitivesignal is emitted -
notifySensitiveSignalExtension methodTyped
notify::sensitivesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySensitiveSignal: ActionGroupSignalName { get } -
onNotifyVisible(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::visiblesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyVisible(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ActionGroupRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyVisiblesignal is emitted -
notifyVisibleSignalExtension methodTyped
notify::visiblesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyVisibleSignal: ActionGroupSignalName { get }
-
add(action:Extension method) Adds an action object to the action group. Note that this function does not set up the accel path of the action, which can lead to problems if a user tries to modify the accelerator of a menuitem associated with the action. Therefore you must either set the accel path yourself with
gtk_action_set_accel_path(), or usegtk_action_group_add_action_with_accel (..., NULL).add_action is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func add<ActionT>(action: ActionT) where ActionT : ActionProtocol -
addActionWithAccel(action:Extension methodaccelerator: ) Adds an action object to the action group and sets up the accelerator.
If
acceleratorisnil, attempts to use the accelerator associated with the stock_id of the action.Accel paths are set to
<Actions>/group-name/action-name.add_action_with_accel is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addActionWithAccel<ActionT>(action: ActionT, accelerator: UnsafePointer<gchar>? = nil) where ActionT : ActionProtocol -
addActions(entries:Extension methodnEntries: userData: ) This is a convenience function to create a number of actions and add them to the action group.
The “activate” signals of the actions are connected to the callbacks and their accel paths are set to
<Actions>/group-name/action-name.add_actions is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addActions(entries: UnsafePointer<GtkActionEntry>!, nEntries: Int, userData: gpointer! = nil) -
addActionsFull(entries:Extension methodnEntries: userData: destroy: ) This variant of
gtk_action_group_add_actions()adds aGDestroyNotifycallback foruser_data.add_actions_full is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addActionsFull(entries: UnsafePointer<GtkActionEntry>!, nEntries: Int, userData: gpointer! = nil, destroy: GDestroyNotify? = nil) -
addRadioActions(entries:Extension methodnEntries: value: onChange: userData: ) This is a convenience routine to create a group of radio actions and add them to the action group.
The “changed” signal of the first radio action is connected to the
on_changecallback and the accel paths of the actions are set to<Actions>/group-name/action-name.add_radio_actions is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addRadioActions(entries: UnsafePointer<GtkRadioActionEntry>!, nEntries: Int, value: Int, onChange: GCallback?, userData: gpointer! = nil) -
This variant of
gtk_action_group_add_radio_actions()adds aGDestroyNotifycallback foruser_data.add_radio_actions_full is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addRadioActionsFull(entries: UnsafePointer<GtkRadioActionEntry>!, nEntries: Int, value: Int, onChange: GCallback?, userData: gpointer! = nil, destroy: GDestroyNotify?) -
addToggleActions(entries:Extension methodnEntries: userData: ) This is a convenience function to create a number of toggle actions and add them to the action group.
The “activate” signals of the actions are connected to the callbacks and their accel paths are set to
<Actions>/group-name/action-name.add_toggle_actions is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addToggleActions(entries: UnsafePointer<GtkToggleActionEntry>!, nEntries: Int, userData: gpointer! = nil) -
addToggleActionsFull(entries:Extension methodnEntries: userData: destroy: ) This variant of
gtk_action_group_add_toggle_actions()adds aGDestroyNotifycallback foruser_data.add_toggle_actions_full is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func addToggleActionsFull(entries: UnsafePointer<GtkToggleActionEntry>!, nEntries: Int, userData: gpointer! = nil, destroy: GDestroyNotify? = nil) -
getAccelGroup()Extension methodGets the accelerator group.
get_accel_group is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func getAccelGroup() -> AccelGroupRef! -
getAction(actionName:Extension method) Looks up an action in the action group by name.
get_action is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func getAction(actionName: UnsafePointer<gchar>!) -> ActionRef! -
getName()Extension methodGets the name of the action group.
get_name is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func getName() -> String! -
getSensitive()Extension methodReturns
trueif the group is sensitive. The constituent actions can only be logically sensitive (seegtk_action_is_sensitive()) if they are sensitive (seegtk_action_get_sensitive()) and their group is sensitive.get_sensitive is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func getSensitive() -> Bool -
getVisible()Extension methodReturns
trueif the group is visible. The constituent actions can only be logically visible (seegtk_action_is_visible()) if they are visible (seegtk_action_get_visible()) and their group is visible.get_visible is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func getVisible() -> Bool -
listActions()Extension methodLists the actions in the action group.
list_actions is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func listActions() -> GLib.ListRef! -
remove(action:Extension method) Removes an action object from the action group.
remove_action is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func remove<ActionT>(action: ActionT) where ActionT : ActionProtocol -
set(accelGroup:Extension method) Sets the accelerator group to be used by every action in this group.
set_accel_group is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func set(accelGroup: AccelGroupRef? = nil) -
set(accelGroup:Extension method) Sets the accelerator group to be used by every action in this group.
set_accel_group is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func set<AccelGroupT>(accelGroup: AccelGroupT?) where AccelGroupT : AccelGroupProtocol -
set(sensitive:Extension method) Changes the sensitivity of
action_groupset_sensitive is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func set(sensitive: Bool) -
setTranslateFunc(func:Extension methoddata: notify: ) Sets a function to be used for translating the
labelandtooltipofGtkActionEntrysadded bygtk_action_group_add_actions().If you’re using
gettext(), it is enough to set the translation domain withgtk_action_group_set_translation_domain().set_translate_func is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func setTranslateFunc(func: GtkTranslateFunc?, data: gpointer! = nil, notify: GDestroyNotify?) -
setTranslation(domain:Extension method) Sets the translation domain and uses
g_dgettext()for translating thelabelandtooltipofGtkActionEntrysadded bygtk_action_group_add_actions().If you’re not using
gettext()for localization, seegtk_action_group_set_translate_func().set_translation_domain is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func setTranslation(domain: UnsafePointer<gchar>? = nil) -
set(visible:Extension method) Changes the visible of
action_group.set_visible is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func set(visible: Bool) -
translate(string:Extension method) Translates a string using the function set with
gtk_action_group_set_translate_func(). This is mainly intended for language bindings.translate_string is deprecated: This method is deprecated.
Declaration
Swift
@available(*, deprecated) @inlinable func translate(string: UnsafePointer<gchar>!) -> String! -
accelGroupExtension methodGets the accelerator group.
get_accel_group is deprecated: This method is deprecated.
Declaration
Swift
@inlinable var accelGroup: AccelGroupRef! { get nonmutating set } -
nameExtension methodA name for the action.
name is deprecated: This method is deprecated.
Declaration
Swift
@inlinable var name: String! { get } -
sensitiveExtension methodWhether the action group is enabled.
sensitive is deprecated: This method is deprecated.
Declaration
Swift
@inlinable var sensitive: Bool { get nonmutating set } -
visibleExtension methodWhether the action group is visible.
visible is deprecated: This method is deprecated.
Declaration
Swift
@inlinable var visible: Bool { get nonmutating set } -
parentExtension methodUndocumented
Declaration
Swift
@inlinable var parent: GObject { get }
View on GitHub
Install in Dash
ActionGroupProtocol Protocol Reference