OpenASIP
2.0
|
#include <KeyboardShortcut.hh>
Public Member Functions | |
KeyboardShortcut (const std::string &action, int fKey, bool ctrl, bool alt, char key) | |
KeyboardShortcut (const ObjectState *state) | |
KeyboardShortcut (const KeyboardShortcut &old) | |
virtual | ~KeyboardShortcut () |
std::string | action () const |
int | fKey () const |
bool | ctrl () const |
bool | alt () const |
char | key () const |
void | setFKey (int fKey) |
void | setCtrl (bool ctrl) |
void | setAlt (bool alt) |
void | setKey (char key) |
bool | equals (const KeyboardShortcut &sc) const |
void | loadState (const ObjectState *state) |
ObjectState * | saveState () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Attributes | |
static const std::string | OSNAME_KEYBOARD_SHORTCUT = "keybsc" |
ObjectState name for keyboard shortcut. More... | |
static const std::string | OSKEY_ACTION = "action" |
ObjectState attribute key for action name. More... | |
static const std::string | OSKEY_FKEY = "fkey" |
ObjectState attribute key for function key number. More... | |
static const std::string | OSKEY_CTRL = "ctrl" |
ObjectState attribute key for ctrl key. More... | |
static const std::string | OSKEY_ALT = "alt" |
ObjectState attribute key for alt key. More... | |
static const std::string | OSKEY_KEY = "key" |
ObjectState attribute key for normal letter or number key. More... | |
Private Member Functions | |
KeyboardShortcut & | operator= (const KeyboardShortcut) |
Assigment forbidden. More... | |
Private Attributes | |
std::string | action_ |
Name of the action which is performed by the key combination. More... | |
int | fKey_ |
Number of the function key if it is used, 0 otherwise. More... | |
bool | ctrl_ |
True if Ctrl button is used in the key combination. More... | |
bool | alt_ |
True if Alt button is used in the key combination. More... | |
char | key_ |
This class stores the keyboard buttons used in a keyboard shortcut.
It contains also the name of the action performed by the key combination. This class implements the Serializable interface because keyboard shortcuts are serialized into the configuration file.
Definition at line 50 of file KeyboardShortcut.hh.
KeyboardShortcut::KeyboardShortcut | ( | const std::string & | action, |
int | fKey, | ||
bool | ctrl, | ||
bool | alt, | ||
char | key | ||
) |
Constructor.
action | Name of the action performed by the key combination. |
fKey | Number of the function key used in the shortcut, if the value is not between 1 and 12 it is ignored and any function key won't be used. |
ctrl | True if the Ctrl button is used. |
alt | True if the Alt button is used. |
key | Character used in the key combination, NUL character if no character is used. If delete is used, apply ascii 127. |
Definition at line 60 of file KeyboardShortcut.cc.
References alt_, assert, ctrl_, fKey(), key(), and key_.
KeyboardShortcut::KeyboardShortcut | ( | const ObjectState * | state | ) |
Constructor.
Loads the state of the object from the given ObjectState object.
state | ObjectState from which the state is loaded. |
Definition at line 105 of file KeyboardShortcut.cc.
References loadState().
KeyboardShortcut::KeyboardShortcut | ( | const KeyboardShortcut & | old | ) |
|
virtual |
std::string KeyboardShortcut::action | ( | ) | const |
Returns the name of the action performed by this key combination.
Definition at line 137 of file KeyboardShortcut.cc.
References action_.
Referenced by OptionsDialog::readOptions(), and GUIOptions::validate().
bool KeyboardShortcut::alt | ( | ) | const |
Returns true if Alt button is used in the key combination.
Definition at line 177 of file KeyboardShortcut.cc.
References alt_.
Referenced by MainFrame::menuAccelerator(), ProximMainFrame::menuAccelerator(), setAlt(), and KeyboardShortcutDialog::TransferDataToWindow().
bool KeyboardShortcut::ctrl | ( | ) | const |
Returns true if Ctrl button is used in the key combination.
Definition at line 165 of file KeyboardShortcut.cc.
References ctrl_.
Referenced by MainFrame::menuAccelerator(), ProximMainFrame::menuAccelerator(), setCtrl(), and KeyboardShortcutDialog::TransferDataToWindow().
bool KeyboardShortcut::equals | ( | const KeyboardShortcut & | sc | ) | const |
Returns true if the given keyboard shortcut has the same key combination as this.
sc | Keyboard shortcut. |
Definition at line 250 of file KeyboardShortcut.cc.
References alt_, ctrl_, fKey(), and key_.
Referenced by GUIOptions::validate().
int KeyboardShortcut::fKey | ( | ) | const |
Returns the number of the function key used in the key combination.
Definition at line 149 of file KeyboardShortcut.cc.
References fKey_.
Referenced by equals(), KeyboardShortcut(), MainFrame::menuAccelerator(), ProximMainFrame::menuAccelerator(), saveState(), setFKey(), and KeyboardShortcutDialog::TransferDataToWindow().
char KeyboardShortcut::key | ( | ) | const |
Returns the character used in the key combination or NUL character if no character is used.
Definition at line 190 of file KeyboardShortcut.cc.
References key_.
Referenced by KeyboardShortcut(), MainFrame::menuAccelerator(), ProximMainFrame::menuAccelerator(), setKey(), and KeyboardShortcutDialog::TransferDataToWindow().
|
virtual |
Loads the state of the object from the given ObjectState object.
state | ObjectState from which the state is loaded. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Implements Serializable.
Definition at line 268 of file KeyboardShortcut.cc.
References action_, alt_, ctrl_, fKey_, ObjectState::hasAttribute(), ObjectState::intAttribute(), key_, ObjectState::name(), OSKEY_ACTION, OSKEY_ALT, OSKEY_CTRL, OSKEY_FKEY, OSKEY_KEY, OSNAME_KEYBOARD_SHORTCUT, and ObjectState::stringAttribute().
Referenced by KeyboardShortcut().
|
private |
Assigment forbidden.
|
virtual |
Creates an ObjectState object and saves the state of the object into it.
Implements Serializable.
Definition at line 310 of file KeyboardShortcut.cc.
References action_, alt_, ctrl_, fKey(), key_, OSKEY_ACTION, OSKEY_ALT, OSKEY_CTRL, OSKEY_FKEY, OSKEY_KEY, OSNAME_KEYBOARD_SHORTCUT, and ObjectState::setAttribute().
Referenced by GUIOptions::saveState().
void KeyboardShortcut::setAlt | ( | bool | alt | ) |
Sets alt-button state of the shortcut.
alt | Alt-button state of the shortcut. |
Definition at line 212 of file KeyboardShortcut.cc.
Referenced by KeyboardShortcutDialog::onCharEvent().
void KeyboardShortcut::setCtrl | ( | bool | ctrl | ) |
Sets control button state of the shortcut.
ctrl | Ctrl-button state of the shortcut. |
Definition at line 201 of file KeyboardShortcut.cc.
Referenced by KeyboardShortcutDialog::onCharEvent().
void KeyboardShortcut::setFKey | ( | int | fKey | ) |
Sets the function key of the keyboard shortcut. Set as 0 if the shortcut doesn't use function key.
key | Function key of the shortcut. |
Definition at line 233 of file KeyboardShortcut.cc.
Referenced by KeyboardShortcutDialog::onCharEvent().
void KeyboardShortcut::setKey | ( | char | key | ) |
Sets the character key of the keyboard shortcut.
key | Character key of the shortcut. |
Definition at line 222 of file KeyboardShortcut.cc.
Referenced by KeyboardShortcutDialog::onCharEvent().
|
private |
Name of the action which is performed by the key combination.
Definition at line 93 of file KeyboardShortcut.hh.
Referenced by action(), KeyboardShortcut(), loadState(), and saveState().
|
private |
True if Alt button is used in the key combination.
Definition at line 99 of file KeyboardShortcut.hh.
Referenced by alt(), equals(), KeyboardShortcut(), loadState(), saveState(), and setAlt().
|
private |
True if Ctrl button is used in the key combination.
Definition at line 97 of file KeyboardShortcut.hh.
Referenced by ctrl(), equals(), KeyboardShortcut(), loadState(), saveState(), and setCtrl().
|
private |
Number of the function key if it is used, 0 otherwise.
Definition at line 95 of file KeyboardShortcut.hh.
Referenced by fKey(), KeyboardShortcut(), loadState(), and setFKey().
|
private |
ASCII character of the button used in the key combination, if the key is not used the value is a NUL character (ASCII 0).
Definition at line 104 of file KeyboardShortcut.hh.
Referenced by equals(), key(), KeyboardShortcut(), loadState(), saveState(), and setKey().
|
static |
ObjectState attribute key for action name.
Definition at line 55 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), loadState(), and saveState().
|
static |
ObjectState attribute key for alt key.
Definition at line 61 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), loadState(), and saveState().
|
static |
ObjectState attribute key for ctrl key.
Definition at line 59 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), loadState(), and saveState().
|
static |
ObjectState attribute key for function key number.
Definition at line 57 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), loadState(), and saveState().
|
static |
ObjectState attribute key for normal letter or number key.
Definition at line 63 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), loadState(), and saveState().
|
static |
ObjectState name for keyboard shortcut.
Definition at line 53 of file KeyboardShortcut.hh.
Referenced by GUIOptionsSerializer::addKeyboardShortcut(), GUIOptionsSerializer::convertToConfigFileFormat(), GUIOptions::loadState(), loadState(), and saveState().