#include <scim_hotkey.h>
Public Member Functions | |
HotkeyMatcher () | |
Constructor. | |
~HotkeyMatcher () | |
Destructor. | |
void | add_hotkey (const KeyEvent &key, int id) |
Add a Hotkey into this HotkeyMatcher. | |
void | add_hotkeys (const KeyEventList &keys, int id) |
Add a set of Hotkeys into this HotkeyMatcher. | |
size_t | find_hotkeys (int id, KeyEventList &keys) const |
Find all Hotkeys binded to a specific id. | |
size_t | get_all_hotkeys (KeyEventList &keys, std::vector< int > &ids) const |
Get all Hotkeys added into this HotkeyMatcher. | |
void | reset (void) |
Reset the HotkeyMatcher. | |
void | clear (void) |
Clear all Hotkeys. | |
void | push_key_event (const KeyEvent &key) |
Push a KeyEvent into the queue. | |
bool | is_matched (void) const |
Check if the last KeyEvent pushed by push_key_event () matched with any Hotkey. | |
int | get_match_result (void) const |
Get the match result. |
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.
|
Constructor.
|
|
Destructor.
|
|
Add a Hotkey into this HotkeyMatcher. If a same Hotkey was already added, then it'll be replaced by this new one.
|
|
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.
|
|
Find all Hotkeys binded to a specific id.
|
|
Get all Hotkeys added into this HotkeyMatcher.
|
|
Reset the HotkeyMatcher. The KeyEvent queue will be cleared, all state will be reset. The Hotkeys which were already added will not be touched. |
|
Clear all Hotkeys.
|
|
Push a KeyEvent into the queue. This KeyEvent will be matched against the available Hotkeys immediately.
|
|
Check if the last KeyEvent pushed by push_key_event () matched with any Hotkey.
|
|
Get the match result.
|