AccelMap
open class AccelMap : GLibObject.Object, AccelMapProtocol
Accelerator maps are used to define runtime configurable accelerators.
Functions for manipulating them are are usually used by higher level
convenience mechanisms like GtkUIManager
and are thus considered
“low-level”. You’ll want to use them if you’re manually creating menus that
should have user-configurable accelerators.
An accelerator is uniquely defined by:
- accelerator path
- accelerator key
- accelerator modifiers
The accelerator path must consist of “<WINDOWTYPE>/Category1/Category2/…/Action”, where WINDOWTYPE should be a unique application-specific identifier that corresponds to the kind of window the accelerator is being used in, e.g. “Gimp-Image”, “Abiword-Document” or “Gnumeric-Settings”. The “Category1/…/Action” portion is most appropriately chosen by the action the accelerator triggers, i.e. for accelerators on menu items, choose the item’s menu path, e.g. “File/Save As”, “Image/View/Zoom” or “Edit/Select All”. So a full valid accelerator path may look like: “<Gimp-Toolbox>/File/Dialogs/Tool Options…”.
All accelerators are stored inside one global GtkAccelMap
that can
be obtained using gtk_accel_map_get()
. See
Monitoring changes for additional
details.
Manipulating accelerators
New accelerators can be added using gtk_accel_map_add_entry()
.
To search for specific accelerator, use gtk_accel_map_lookup_entry()
.
Modifications of existing accelerators should be done using
gtk_accel_map_change_entry()
.
In order to avoid having some accelerators changed, they can be
locked using gtk_accel_map_lock_path()
. Unlocking is done using
gtk_accel_map_unlock_path()
.
Saving and loading accelerator maps
Accelerator maps can be saved to and loaded from some external
resource. For simple saving and loading from file,
gtk_accel_map_save()
and gtk_accel_map_load()
are provided.
Saving and loading can also be done by providing file descriptor
to gtk_accel_map_save_fd()
and gtk_accel_map_load_fd()
.
Monitoring changes
GtkAccelMap
object is only useful for monitoring changes of
accelerators. By connecting to GtkAccelMap::changed
signal, one
can monitor changes of all accelerators. It is also possible to
monitor only single accelerator path by using it as a detail of
the GtkAccelMap::changed
signal.
The AccelMap
type acts as a reference-counted owner of an underlying GtkAccelMap
instance.
It provides the methods that can operate on this data type through AccelMapProtocol
conformance.
Use AccelMap
as a strong reference or owner of a GtkAccelMap
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
AccelMap
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkAccelMap>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkAccelMap>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkAccelMap>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkAccelMap>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type. Will retainGtkAccelMap
. i.e., ownership is transferred to theAccelMap
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkAccelMap>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
AccelMapProtocol
Will retainGtkAccelMap
.Declaration
Swift
@inlinable public init<T>(accelMap other: T) where T : AccelMapProtocol
Parameters
other
an instance of a related type that implements
AccelMapProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
AccelMapProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Gets the singleton global
GtkAccelMap
object. This object is useful only for notification of changes to the accelerator map via thechanged
signal; it isn’t a parameter to the other accelerator map functions.Declaration
Swift
@inlinable public static func accelMapGet() -> AccelMap!