gtkmm: Gtk::AccelMap Namespace Reference

gtkmm 2.24.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Namespace List
- Namespace Members

Functions

# Gtk::AccelMap Namespace Reference

## Functions
void | add_entry (const std::string& accel_path, guint accel_key, Gdk::ModifierType accel_mods)
| Registers a new accelerator with the global accelerator map.
bool | change_entry (const std::string& accel_path, guint accel_key, Gdk::ModifierType accel_mods, bool replace)
| Changes the accel_key and accel_mods currently associated with accel_path.
void | load (const std::string& filename)
| Parses a file previously saved with save() for accelerator specifications, and propagates them accordingly.
void | save (const std::string& filename)
| Saves current accelerator specifications (accelerator path, key and modifiers) to filename.
void | lock_path (const std::string& accel_path)
| Locks the given accelerator path.
void | unlock_path (const std::string& accel_path)
| Unlocks the given accelerator path.
bool | lookup_entry (const Glib::ustring& accel_path)
| Looks up the accelerator entry for accel_path.
bool | lookup_entry (const Glib::ustring& accel_path, Gtk::AccelKey& key)
| Looks up the accelerator entry for accel_path and fills in key.

## Function Documentation

void Gtk::AccelMap::add_entry | ( | const std::string & | accel_path,
|  | guint | accel_key,
|  | Gdk::ModifierType | accel_mods
| ) |  |

Registers a new accelerator with the global accelerator map.

This function should only be called once per accel_path with the canonical accel_key and accel_mods for this path. To change the accelerator during runtime programatically, use change_entry(). 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...".

Parameters:

  accel_path | valid accelerator path
  accel_key | the accelerator key
  accel_mods | the accelerator modifiers

bool Gtk::AccelMap::change_entry | ( | const std::string & | accel_path,
|  | guint | accel_key,
|  | Gdk::ModifierType | accel_mods,
|  | bool | replace
| ) |  |

Changes the accel_key and accel_mods currently associated with accel_path.

Due to conflicts with other accelerators, a change may not always be possible, replace indicates whether other accelerators may be deleted to resolve such conflicts. A change will only occur if all conflicts could be resolved (which might not be the case if conflicting accelerators are locked). Successful changes are indicated by a true return value.

Parameters:

  accel_path | a valid accelerator path
  accel_key | the new accelerator key
  accel_mods | the new accelerator modifiers
  replace | true if other accelerators may be deleted upon conflicts

Returns:
  true if the accelerator could be changed, false otherwise

void Gtk::AccelMap::load | ( | const std::string & | filename | ) |

Parses a file previously saved with save() for accelerator specifications, and propagates them accordingly.

Parameters:

  filename | a file containing accelerator specifications

void Gtk::AccelMap::lock_path | ( | const std::string & | accel_path | ) |

Locks the given accelerator path.

Locking an accelerator path prevents its accelerator from being changed during runtime. A locked accelerator path can be unlocked by unlock_path(). Refer to change_entry() about runtime accelerator changes.

Note that locking of individual accelerator paths is independent from locking the #GtkAccelGroup containing them. For runtime accelerator changes to be possible both the accelerator path and its AccelGroup have to be unlocked.

Parameters:

  accel_path | a valid accelerator path

Since gtkmm 2.4:

bool Gtk::AccelMap::lookup_entry | ( | const Glib::ustring & | accel_path,
|  | Gtk::AccelKey& | key
| ) |  |

Looks up the accelerator entry for accel_path and fills in key.

Parameters:

  accel_path | A valid accelerator path.
  key | The accelerator key to be filled in.

Returns:
  true if accel_path is known, false otherwise

Since gtkmm 2.10:

bool Gtk::AccelMap::lookup_entry | ( | const Glib::ustring & | accel_path | ) |

Looks up the accelerator entry for accel_path.

Parameters:

  accel_path | A valid accelerator path.

Returns:
  true if accel_path is known, false otherwise

Since gtkmm 2.10:

void Gtk::AccelMap::save | ( | const std::string & | filename | ) |

Saves current accelerator specifications (accelerator path, key and modifiers) to filename.

The file is written in a format suitable to be read back in by load().

Parameters:

  filename | the file to contain accelerator specifications

void Gtk::AccelMap::unlock_path | ( | const std::string & | accel_path | ) |

Unlocks the given accelerator path.

Refer to gtk_accel_map_lock_path() about accelerator path locking.

Parameters:

  accel_path | a valid accelerator path

Since gtkmm 2.4: