Package: gtk

Class gtk:accel-map

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

None

Details

Accelerator maps are used to define runtime configurable accelerators. Functions for manipulating them are usually used by higher level convenience mechanisms like the gtk:ui-manager object and are thus considered "low-level". You will want to use them if you are manually creating menus that should have user-configurable accelerators.

An accelerator is uniquely defined by:
  • an accelerator path,
  • an accelerator key, and
  • 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 gtk:accel-map object that can be obtained using the gtk:accel-map-get function. See Monitoring changes for additional details.

Manipulating accelerators
New accelerators can be added using the gtk:accel-map-add-entry function. To search for a specific accelerator, use the gtk:accel-map-lookup-entry function. Modifications of existing accelerators should be done using the gtk:accel-map-change-entry function.

In order to avoid having some accelerators changed, they can be locked using the gtk:accel-map-lock-path function. Unlocking is done using the gtk:accel-map-unlock-path function.

Saving and loading accelerator maps
Accelerator maps can be saved to and loaded from some external resource. For simple saving and loading from file, the gtk:accel-map-save and gtk:accel-map-load functions are provided.

Monitoring changes
A gtk:accel-map object is only useful for monitoring changes of accelerators. By connecting to the "changed" signal, one can monitor changes of all accelerators. It is also possible to monitor only a single accelerator path by using it as a detail of the "changed" signal.

Signal Details

The "changed" signal
lambda (object path key mods)    :has-details      
Notifies of a change in the global accelerator map. The path is also used as the detail for the signal, so it is possible to connect to "changed::accel-path".
object
The global gtk:accel-map object.
path
A string with the path of the accelerator that changed.
key
An unsigned integer with the key value for the new accelerator.
mods
The gdk:modifier-type modifier mask for the new accelerator.
 

Inherited Slot Access Functions

See also

2023-3-6