scim
1.4.18
|
This class is used to match a KeyEvent among a set of hotkeys. More...
#include <scim_hotkey.h>
Public Member Functions | |
HotkeyMatcher () | |
Constructor. More... | |
~HotkeyMatcher () | |
Destructor. More... | |
void | add_hotkey (const KeyEvent &key, int id) |
Add a Hotkey into this HotkeyMatcher. More... | |
void | add_hotkeys (const KeyEventList &keys, int id) |
Add a set of Hotkeys into this HotkeyMatcher. More... | |
size_t | find_hotkeys (int id, KeyEventList &keys) const |
Find all Hotkeys binded to a specific id. More... | |
size_t | get_all_hotkeys (KeyEventList &keys, std::vector< int > &ids) const |
Get all Hotkeys added into this HotkeyMatcher. More... | |
void | reset (void) |
Reset the HotkeyMatcher. More... | |
void | clear (void) |
Clear all Hotkeys. More... | |
void | push_key_event (const KeyEvent &key) |
Push a KeyEvent into the queue. More... | |
bool | is_matched (void) const |
Check if the last KeyEvent pushed by push_key_event () matched with any Hotkey. More... | |
int | get_match_result (void) const |
Get the match result. More... | |
This class is used to match a KeyEvent among a set of hotkeys.
This class keeps the key event history so that it can match any kind of key events, including key release events, correctly.
If there are large amount of hotkeys to be matched, this class can provide very good performance.
scim::HotkeyMatcher::HotkeyMatcher | ( | ) |
Constructor.
scim::HotkeyMatcher::~HotkeyMatcher | ( | ) |
Destructor.
void scim::HotkeyMatcher::add_hotkey | ( | const KeyEvent & | key, |
int | id | ||
) |
Add a Hotkey into this HotkeyMatcher.
If a same Hotkey was already added, then it'll be replaced by this new one.
key | A Hotkey to be added. |
id | An id to be binded to this Hotkey. |
void scim::HotkeyMatcher::add_hotkeys | ( | const KeyEventList & | keys, |
int | id | ||
) |
Add a set of Hotkeys into this HotkeyMatcher.
If a same Hotkey in the list was already added, then it'll be replaced by the new one.
keys | A set of Hotkeys to be added. |
id | An id to be binded to these Hotkeys. |
size_t scim::HotkeyMatcher::find_hotkeys | ( | int | id, |
KeyEventList & | keys | ||
) | const |
Find all Hotkeys binded to a specific id.
id | The id to be found. |
keys | A KeyEventList object to hold all KeyEvents binded to the id. |
size_t scim::HotkeyMatcher::get_all_hotkeys | ( | KeyEventList & | keys, |
std::vector< int > & | ids | ||
) | const |
Get all Hotkeys added into this HotkeyMatcher.
keys | A KeyEventList object to hold all KeyEvents. |
ids | A int list to hold all corresponding IDs. |
void scim::HotkeyMatcher::reset | ( | void | ) |
Reset the HotkeyMatcher.
The KeyEvent queue will be cleared, all state will be reset. The Hotkeys which were already added will not be touched.
void scim::HotkeyMatcher::clear | ( | void | ) |
Clear all Hotkeys.
void scim::HotkeyMatcher::push_key_event | ( | const KeyEvent & | key | ) |
bool scim::HotkeyMatcher::is_matched | ( | void | ) | const |
int scim::HotkeyMatcher::get_match_result | ( | void | ) | const |
Get the match result.