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
GtkAccelGroup
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
accel_group_ptr
Default implementationTyped pointer to the underlying
GtkAccelGroup
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkAccelGroup
instance.Declaration
Swift
var accel_group_ptr: UnsafeMutablePointer<GtkAccelGroup>! { get }
-
Required Initialiser for types conforming to
AccelGroupProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
AccelGroupPropertyName
source 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 : 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 AccelGroup property
Declaration
Swift
@inlinable func get(property: AccelGroupPropertyName) -> 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 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
property
the 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
AccelGroupSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AccelGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The 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
AccelGroupSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: AccelGroupSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The 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
GtkAccelGroup
and not meant to be used by applications.Note
This represents the underlyingaccel-activate
signalDeclaration
Swift
@discardableResult @inlinable func onAccelActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ acceleratable: GLibObject.ObjectRef, _ keyval: UInt, _ modifier: Gdk.ModifierType) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
acceleratable
the object on which the accelerator was activated
keyval
the accelerator keyval
modifier
the modifier combination of the accelerator
handler
true
if the accelerator was activated Run the given callback whenever theaccelActivate
signal is emitted -
accelActivateSignal
Extension methodTyped
accel-activate
signal 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
GtkAccelLabel
which display an associated accelerator should connect to this signal, and rebuild their visual representation if theaccel_closure
is theirs.Note
This represents the underlyingaccel-changed
signalDeclaration
Swift
@discardableResult @inlinable func onAccelChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ keyval: UInt, _ modifier: Gdk.ModifierType, _ accelClosure: GLibObject.ClosureRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
keyval
the accelerator keyval
modifier
the modifier combination of the accelerator
accelClosure
the
GClosure
of the acceleratorhandler
The signal handler to call Run the given callback whenever the
accelChanged
signal is emitted -
accelChangedSignal
Extension methodTyped
accel-changed
signal 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 innotify
being 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-locked
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIsLocked(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyIsLocked
signal is emitted -
notifyIsLockedSignal
Extension methodTyped
notify::is-locked
signal 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 innotify
being 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-mask
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyModifierMask(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: AccelGroupRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyModifierMask
signal is emitted -
notifyModifierMaskSignal
Extension methodTyped
notify::modifier-mask
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyModifierMaskSignal: AccelGroupSignalName { get }
-
activate(accelQuark:
Extension methodacceleratable: accelKey: accelMods: ) Finds the first accelerator in
accel_group
that matchesaccel_key
andaccel_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_group
is being activated in response to a call togtk_accel_groups_activate()
,closure
will be invoked if theaccel_key
andaccel_mods
fromgtk_accel_groups_activate()
match those of this connection.The signature used for the
closure
is 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_group
is being activated in response to a call togtk_accel_groups_activate()
,closure
will be invoked if theaccel_key
andaccel_mods
fromgtk_accel_groups_activate()
match the key and modifiers for the path.The signature used for the
closure
is that ofGtkAccelGroupActivate
.Note that
accel_path
string 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
closure
can 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
closure
can 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_func
returnstrue
and 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
GdkModifierType
representing 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_group
remains 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_key
andaccel_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()
-
isLocked
Extension methodLocks are added and removed using
gtk_accel_group_lock()
andgtk_accel_group_unlock()
.Declaration
Swift
@inlinable var isLocked: Bool { get }
-
modifierMask
Extension methodGets a
GdkModifierType
representing the mask for thisaccel_group
. For example,GDK_CONTROL_MASK
,GDK_SHIFT_MASK
, etc.Declaration
Swift
@inlinable var modifierMask: Gdk.ModifierType { get }
-
parent
Extension methodUndocumented
Declaration
Swift
@inlinable var parent: GObject { get }