Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIEvent.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef GUIEVENT__H_
11#define GUIEVENT__H_
12
13#include "eC_Types.h"
15
17
26{
27public:
31 {
32 ES_NONE = 0x00000000,
35 };
36
41 {
42 GKM_NONE = 0x00000000,
43 GKM_SHIFT = 0x00000001,
44 GKM_CONTROL = 0x00000002,
45 GKM_ALT = 0x00000004,
46 GKM_META = 0x00000008
47 };
48
55 CGUIEvent(EventType_t eType, eC_UInt uiModifiers)
56 : m_eType(eType), m_uiModifiers(uiModifiers)
57 {}
58
60 virtual ~CGUIEvent() {}
61
65 inline EventType_t GetType() const { return m_eType; }
66
70 inline eC_UInt GetModifiers() const { return m_uiModifiers; }
71
72
77 {
78 EventType_t eEventTyp = GetType();
79 if (eEventTyp == ET_KEYDOWN || eEventTyp == ET_KEYUP ||
80 eEventTyp == ET_CHAR || eEventTyp == ET_HOTKEYDOWN ||
81 eEventTyp == ET_HOTKEYUP)
82 {
83 return ES_KEYBOARD;
84 }
85 if (eEventTyp == ET_LBUTTONDOWN || eEventTyp == ET_LBUTTONUP ||
86 eEventTyp == ET_RBUTTONDOWN || eEventTyp == ET_RBUTTONUP ||
87 eEventTyp == ET_MOUSEMOVE || eEventTyp == ET_MOUSEWHEEL)
88 {
89 return ES_MOUSE;
90 }
91
92 return ES_NONE;
93 }
94
95private:
97 CGUIEvent();
98
100 EventType_t m_eType;
101
103 eC_UInt m_uiModifiers;
104};
105
107
113 : public CGUIEvent
114{
115public:
122 CGUIKeyboardEvent(EventType_t eType, eC_UInt uiKey, GUIKeyIdentifier_t eKeyIdentifier, eC_UInt uiModifiers = 0)
123 : CGUIEvent(eType, uiModifiers), m_uiKey(uiKey), m_eKeyIdentifier(eKeyIdentifier)
124 {
125 }
126
128
132 inline eC_UInt GetKeyContent() const { return m_uiKey; }
133
137 inline GUIKeyIdentifier_t GetKeyIdentifier() const { return m_eKeyIdentifier; }
138
139private:
142
144 eC_UInt m_uiKey;
145
147 GUIKeyIdentifier_t m_eKeyIdentifier;
148};
149
151
158 : public CGUIEvent
159{
162
164 eC_Int m_iX;
165 eC_Int m_iY;
166
168 eC_Bool m_bLeftButtonPressed;
170 eC_Bool m_bRightButtonPressed;
171
172 // The mousewheel delta.
173 eC_Value m_vWheelDelta;
174
175public:
185 CGUIMouseEvent(EventType_t eType, eC_Int iX=0, eC_Int iY=0,
186 eC_Bool bLeftButton=false, eC_Bool bRightButton=false, eC_UInt uiModifiers = 0,
187 eC_Value vWheelDelta = 0)
188 : CGUIEvent(eType, uiModifiers), m_iX(iX), m_iY(iY),
189 m_bLeftButtonPressed(bLeftButton), m_bRightButtonPressed(bRightButton),
190 m_vWheelDelta(vWheelDelta)
191 {
192 }
193
194 ~CGUIMouseEvent() {}
198 inline eC_Int GetX() const { return m_iX; }
202 inline eC_Int GetY() const { return m_iY; }
203
210 inline eC_Value GetWheelDelta() const { return m_vWheelDelta; }
211
215 inline eC_Bool IsLeftButtonPressed () const { return m_bLeftButtonPressed; }
216
220 inline eC_Bool IsRightButtonPressed () const { return m_bRightButtonPressed; }
221};
222
223#endif
EventType_t
List of event type ids.
Definition: GUIEventTypeResource.h:63
@ ET_KEYDOWN
Definition: GUIEventTypeResource.h:66
@ ET_LBUTTONUP
Definition: GUIEventTypeResource.h:66
@ ET_MOUSEWHEEL
Definition: GUIEventTypeResource.h:66
@ ET_RBUTTONDOWN
Definition: GUIEventTypeResource.h:66
@ ET_HOTKEYUP
Definition: GUIEventTypeResource.h:66
@ ET_MOUSEMOVE
Definition: GUIEventTypeResource.h:66
@ ET_KEYUP
Definition: GUIEventTypeResource.h:66
@ ET_RBUTTONUP
Definition: GUIEventTypeResource.h:66
@ ET_HOTKEYDOWN
Definition: GUIEventTypeResource.h:66
@ ET_LBUTTONDOWN
Definition: GUIEventTypeResource.h:66
@ ET_CHAR
Definition: GUIEventTypeResource.h:66
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:205
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Modifier_t
Definition: GUIEvent.h:41
@ GKM_SHIFT
Shift key.
Definition: GUIEvent.h:43
@ GKM_ALT
Alt key.
Definition: GUIEvent.h:45
@ GKM_META
Additional modifier, depends on CGUIInputMedia implementation.
Definition: GUIEvent.h:46
@ GKM_CONTROL
Control key.
Definition: GUIEvent.h:44
@ GKM_NONE
No Modifier.
Definition: GUIEvent.h:42
EventSource_t
Definition: GUIEvent.h:31
@ ES_NONE
Class of event unknown.
Definition: GUIEvent.h:32
@ ES_MOUSE
Class of event is mous event.
Definition: GUIEvent.h:34
@ ES_KEYBOARD
Class of event is keyboard event.
Definition: GUIEvent.h:33
CGUIEvent(EventType_t eType, eC_UInt uiModifiers)
Definition: GUIEvent.h:55
EventSource_t GetEventSource() const
Definition: GUIEvent.h:76
EventType_t GetType() const
Definition: GUIEvent.h:65
virtual ~CGUIEvent()
Destructor.
Definition: GUIEvent.h:60
eC_UInt GetModifiers() const
Definition: GUIEvent.h:70
Represents platform-independent keyboard events.
Definition: GUIEvent.h:114
CGUIKeyboardEvent(EventType_t eType, eC_UInt uiKey, GUIKeyIdentifier_t eKeyIdentifier, eC_UInt uiModifiers=0)
Definition: GUIEvent.h:122
GUIKeyIdentifier_t GetKeyIdentifier() const
Definition: GUIEvent.h:137
eC_UInt GetKeyContent() const
Definition: GUIEvent.h:132
Represents platform-independent mouse events.
Definition: GUIEvent.h:159
eC_Value GetWheelDelta() const
Definition: GUIEvent.h:210
eC_Bool IsLeftButtonPressed() const
Definition: GUIEvent.h:215
eC_Int GetY() const
Definition: GUIEvent.h:202
CGUIMouseEvent(EventType_t eType, eC_Int iX=0, eC_Int iY=0, eC_Bool bLeftButton=false, eC_Bool bRightButton=false, eC_UInt uiModifiers=0, eC_Value vWheelDelta=0)
Definition: GUIEvent.h:185
eC_Int GetX() const
Definition: GUIEvent.h:198
eC_Bool IsRightButtonPressed() const
Definition: GUIEvent.h:220