#include <uikeycombination.h>
Collaboration diagram for UiKeyCombination:

Public Member Functions | |
| DECLSPEC void | init (TiXmlElement *el) |
| DECLSPEC void | addCombination (SDLKey k, SDLMod m, BasicObject *aim_p, BasicObject::Callback p, BasicObject *aim_r=NULL, BasicObject::Callback r=NULL) |
| DECLSPEC bool | removeCombination (SDLKey k, SDLMod m) |
| DECLSPEC void | removeAll () |
| DECLSPEC bool | keyPressed (SDLKey k, SDLMod m) |
| DECLSPEC bool | keyReleased (SDLKey k, SDLMod m) |
Static Public Member Functions | |
| static DECLSPEC UiKeyCombination * | getThe () |
Static Public Attributes | |
| static UiKeyCombination * | the |
Classes | |
| struct | KeyComb |
This class handles key combinations, pressed by the user on the keyboard and calls a function, if the keys are equal to a specified combination. Each combination consists of a usual key and a modifier like Ctrl, Alt, Shift... (Alt or Ctrl has to be in it)
This class can only be used in one variable at a time and is created with UiManager. So do not create yet another.
| void UiKeyCombination::init | ( | TiXmlElement * | el | ) |
Adds key combinations as specified in the XML element. The XML element's children have to look like this:
<Combi Key="p" Mod="ctrl" OnPress="my.object#photo" OnRelease="my.object#lightning" />
| el | the XML element |
| void UiKeyCombination::addCombination | ( | SDLKey | k, | |
| SDLMod | m, | |||
| BasicObject * | aim_p, | |||
| BasicObject::Callback | p, | |||
| BasicObject * | aim_r = NULL, |
|||
| BasicObject::Callback | r = NULL | |||
| ) |
Adds a key combination to the list that is checked each time a combination is pressed and calls the specified function, if the keys equal k and m
| k | the key, that is part of the combination | |
| m | the modify key, that is the 2nd part of the combination | |
| aim | pointer to the reciever object, this will be the param, that is given to the called function (see BasicObject::Callback) | |
| p | pointer to the function to call, when the combination is pressed down | |
| r | pointer to the function to call, when the combination is released |
| bool UiKeyCombination::removeCombination | ( | SDLKey | k, | |
| SDLMod | m | |||
| ) |
Removes a combination from the list.
| k | the key, that is part of the combination | |
| m | the modify key, that is part of the combination |
| void UiKeyCombination::removeAll | ( | ) |
Removes all key combinations from the list.
| bool UiKeyCombination::keyPressed | ( | SDLKey | k, | |
| SDLMod | m | |||
| ) |
Called from UiManager, when a combination of a key and a modifier is pressed down. So usually you do not need this, but you can use it to simulate a combination.
| k | the key | |
| m | the modifier |
| bool UiKeyCombination::keyReleased | ( | SDLKey | k, | |
| SDLMod | m | |||
| ) |
Called from UiManager, when a combination of a key and a modifier is released. So usually you do not need this, but you can use it to simulate a combination.
| k | the key | |
| m | the modifier |
| UiKeyCombination * UiKeyCombination::getThe | ( | ) | [static] |
UiKeyCombination * UiKeyCombination::the [static] |
Not accessible in Windows (dynamic linking), equals the result of getThe()
1.5.1