cwidget::config::keybindings Class Reference

Stores the keys bound to various functions. More...

#include <keybindings.h>

List of all members.

Public Member Functions

 keybindings (keybindings *_parent=NULL)
 Create a new key-binding scope.
std::wstring keyname (const std::string &tag)
std::wstring readable_keyname (const std::string &tag)
keybinding get (std::string tag)
 Retrieve the binding of the given function.
void set (std::string tag, keybinding strokes)
 Modify a binding in this scope.
void set (std::string tag, const key &stroke)
 Modify a binding in this scope.
bool key_matches (const key &k, std::string tag)
 Test whether a key is bound to a function.


Detailed Description

Stores the keys bound to various functions.

Functions are simply arbitrary strings chosen by the user of this class. For instance, "QuitProgram" might be the function that quits the program.

Each keybindings object represents a scope in which bindings can be defined. Scopes are arranged hierarchically, and the bindings defined in child scopes override the bindings defined in parent scopes.


Constructor & Destructor Documentation

cwidget::config::keybindings::keybindings ( keybindings _parent = NULL  )  [inline]

Create a new key-binding scope.

Parameters:
_parent The parent of this scope, if any, or NULL for no parent.


Member Function Documentation

std::wstring cwidget::config::keybindings::keyname ( const std::string &  tag  ) 

Returns:
the first binding of the given function, in a format that can be passed to parse_key().
Parameters:
tag The function whose keystroke is to be returned.

std::wstring cwidget::config::keybindings::readable_keyname ( const std::string &  tag  ) 

Returns:
a human-readable string describing the keystroke bound to the given function.
Parameters:
tag The name of the function whose keystroke is to be returned.

keybinding cwidget::config::keybindings::get ( std::string  tag  )  [inline]

Retrieve the binding of the given function.

void cwidget::config::keybindings::set ( std::string  tag,
keybinding  strokes 
)

Modify a binding in this scope.

Parameters:
tag The name of the function to be bound.
strokes The keystrokes to bind to the function.
This routine throws away any previous bindings for the given function and replaces them with the bindings stored in strokes.

Referenced by cwidget::toplevel::init().

void cwidget::config::keybindings::set ( std::string  tag,
const key stroke 
) [inline]

Modify a binding in this scope.

Parameters:
tag The name of the function to be bound.
stroke A keystroke to bind to the function.
This routine throws away any previous bindings for the given function and replaces them with stroke.

bool cwidget::config::keybindings::key_matches ( const key k,
std::string  tag 
)

Test whether a key is bound to a function.

Parameters:
k The key to test.
tag The function to test against.
Returns:
true if k is bound to tag in this scope.

Referenced by cwidget::widgets::text_layout::handle_key(), and cwidget::widgets::pager::handle_key().


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

Generated on Sat Jun 12 14:51:03 2010 for cwidget by  doxygen 1.5.6