AccelGroupProtocol
public protocol AccelGroupProtocol : ObjectProtocol
A GtkAccelGroup represents a group of keyboard accelerators,
typically attached to a toplevel GtkWindow (with
gtk_window_add_accel_group()). Usually you won’t need to create a
GtkAccelGroup directly; instead, when using GtkUIManager, GTK+
automatically sets up the accelerators for your menus in the ui
manager’s GtkAccelGroup.
Note that “accelerators” are different from
“mnemonics”. Accelerators are shortcuts for
activating a menu item; they appear alongside the menu item they’re a
shortcut for. For example “Ctrl+Q” might appear alongside the “Quit”
menu item. Mnemonics are shortcuts for GUI elements such as text
entries or buttons; they appear as underlined characters. See
gtk_label_new_with_mnemonic(). Menu items can have both accelerators
and mnemonics, of course.
The AccelGroupProtocol protocol exposes the methods and properties of an underlying GtkAccelGroup 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 AccelGroup.
Alternatively, use AccelGroupRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkAccelGroupinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
accel_group_ptrDefault implementationTyped pointer to the underlying
GtkAccelGroupinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkAccelGroupinstance.Declaration
Swift
var accel_group_ptr: UnsafeMutablePointer<GtkAccelGroup>! { get } -
Required Initialiser for types conforming to
AccelGroupProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
AccelGroupPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: AccelGroupPropertyName, 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 AccelGroup property
Declaration
Swift
@inlinable func get(property: AccelGroupPropertyName) -> 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 AccelGroup property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: AccelGroupPropertyName, 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
AccelGroupSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AccelGroupSignalName, 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
AccelGroupSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AccelGroupSignalName, 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)
-
onAccelActivate(flags:Extension methodhandler: ) The accel-activate signal is an implementation detail of
GtkAccelGroupand not meant to be used by applications.Note
This represents the underlyingaccel-activatesignalDeclaration
Swift
@discardableResult @inlinable func onAccelActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ acceleratable: GLibObject.ObjectRef, _ keyval: UInt, _ modifier: Gdk.ModifierType) -> Bool) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
acceleratablethe object on which the accelerator was activated
keyvalthe accelerator keyval
modifierthe modifier combination of the accelerator
handlertrueif the accelerator was activated Run the given callback whenever theaccelActivatesignal is emitted -
accelActivateSignalExtension methodTyped
accel-activatesignal for using theconnect(signal:)methodsDeclaration
Swift
static var accelActivateSignal: AccelGroupSignalName { get } -
onAccelChanged(flags:Extension methodhandler: ) The accel-changed signal is emitted when an entry is added to or removed from the accel group.
Widgets like
GtkAccelLabelwhich display an associated accelerator should connect to this signal, and rebuild their visual representation if theaccel_closureis theirs.Note
This represents the underlyingaccel-changedsignalDeclaration
Swift
@discardableResult @inlinable func onAccelChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ keyval: UInt, _ modifier: Gdk.ModifierType, _ accelClosure: GLibObject.ClosureRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
keyvalthe accelerator keyval
modifierthe modifier combination of the accelerator
accelClosurethe
GClosureof the acceleratorhandlerThe signal handler to call Run the given callback whenever the
accelChangedsignal is emitted -
accelChangedSignalExtension methodTyped
accel-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var accelChangedSignal: AccelGroupSignalName { get } -
onNotifyIsLocked(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::is-lockedsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIsLocked(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ 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
notifyIsLockedsignal is emitted -
notifyIsLockedSignalExtension methodTyped
notify::is-lockedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyIsLockedSignal: AccelGroupSignalName { get } -
onNotifyModifierMask(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::modifier-masksignalDeclaration
Swift
@discardableResult @inlinable func onNotifyModifierMask(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ 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
notifyModifierMasksignal is emitted -
notifyModifierMaskSignalExtension methodTyped
notify::modifier-masksignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyModifierMaskSignal: AccelGroupSignalName { get }
-
activate(accelQuark:Extension methodacceleratable: accelKey: accelMods: ) Finds the first accelerator in
accel_groupthat matchesaccel_keyandaccel_mods, and activates it.Declaration
Swift
@inlinable func activate<ObjectT>(accelQuark: GQuark, acceleratable: ObjectT, accelKey: Int, accelMods: Gdk.ModifierType) -> Bool where ObjectT : ObjectProtocol -
connect(accelKey:Extension methodaccelMods: accelFlags: closure: ) Installs an accelerator in this group. When
accel_groupis being activated in response to a call togtk_accel_groups_activate(),closurewill be invoked if theaccel_keyandaccel_modsfromgtk_accel_groups_activate()match those of this connection.The signature used for the
closureis that ofGtkAccelGroupActivate.Note that, due to implementation details, a single closure can only be connected to one accelerator group.
Declaration
Swift
@inlinable func connect<ClosureT>(accelKey: Int, accelMods: Gdk.ModifierType, accelFlags: AccelFlags, closure: ClosureT) where ClosureT : ClosureProtocol -
connectByPath(accelPath:Extension methodclosure: ) Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see
gtk_accel_map_add_entry()). Whenaccel_groupis being activated in response to a call togtk_accel_groups_activate(),closurewill be invoked if theaccel_keyandaccel_modsfromgtk_accel_groups_activate()match the key and modifiers for the path.The signature used for the
closureis that ofGtkAccelGroupActivate.Note that
accel_pathstring will be stored in aGQuark. Therefore, if you pass a static string, you can save some memory by interning it first withg_intern_static_string().Declaration
Swift
@inlinable func connectByPath<ClosureT>(accelPath: UnsafePointer<gchar>!, closure: ClosureT) where ClosureT : ClosureProtocol -
disconnect(closure:Extension method) Removes an accelerator previously installed through
gtk_accel_group_connect().Since 2.20
closurecan benil.Declaration
Swift
@inlinable func disconnect(closure: GLibObject.ClosureRef? = nil) -> Bool -
disconnect(closure:Extension method) Removes an accelerator previously installed through
gtk_accel_group_connect().Since 2.20
closurecan benil.Declaration
Swift
@inlinable func disconnect<ClosureT>(closure: ClosureT?) -> Bool where ClosureT : ClosureProtocol -
disconnectKey(accelKey:Extension methodaccelMods: ) Removes an accelerator previously installed through
gtk_accel_group_connect().Declaration
Swift
@inlinable func disconnectKey(accelKey: Int, accelMods: Gdk.ModifierType) -> Bool -
find(findFunc:Extension methoddata: ) Finds the first entry in an accelerator group for which
find_funcreturnstrueand returns itsGtkAccelKey.Declaration
Swift
@inlinable func find(findFunc: GtkAccelGroupFindFunc?, data: gpointer! = nil) -> AccelKeyRef! -
getIsLocked()Extension methodLocks are added and removed using
gtk_accel_group_lock()andgtk_accel_group_unlock().Declaration
Swift
@inlinable func getIsLocked() -> Bool -
getModifierMask()Extension methodGets a
GdkModifierTyperepresenting the mask for thisaccel_group. For example,GDK_CONTROL_MASK,GDK_SHIFT_MASK, etc.Declaration
Swift
@inlinable func getModifierMask() -> Gdk.ModifierType -
lock()Extension methodLocks the given accelerator group.
Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to
gtk_accel_map_change_entry()about runtime accelerator changes.If called more than once,
accel_groupremains locked untilgtk_accel_group_unlock()has been called an equivalent number of times.Declaration
Swift
@inlinable func lock() -
query(accelKey:Extension methodaccelMods: nEntries: ) Queries an accelerator group for all entries matching
accel_keyandaccel_mods.Declaration
Swift
@inlinable func query(accelKey: Int, accelMods: Gdk.ModifierType, nEntries: UnsafeMutablePointer<guint>! = nil) -> UnsafeMutablePointer<GtkAccelGroupEntry>! -
unlock()Extension methodUndoes the last call to
gtk_accel_group_lock()on thisaccel_group.Declaration
Swift
@inlinable func unlock() -
isLockedExtension methodLocks are added and removed using
gtk_accel_group_lock()andgtk_accel_group_unlock().Declaration
Swift
@inlinable var isLocked: Bool { get } -
modifierMaskExtension methodGets a
GdkModifierTyperepresenting the mask for thisaccel_group. For example,GDK_CONTROL_MASK,GDK_SHIFT_MASK, etc.Declaration
Swift
@inlinable var modifierMask: Gdk.ModifierType { get } -
parentExtension methodUndocumented
Declaration
Swift
@inlinable var parent: GObject { get }
View on GitHub
Install in Dash
AccelGroupProtocol Protocol Reference