Om
1.0.0
A universal framework for multimedia simulation
|
A class that stores the state of a virtual keyboard input device. More...
#include <omGUIInputKeyboard.h>
Public Member Functions | |
Keyboard () | |
Create a new empty keyboard with no keys. More... | |
Size | getKeyCount () const |
Return the total number of keys that there are for this keyboard. More... | |
const Key * | getKey (KeyCode keyCode) const |
Return a pointer to the key in this keyboard with the specified code. More... | |
const Key * | getNativeKey (KeyCode nativeKeyCode) const |
Return a pointer to the key in this keyboard with the specified native key code. More... | |
void | addKey (const Key &newKey, KeyCode nativeKeyCode, Bool isPressed=false) |
Add a new key to this keyboard with the specified initial state. More... | |
Bool | hasKey (KeyCode keyCode) |
Return whether or not this keyboard contains a key with the specified key code. More... | |
Bool | removeKey (KeyCode keyCode) |
Remove the key with the specified key code from this keyboard. More... | |
void | clearKeys () |
Remove all keys from this keyboard. More... | |
Bool | isPressed (KeyCode keyCode) const |
Return whether or not the key with the specified code is pressed on the keyboard. More... | |
Bool | isPressed (const Key &key) const |
Return whether or not the specified key is pressed on the keyboard. More... | |
void | unpressAll () |
Set the state of all keys in the keyboard to the unpressed state. More... | |
KeyCode | convertNativeCode (KeyCode keyCode) const |
Convert the specified platform-native key code to a generic key code based on this keyboard's mapping. More... | |
KeyCode | convertToNativeCode (KeyCode keyCode) const |
Convert the specified generic key code to a platform-native key code based on this keyboard's mapping. More... | |
void | keyEvent (const KeyEvent &keyEvent) |
Change the state of the keyboard to reflect the specified keyboard event. More... | |
Static Public Member Functions | |
static const Keyboard & | getDefault () |
Return a const reference the default keyboard for the current system platform. More... | |
static void | getDefaultKeys (Keyboard &keybaord) |
Add the default keys to the specified keyboard object for the current system platform. More... | |
A class that stores the state of a virtual keyboard input device.
om::gui::input::Keyboard::Keyboard | ( | ) |
Create a new empty keyboard with no keys.
|
inline |
Return the total number of keys that there are for this keyboard.
Return a pointer to the key in this keyboard with the specified code.
The method returns NULL if there is no key with that code.
Return a pointer to the key in this keyboard with the specified native key code.
This method uses the internal native key code map to convert the key code, then uses the converted key code to find the key with that code. The method returns NULL if there is no key with that native key code.
void om::gui::input::Keyboard::addKey | ( | const Key & | newKey, |
KeyCode | nativeKeyCode, | ||
Bool | isPressed = false |
||
) |
Add a new key to this keyboard with the specified initial state.
If there is already a key with the new key's code in this keyboard, the old key is replaced with the new one. A key code conversion mapping is added for the specified native key code that maps to the given key.
Return whether or not this keyboard contains a key with the specified key code.
Remove the key with the specified key code from this keyboard.
The method returns whether or not the key with that code was able to be removed.
void om::gui::input::Keyboard::clearKeys | ( | ) |
Remove all keys from this keyboard.
Return whether or not the key with the specified code is pressed on the keyboard.
Return whether or not the specified key is pressed on the keyboard.
void om::gui::input::Keyboard::unpressAll | ( | ) |
Set the state of all keys in the keyboard to the unpressed state.
Convert the specified platform-native key code to a generic key code based on this keyboard's mapping.
Convert the specified generic key code to a platform-native key code based on this keyboard's mapping.
void om::gui::input::Keyboard::keyEvent | ( | const KeyEvent & | keyEvent | ) |
Change the state of the keyboard to reflect the specified keyboard event.
|
static |
Return a const reference the default keyboard for the current system platform.
|
static |
Add the default keys to the specified keyboard object for the current system platform.