Guiliani  Version 2.6 revision 7293 (documentation build 12)
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(const EventType_t& eType, const eC_UInt& uiModifiers) :
56 m_eType(eType),
57 m_uiModifiers(uiModifiers)
58 {
59 }
60
62 virtual ~CGUIEvent() {}
63
67 inline EventType_t GetType() const
68 {
69 return m_eType;
70 }
71
75 inline eC_UInt GetModifiers() const
76 {
77 return m_uiModifiers;
78 }
79
84 {
85 EventType_t eEventType = GetType();
86 if (eEventType == ET_KEYDOWN || eEventType == ET_KEYUP ||
87 eEventType == ET_CHAR || eEventType == ET_HOTKEYDOWN ||
88 eEventType == ET_HOTKEYUP)
89 {
90 return ES_KEYBOARD;
91 }
92
93 if (eEventType == ET_LBUTTONDOWN || eEventType == ET_LBUTTONUP ||
94 eEventType == ET_RBUTTONDOWN || eEventType == ET_RBUTTONUP ||
95 eEventType == ET_MOUSEMOVE || eEventType == ET_MOUSEWHEEL)
96 {
97 return ES_MOUSE;
98 }
99
100 return ES_NONE;
101 }
102
103private:
105 CGUIEvent();
106
108 EventType_t m_eType;
109
111 eC_UInt m_uiModifiers;
112};
113
115
121{
122public:
130 const EventType_t& eType,
131 const eC_UInt& uiKey,
132 const GUIKeyIdentifier_t& eKeyIdentifier,
133 const eC_UInt& uiModifiers = 0) :
134 CGUIEvent(eType, uiModifiers),
135 m_uiKey(uiKey),
136 m_eKeyIdentifier(eKeyIdentifier)
137 {
138 }
139
141
145 inline eC_UInt GetKeyContent() const
146 {
147 return m_uiKey;
148 }
149
154 {
155 return m_eKeyIdentifier;
156 }
157
158private:
161
163 eC_UInt m_uiKey;
164
166 GUIKeyIdentifier_t m_eKeyIdentifier;
167};
168
170
177{
178public:
189 const EventType_t& eType,
190 const eC_Int& iX = 0,
191 const eC_Int& iY = 0,
192 const eC_Bool& bLeftButton = false,
193 const eC_Bool& bRightButton = false,
194 const eC_UInt& uiModifiers = 0,
195 const eC_Value& vWheelDelta = 0) :
196 CGUIEvent(eType, uiModifiers),
197 m_iX(iX),
198 m_iY(iY),
199 m_bLeftButtonPressed(bLeftButton),
200 m_bRightButtonPressed(bRightButton),
201 m_vWheelDelta(vWheelDelta)
202 {
203 }
204
205 ~CGUIMouseEvent() {}
206
210 inline eC_Int GetX() const
211 {
212 return m_iX;
213 }
214
218 inline eC_Int GetY() const
219 {
220 return m_iY;
221 }
222
229 inline eC_Value GetWheelDelta() const
230 {
231 return m_vWheelDelta;
232 }
233
237 inline eC_Bool IsLeftButtonPressed() const
238 {
239 return m_bLeftButtonPressed;
240 }
241
245 inline eC_Bool IsRightButtonPressed() const
246 {
247 return m_bRightButtonPressed;
248 }
249
250private:
253
254private:
256 eC_Int m_iX;
257 eC_Int m_iY;
258
260 eC_Bool m_bLeftButtonPressed;
262 eC_Bool m_bRightButtonPressed;
263
264 // The mousewheel delta.
265 eC_Value m_vWheelDelta;
266};
267
268#endif
EventType_t
List of event type ids.
Definition: GUIEventTypeResource.h:65
@ ET_KEYDOWN
Definition: GUIEventTypeResource.h:68
@ ET_LBUTTONUP
Definition: GUIEventTypeResource.h:68
@ ET_MOUSEWHEEL
Definition: GUIEventTypeResource.h:68
@ ET_RBUTTONDOWN
Definition: GUIEventTypeResource.h:68
@ ET_HOTKEYUP
Definition: GUIEventTypeResource.h:68
@ ET_MOUSEMOVE
Definition: GUIEventTypeResource.h:68
@ ET_KEYUP
Definition: GUIEventTypeResource.h:68
@ ET_RBUTTONUP
Definition: GUIEventTypeResource.h:68
@ ET_HOTKEYDOWN
Definition: GUIEventTypeResource.h:68
@ ET_LBUTTONDOWN
Definition: GUIEventTypeResource.h:68
@ ET_CHAR
Definition: GUIEventTypeResource.h:68
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:207
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 mouse event.
Definition: GUIEvent.h:34
@ ES_KEYBOARD
Class of event is keyboard event.
Definition: GUIEvent.h:33
EventSource_t GetEventSource() const
Definition: GUIEvent.h:83
EventType_t GetType() const
Definition: GUIEvent.h:67
CGUIEvent(const EventType_t &eType, const eC_UInt &uiModifiers)
Definition: GUIEvent.h:55
virtual ~CGUIEvent()
Destructor.
Definition: GUIEvent.h:62
eC_UInt GetModifiers() const
Definition: GUIEvent.h:75
Represents platform-independent keyboard events.
Definition: GUIEvent.h:121
CGUIKeyboardEvent(const EventType_t &eType, const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers=0)
Definition: GUIEvent.h:129
GUIKeyIdentifier_t GetKeyIdentifier() const
Definition: GUIEvent.h:153
eC_UInt GetKeyContent() const
Definition: GUIEvent.h:145
Represents platform-independent mouse events.
Definition: GUIEvent.h:177
eC_Value GetWheelDelta() const
Definition: GUIEvent.h:229
eC_Bool IsLeftButtonPressed() const
Definition: GUIEvent.h:237
CGUIMouseEvent(const EventType_t &eType, const eC_Int &iX=0, const eC_Int &iY=0, const eC_Bool &bLeftButton=false, const eC_Bool &bRightButton=false, const eC_UInt &uiModifiers=0, const eC_Value &vWheelDelta=0)
Definition: GUIEvent.h:188
eC_Int GetY() const
Definition: GUIEvent.h:218
eC_Int GetX() const
Definition: GUIEvent.h:210
eC_Bool IsRightButtonPressed() const
Definition: GUIEvent.h:245