Maps key codes to object IDs and 'clicks' on objects. More...
#include <GUIHotkeysBehaviour.h>
Classes | |
struct | HotKeyMap_t |
Definition of one hot key mapping with all necessary parameters. More... | |
Public Member Functions | |
CGUIHotkeysBehaviour (const CGUIHotkeysBehaviour &kSource) | |
CGUIHotkeysBehaviour (eC_Bool bMarkAlwaysAsHandled=false) | |
void | AddHotKeyMap (GUIKeyIdentifier_t eKeyIdentifier, eC_UInt uiModifiers, eC_Bool bCheckForModifiers, ObjectHandle_t eMappedObjID, eC_Bool bAbstractObj, CGUICommandPtr pkCommand=NULL, eC_Bool bActivated=true) |
virtual CGUIBehaviourDecorator * | Clone () const |
eC_Bool | GetHotKey (GUIKeyIdentifier_t &reKeyIdentifier, eC_UInt &ruiModifiers, ObjectHandle_t eMappedObjID) const |
CGUIHotkeysBehaviour & | operator= (const CGUIHotkeysBehaviour &kSource) |
void | ReadFromStream () |
void | SetActivated (GUIKeyIdentifier_t eKeyContent, eC_UInt uiModifiers, eC_Bool bActivated) |
void | SetMarkAlwaysAsHandled (eC_Bool bMarkAlwaysAsHandled) |
void | SetModifiers (GUIKeyIdentifier_t eKey, eC_UInt uiModifiers, eC_Bool bCheckForModifiers) |
void | WriteToStream (const eC_Bool bWriteClassID=false) |
![]() | |
virtual | ~CGUIBehaviourDecorator () |
virtual CGUIBehaviourDecorator * | Clone () const |
virtual eC_Bool | IsCompositeBehaviour () const |
![]() | |
virtual eC_Bool | DoScale (const eC_Value &vDelta) |
virtual eC_Bool | DoUserEvent (CGUIEvent *const pEvent) |
virtual void | OnCreate () |
virtual void | OnDataPool (const DataPoolResource_t &eID) |
virtual void | OnDelete () |
virtual void | OnHide () |
virtual void | OnShow () |
virtual eC_Bool | DoClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoLongClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoDoubleClick (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoButtonDown (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoButtonUp (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoDrag (const eC_Value &vDeltaX=eC_FromInt(-1), const eC_Value &vDeltaY=eC_FromInt(-1), const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoDragEnd (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoMouseEnter (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoMouseLeave (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | DoMouseMove (const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1)) |
virtual eC_Bool | FocusPrevious (CGUIObject *const pRefObj=NULL, const eC_Bool &bSubTreeOfRefObjDone=false) |
virtual eC_Bool | FocusNext (CGUIObject *const pRefObj=NULL, const eC_Bool &bSubTreeOfRefObjDone=false) |
virtual void | GetFocus () |
virtual void | LoseFocus () |
virtual eC_Bool | Decrease () |
virtual eC_Bool | Increase () |
virtual eC_Bool | DoChar (const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers) |
virtual eC_Bool | DoScroll (const eC_Value &vAbsX, const eC_Value &vAbsY, const eC_Value &vDelta, const eC_Bool &bModifierActive) |
![]() | |
const eC_String & | GetXMLTag () const |
virtual void | ReadFromStream () |
void | SetXMLTag (const eC_String &kXMLTag) |
virtual void | WriteToStream (const eC_Bool bWriteClassID=false) |
Protected Member Functions | |
virtual eC_Bool | DoKeyDown (const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers) |
virtual eC_Bool | DoKeyUp (const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers) |
![]() | |
CGUIBehaviourDecorator (CGUIObject *const pkObject=NULL) | |
CGUIBehaviourDecorator (const CGUIBehaviourDecorator &kSource) | |
virtual void | AssociatedObjectChanges (CGUIObject *const pkNewAssociatedObject) |
CGUIObject * | GetAssociatedObject () const |
![]() | |
eC_UInt | ReadStreamingHeader (const eC_UInt &uiClassVersion, const eC_UInt &uiClassMinVersion=0) const |
void | WriteStreamingFooter (const eC_Bool &bWriteClassID) const |
void | WriteStreamingHeader (const eC_Bool &bWriteClassID, const eC_Char *const pkClassIDTag, const eC_Int &iClassID, const eC_UInt &uiClassVersion) const |
Protected Attributes | |
eC_TListDoubleLinked< HotKeyMap_t > | m_kHotKeyMapList |
The hot key mappings are saved in this list. | |
Additional Inherited Members | |
![]() | |
static UUID_t | GenerateUUID () |
![]() | |
static const eC_Char | XMLTAG_BEHAVIOURCLASSID [] |
XML tag to be used when writing a behaviour class ID into a stream. | |
static const eC_Char | XMLTAG_BEHAVIOURCOUNT [] |
XML tag for count. | |
![]() | |
static const eC_Char | XMLTAG_CLASSVERSION [] |
Maps key codes to object IDs and 'clicks' on objects.
This behaviour maintains a list that maps key codes (hot keys) to object IDs or commands. Whenever one of the key codes is received in an ET_KEYDOWN event in DoKeyDown(), this behaviour searches the object it is attached to for the corresponding object ID and, if found, checks for an attached behaviour decorator. If one is there, its DoClick method is called; if there is none, the object's own DoClick method is called.
Additionally, in case of a hotkey match, an optional CGUICommand is executed, which is assigned to the hotkey also.
Objects of this behaviour class must be attached to a composite object. Otherwise an exeception is thrown.
The following example demonstrates the use of this behaviour:
If a hotkey behaviour has a command that is executed, the event slots always return true, i.e. no other objects are invoked to handle the pressed key.
CGUIHotkeysBehaviour::CGUIHotkeysBehaviour | ( | eC_Bool | bMarkAlwaysAsHandled = false | ) |
Constructor.
bMarkAlwaysAsHandled | If true the behaviour will always return false after an event has been handled. |
CGUIHotkeysBehaviour::CGUIHotkeysBehaviour | ( | const CGUIHotkeysBehaviour & | kSource | ) |
Copy-constructor of the CGUIHotkeysBehaviour class.
kSource | Source object to be copied. |
void CGUIHotkeysBehaviour::AddHotKeyMap | ( | GUIKeyIdentifier_t | eKeyIdentifier, |
eC_UInt | uiModifiers, | ||
eC_Bool | bCheckForModifiers, | ||
ObjectHandle_t | eMappedObjID, | ||
eC_Bool | bAbstractObj, | ||
CGUICommandPtr | pkCommand = NULL , |
||
eC_Bool | bActivated = true |
||
) |
Adds a key mapping to the list of hot keys.
eKeyIdentifier | Hotkey identifier to be mapped. |
uiModifiers | Which modifier is to consider (CTRL, ALT, etc.) |
bCheckForModifiers | Should the modifier be considered while evaluating the hotkey event? |
eMappedObjID | Object ID of the object whose DoClick method may be called when the key code uiKeyContent is received in an ET_KEYDOWN event. |
bAbstractObj | Indicate whether the object is abstract or not. A button which is visible in the GUI is not abstract object. If the object is an abstract object, the DoClick method will be executed at once if the hot key was pressed. Otherwise the object will first be checked whether it is clickable (CGUIObject::IsClickable). |
pkCommand | (optional) This command will be executed additionally if the hotkey event occurres. This command is not written to streaming files by WriteToStream(). |
bActivated | (optional) Is the hotkey activated, i.e. should events associated with the hotkey be handled. |
|
virtual |
Creates an exact copy of this behaviour. Should be re-implemented by each derived class to return the correct type of behaviour.
Reimplemented from CGUIBehaviourDecorator.
|
protectedvirtual |
If an ET_KEYDOWN with one of the added key codes is received, the mapped object's DoClick method is called.
eKeyIdentifier | The key identifier of the pressed key. |
uiModifiers | Whether a modifier key is pressed (Ctrl, ALT, etc.). |
Reimplemented from CGUIBehaviour.
|
protectedvirtual |
If an ET_KEYUP with one of the added key codes is received, the mapped object's DoKeyUp method is called.
eKeyIdentifier | The key identifier of the released key. |
uiModifiers | Whether a modifier key is pressed (Ctrl, ALT, etc.). |
Reimplemented from CGUIBehaviour.
eC_Bool CGUIHotkeysBehaviour::GetHotKey | ( | GUIKeyIdentifier_t & | reKeyIdentifier, |
eC_UInt & | ruiModifiers, | ||
ObjectHandle_t | eMappedObjID | ||
) | const |
Find first occurrence of a hotkey mapping to an object.
reKeyIdentifier | [out] If a hot assigned to eMappedObjID is found, the key value is returned here. |
ruiModifiers | [out] If a hot assigned to eMappedObjID is found, the modifier is returned here. |
eMappedObjID | Find the hotkey assigned to this object. |
CGUIHotkeysBehaviour & CGUIHotkeysBehaviour::operator= | ( | const CGUIHotkeysBehaviour & | kSource | ) |
Operator= method of the CGUIHotkeysBehaviour class.
kSource | Source object to be copied. |
|
virtual |
Reads attributes from the streaming file. Only for use with GUIFactoryManager.
Reimplemented from CGUIStreamableObject.
void CGUIHotkeysBehaviour::SetActivated | ( | GUIKeyIdentifier_t | eKeyContent, |
eC_UInt | uiModifiers, | ||
eC_Bool | bActivated | ||
) |
Whether the hotkey is activated or not. A deactivated hotkey does not handle the specific hotkey events.
eKeyContent | The hotkey that is to activate or deactivate. |
uiModifiers | The modifier corresponding to the hotkey. |
bActivated | Set true to activate the hotkey or false to deactivate it. |
void CGUIHotkeysBehaviour::SetMarkAlwaysAsHandled | ( | eC_Bool | bMarkAlwaysAsHandled | ) |
Sets the flag deciding if the slots should always return true or not.
bMarkAlwaysAsHandled | If true, the behaviour will always return true when an hotkey event is handled. If false, the behaviour will return the value that is returned by the called object or its attached behaviour. |
void CGUIHotkeysBehaviour::SetModifiers | ( | GUIKeyIdentifier_t | eKey, |
eC_UInt | uiModifiers, | ||
eC_Bool | bCheckForModifiers | ||
) |
Sets the given modifier and the flag whether the modifiers should be checked or not for given key event.
eKey | The key identifier. |
uiModifiers | The modifier to set this hotkey should handle. |
bCheckForModifiers | Should modifiers be considered while evaluating a hotkey event? |
|
virtual |
Writes attributes to the streaming file. A CGUIStreamWriter has to be initialized.
bWriteClassID | This flag is used to switch writing of the class ID, leading and trailing tags. When implementing a new streamable object, check this flag. If it is true, first write the class ID, then continue with this object's attributes, and finally call the base class implementation with this flag set to false (this is the default). |
Reimplemented from CGUIStreamableObject.