Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::AccelMap Class Reference

A GtkAccelMap C++ wrapper class. More...

`#include <inti/gtk/accelmap.h>`

List of all members.

## Public Types

- typedef Slot3< void, const
  char *, const AccelKey &,
  bool > ForeachSlot
    Signature for the callback slot to be called on each entry in the accelerator map.

## Static Public Member Functions

- bool lookup_entry (const char *accel_path, AccelKey *accel_key=0)
    Looks up the accelerator entry for accel_path and fills in accel_key.
- void add_entry (const char *accel_path, const AccelKey &accel_key)
    Registers a new accelerator with the global accelerator map.
- bool change_entry (const char *accel_path, const AccelKey &accel_key, bool replace)
    Changes the key value and modifiers currently associated with accel_path.
- void load (const String &filename)
    Parses a file previously saved with save() for accelerator specifications, and propagates them accordingly.
- void load (int file_descriptor)
    Filedescriptor variant of load().
- void load (G::Scanner &scanner)
    G::Scanner variant of load().
- void save (const String &filename)
    Saves current accelerator specifications (accelerator path, key and modifiers) to file_name.
- void save (int file_descriptor)
    Filedescriptor variant of save().
- void foreach (const ForeachSlot *slot)
    Loops over the entries in the accelerator map whose accel_path doesn't match any of the filters added with add_filter(), and calls slot on each.

## Detailed Description

A GtkAccelMap C++ wrapper class.

## Member Typedef Documentation

typedef Slot3<void, const char*, const AccelKey&, bool> Inti::Gtk::AccelMap::ForeachSlot

Signature for the callback slot to be called on each entry in the accelerator map.

Example: Method signature for ForeachSlot.

                 void method(const char *accel_path, const AccelKey& accel_key, bool changed);

                 // accel_path: The accelerator path for the entry.
                 // accel_key: An AccelKey object that holds the entry's accelerator key and modifiers.
                 // changed: Whether the accelerator was changed during runtime and would need saving.

## Member Function Documentation

void Inti::Gtk::AccelMap::add_entry | ( | const char * | accel_path,
|  | const AccelKey & | accel_key
| ) | `[static]`

Registers a new accelerator with the global accelerator map.

Parameters:

  accel_path | A valid accelerator path.
  accel_key | An AccelKey specifying the accelerator key value and modifiers.

This function should only be called once per accel_path with the canonical accelerator key value and modifiers 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...".

bool Inti::Gtk::AccelMap::change_entry | ( | const char * | accel_path,
|  | const AccelKey & | accel_key,
|  | bool | replace
| ) | `[static]`

Changes the key value and modifiers currently associated with accel_path.

Parameters:

  accel_path | A valid accelerator path.
  accel_key | An AccelKey specifying the accelerator key value and modifiers.
  replace | Set true if other accelerators may be deleted upon conflicts.

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

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.

void Inti::Gtk::AccelMap::foreach | ( | const ForeachSlot * | slot | ) | `[static]`

Loops over the entries in the accelerator map whose accel_path doesn't match any of the filters added with add_filter(), and calls slot on each.

Parameters:

  slot | Ahe ForeachSlot to be called for each map entry not filtered out.

The signature for the ForeachSlot is typedef'd above, the changed parameter indicates whether this accelerator was changed during runtime (thus, would need saving during an accelerator map dump).

void Inti::Gtk::AccelMap::load | ( | G::Scanner & | scanner | ) | `[static]`

G::Scanner variant of load().

Parameters:

  scanner | A G::Scanner which has already been provided with an input file.

void Inti::Gtk::AccelMap::load | ( | int | file_descriptor | ) | `[static]`

Filedescriptor variant of load().

Parameters:

  file_descriptor | A valid readable file descriptor.

Note that the file descriptor will not be closed by this function.

void Inti::Gtk::AccelMap::load | ( | const String & | filename | ) | `[static]`

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

Parameters:

  filename | A file containing accelerator specifications.

bool Inti::Gtk::AccelMap::lookup_entry | ( | const char * | accel_path,
|  | AccelKey * | accel_key = 0
| ) | `[static]`

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

Parameters:

  accel_path | A valid accelerator path.
  accel_key | The accelerator key to be filled in (optional).

Returns:
  true if accel_path is known, false otherwise.

void Inti::Gtk::AccelMap::save | ( | int | file_descriptor | ) | `[static]`

Filedescriptor variant of save().

Parameters:

  file_descriptor | A valid writable file descriptor.

void Inti::Gtk::AccelMap::save | ( | const String & | filename | ) | `[static]`

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

Parameters:

  filename | A file to contain accelerator specifications.

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

The documentation for this class was generated from the following file:

- accelmap.h

Main Page - Footer