UiKeyCombination Class Reference
[User interfaceSingle inited classes]

This class handles events on key cominations. More...

#include <uikeycombination.h>

Collaboration diagram for UiKeyCombination:

Collaboration graph
[legend]
List of all members.

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 UiKeyCombinationgetThe ()

Static Public Attributes

static UiKeyCombinationthe

Classes

struct  KeyComb

Detailed Description

This class handles events on key cominations.

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.

See also:
UiManager


Member Function Documentation

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" />
(You can leave away either OnPress or OnRelease, if you do not want to handle the event)
Parameters:
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

Parameters:
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
Note:
if a combination with k and m already exists, it will be overwritten

bool UiKeyCombination::removeCombination ( SDLKey  k,
SDLMod  m 
)

Removes a combination from the list.

Parameters:
k the key, that is part of the combination
m the modify key, that is part of the combination
Returns:
true, if the combination was found and removed; otherwise false

void UiKeyCombination::removeAll (  ) 

Removes all key combinations from the list.

See also:
removeCombination()

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.

Parameters:
k the key
m the modifier
Returns:
true, if the combination was in the list; otherwise false

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.

Parameters:
k the key
m the modifier
Returns:
true, if the combination was in the list; otherwise false

UiKeyCombination * UiKeyCombination::getThe (  )  [static]

Returns:
a pointer to the UiKeyCombination-variable, or NULL if not initialized. (There is only one UiKeyCombination-variable allowed in an application)
Every netrinjo-class that can only exist once at a time, has this static function.
See also:
Single inited classes


Member Data Documentation

UiKeyCombination * UiKeyCombination::the [static]

Not accessible in Windows (dynamic linking), equals the result of getThe()


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:36 2007 for netrinjo by  doxygen 1.5.1