#include <keybindings.h>
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. |
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.
cwidget::config::keybindings::keybindings | ( | keybindings * | _parent = NULL |
) | [inline] |
Create a new key-binding scope.
_parent | The parent of this scope, if any, or NULL for no parent. |
std::wstring cwidget::config::keybindings::keyname | ( | const std::string & | tag | ) |
tag | The function whose keystroke is to be returned. |
std::wstring cwidget::config::keybindings::readable_keyname | ( | const std::string & | tag | ) |
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.
tag | The name of the function to be bound. | |
strokes | The keystrokes to bind to the function. |
Referenced by cwidget::toplevel::init().
void cwidget::config::keybindings::set | ( | std::string | tag, | |
const key & | stroke | |||
) | [inline] |
Modify a binding in this scope.
tag | The name of the function to be bound. | |
stroke | A keystroke to bind to the function. |
bool cwidget::config::keybindings::key_matches | ( | const key & | k, | |
std::string | tag | |||
) |
Test whether a key is bound to a function.
k | The key to test. | |
tag | The function to test against. |
Referenced by cwidget::widgets::text_layout::handle_key(), and cwidget::widgets::pager::handle_key().