Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::AccelMap Class Reference

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

#include <xfc/gtk/accelmap.hh>

Inheritance diagram for Xfc::Gtk::AccelMap:

Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable List of all members.

Signals

Public Types

Public Member Functions

Accessors
Signal Proxies

Static Public Member Functions

Accessors
Methods

Detailed Description

A GtkAccelMap C++ wrapper class.


Member Typedef Documentation

typedef sigc::slot<void, const String&, const AccelKey&, bool> Xfc::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.
<


Constructor & Destructor Documentation

Xfc::Gtk::AccelMap::AccelMap ( GtkAccelMap *  map,
bool  owns_reference = true 
) [explicit, protected]

Construct a new AccelMap from an existing GtkAccelMap.

Parameters:
map A pointer to a GtkAccelMap.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The map can be a newly created GtkAccelMap or an existing GtkAccelMap. (see G::Object::Object).

Xfc::Gtk::AccelMap::AccelMap ( GtkAccelMap *  map,
bool  owns_reference = true 
) [explicit, protected]

Construct a new AccelMap from an existing GtkAccelMap.

Parameters:
map A pointer to a GtkAccelMap.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The map can be a newly created GtkAccelMap or an existing GtkAccelMap. (see G::Object::Object).


Member Function Documentation

static AccelMap* Xfc::Gtk::AccelMap::get (  )  [static]

Gets the singleton global AccelMap object.

Returns:
The global Gtk::AccelMap object.
The AccelMap object is useful only for notification of changes to the accelerator map via the 'changed_signal'.

static bool Xfc::Gtk::AccelMap::lookup_entry ( const String 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.

static void Xfc::Gtk::AccelMap::add_entry ( const String 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...".

static bool Xfc::Gtk::AccelMap::change_entry ( const String 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.

static void Xfc::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.

static void Xfc::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.

static void Xfc::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.

static void Xfc::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().

static void Xfc::Gtk::AccelMap::save ( int  file_descriptor  )  [static]

Filedescriptor variant of save().

Parameters:
file_descriptor A valid writable file descriptor.

static void Xfc::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).

static void Xfc::Gtk::AccelMap::lock_path ( const String accel_path  )  [static]

Locks the given accelerator path.

Parameters:
accel_path A valid accelerator path.
If the accelerator map doesn't yet contain an entry for accel_path, a new one is created. 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() for information about runtime accelerator changes.

If called more than once, accel_path remains locked until unlock_path() has been called an equivalent number of times. Note that locking of individual accelerator paths is independent from locking the Gtk::AccelGroup containing them. For runtime accelerator changes to be possible both the accelerator path and its Gtk::AccelGroup have to be unlocked.

static void Xfc::Gtk::AccelMap::unlock_path ( const String accel_path  )  [static]

Undoes the last call to lock_path() on this accel_path (see lock_path()).

Parameters:
accel_path A valid accelerator path.

const ChangedSignalProxy Xfc::Gtk::AccelMap::signal_changed ( const String accel_path  ) 

Connect to the changed_signal; emitted when an entry in the global accelerator map is changed.

Parameters:
accel_path The accelerator path to be notified of changes to.
If accel_path is provided it is appended to the signal name so that the signal connected to becomes "changed::accel_path". What this does is ensure that your changed slot is only called if accel_path matches the accelerator path of the "changed" signal being emitted.


Member Data Documentation

const ChangedSignalType Xfc::Gtk::AccelMap::changed_signal [static, protected]

Changed signal (see signal_changed()).

Calls a slot with the signature:

< void function(const String& accel_path, const AccelKey& accel_key);
<
< // accel_path: The path of the accelerator that changed.
< // accel_key: An AccelKey specifying the accelerator key value and modifiers.
<


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3