TDME2 1.9.121
GUIKeyboardEvent.h
Go to the documentation of this file.
1#pragma once
2
3#include <tdme/tdme.h>
6
7/**
8 * GUI keyboard event
9 * @author Andreas Drewke
10 * @version $Id$
11 */
13{
14public:
15
16 static constexpr int32_t KEYCODE_TAB { KEYBOARD_KEYCODE_TAB };
17 static constexpr int32_t KEYCODE_TAB_SHIFT { KEYBOARD_KEYCODE_TAB_SHIFT };
18 static constexpr int32_t KEYCODE_BACKSPACE { KEYBOARD_KEYCODE_BACKSPACE };
19 static constexpr int32_t KEYCODE_RETURN { KEYBOARD_KEYCODE_RETURN };
20 static constexpr int32_t KEYCODE_DELETE { KEYBOARD_KEYCODE_DELETE };
21 static constexpr int32_t KEYCODE_SPACE { KEYBOARD_KEYCODE_SPACE };
22 static constexpr int32_t KEYCODE_LEFT { KEYBOARD_KEYCODE_LEFT };
23 static constexpr int32_t KEYCODE_UP { KEYBOARD_KEYCODE_UP };
24 static constexpr int32_t KEYCODE_RIGHT { KEYBOARD_KEYCODE_RIGHT };
25 static constexpr int32_t KEYCODE_DOWN { KEYBOARD_KEYCODE_DOWN };
26 static constexpr int32_t KEYCODE_POS1 { KEYBOARD_KEYCODE_POS1 };
27 static constexpr int32_t KEYCODE_END { KEYBOARD_KEYCODE_END };
28 static constexpr int32_t KEYCODE_ESCAPE { KEYBOARD_KEYCODE_ESCAPE };
29 static constexpr int32_t KEYCODE_F1 { KEYBOARD_KEYCODE_F1 };
30 static constexpr int32_t KEYCODE_F2 { KEYBOARD_KEYCODE_F2 };
31 static constexpr int32_t KEYCODE_F3 { KEYBOARD_KEYCODE_F3 };
32 static constexpr int32_t KEYCODE_F4 { KEYBOARD_KEYCODE_F4 };
33 static constexpr int32_t KEYCODE_F5 { KEYBOARD_KEYCODE_F5 };
34 static constexpr int32_t KEYCODE_F6 { KEYBOARD_KEYCODE_F6 };
35 static constexpr int32_t KEYCODE_F7 { KEYBOARD_KEYCODE_F7 };
36 static constexpr int32_t KEYCODE_F8 { KEYBOARD_KEYCODE_F8 };
37 static constexpr int32_t KEYCODE_F9 { KEYBOARD_KEYCODE_F9 };
38 static constexpr int32_t KEYCODE_F10 { KEYBOARD_KEYCODE_F10 };
39 static constexpr int32_t KEYCODE_F11 { KEYBOARD_KEYCODE_F11 };
40 static constexpr int32_t KEYCODE_F12 { KEYBOARD_KEYCODE_F12 };
41 static constexpr int32_t KEYCODE_LEFT_ALT { KEYBOARD_KEYCODE_LEFT_ALT };
43 static constexpr int32_t KEYCODE_LEFT_SHIFT { KEYBOARD_KEYCODE_LEFT_SHIFT };
44 static constexpr int32_t KEYCODE_RIGHT_ALT { KEYBOARD_KEYCODE_RIGHT_ALT };
47
53 };
54
55private:
56 int64_t time;
58 int32_t keyCode;
59 char keyChar;
62 bool altDown;
65
66public:
67 /**
68 * Public constructor
69 */
71
72 /**
73 * Destructor
74 */
76
77 /**
78 * @return time in milliseconds
79 */
80 inline int64_t getTime() {
81 return time;
82 }
83
84 /**
85 * Time in milliseconds
86 * @param time time
87 */
88 inline void setTime(int64_t time) {
89 this->time = time;
90 }
91
92 /**
93 * @return type
94 */
96 return type;
97 }
98
99 /**
100 * Set type
101 * @param type type
102 */
104 this->type = type;
105 }
106
107 /**
108 * @return key code
109 */
110 inline int32_t getKeyCode() {
111 return keyCode;
112 }
113
114 /**
115 * Set key code
116 * @param code code
117 */
118 inline void setKeyCode(int32_t code) {
119 this->keyCode = code;
120 }
121
122 /**
123 * @return key char
124 */
125 inline char getKeyChar() {
126 return keyChar;
127 }
128
129 /**
130 * Set key char
131 * @param keyChar key char
132 */
133 inline void setKeyChar(char keyChar) {
134 this->keyChar = keyChar;
135 }
136
137 /**
138 * @return is meta down
139 */
140 inline bool isMetaDown() {
141 return metaDown;
142 }
143
144 /**
145 * Set meta down
146 * @param metaDown meta down
147 */
148 inline void setMetaDown(bool metaDown) {
149 this->metaDown = metaDown;
150 }
151
152 /**
153 * @return control down
154 */
155 inline bool isControlDown() {
156 return controlDown;
157 }
158
159 /**
160 * Set control down
161 * @param controlDown control down
162 */
163 inline void setControlDown(bool controlDown) {
164 this->controlDown = controlDown;
165 }
166
167 /**
168 * @return is alt down
169 */
170 inline bool isAltDown() {
171 return altDown;
172 }
173
174 /**
175 * Set alt down
176 * @param altDown alt down
177 */
178 inline void setAltDown(bool altDown) {
179 this->altDown = altDown;
180 }
181
182 /**
183 * @return is shift down
184 */
185 inline bool isShiftDown() {
186 return shiftDown;
187 }
188
189 /**
190 * Set shift down
191 * @param shiftDown shiftDown
192 */
193 inline void setShiftDown(bool shiftDown) {
194 this->shiftDown = shiftDown;
195 }
196
197 /**
198 * @return event has been processed already
199 */
200 inline bool isProcessed() {
201 return processed;
202 }
203
204 /**
205 * Set event processed
206 * @param processed processed
207 */
208 inline void setProcessed(bool processed) {
209 this->processed = processed;
210 }
211
212private:
214};
#define KEYBOARD_KEYCODE_POS1
#define KEYBOARD_KEYCODE_RIGHT_CTRL
#define KEYBOARD_KEYCODE_DELETE
#define KEYBOARD_KEYCODE_LEFT
#define KEYBOARD_KEYCODE_F10
#define KEYBOARD_KEYCODE_LEFT_CTRL
#define KEYBOARD_KEYCODE_F6
#define KEYBOARD_KEYCODE_TAB
#define KEYBOARD_KEYCODE_F12
#define KEYBOARD_KEYCODE_LEFT_SHIFT
#define KEYBOARD_KEYCODE_F5
#define KEYBOARD_KEYCODE_F9
#define KEYBOARD_KEYCODE_LEFT_ALT
#define KEYBOARD_KEYCODE_F2
#define KEYBOARD_KEYCODE_F3
#define KEYBOARD_KEYCODE_F7
#define KEYBOARD_KEYCODE_RIGHT
#define KEYBOARD_KEYCODE_SPACE
#define KEYBOARD_KEYCODE_F4
#define KEYBOARD_KEYCODE_ESCAPE
#define KEYBOARD_KEYCODE_DOWN
#define KEYBOARD_KEYCODE_TAB_SHIFT
#define KEYBOARD_KEYCODE_RIGHT_ALT
#define KEYBOARD_KEYCODE_F8
#define KEYBOARD_KEYCODE_RETURN
#define KEYBOARD_KEYCODE_RIGHT_SHIFT
#define KEYBOARD_KEYCODE_F11
#define KEYBOARD_KEYCODE_END
#define KEYBOARD_KEYCODE_UP
#define KEYBOARD_KEYCODE_F1
#define KEYBOARD_KEYCODE_BACKSPACE
static constexpr int32_t KEYCODE_F12
static constexpr int32_t KEYCODE_TAB
static constexpr int32_t KEYCODE_ESCAPE
static constexpr int32_t KEYCODE_F9
static constexpr int32_t KEYCODE_F6
static constexpr int32_t KEYCODE_POS1
static constexpr int32_t KEYCODE_F7
static constexpr int32_t KEYCODE_LEFT
void setKeyCode(int32_t code)
Set key code.
void setAltDown(bool altDown)
Set alt down.
static constexpr int32_t KEYCODE_LEFT_CONTROL
static constexpr int32_t KEYCODE_F5
void setProcessed(bool processed)
Set event processed.
void setType(GUIKeyboardEventType type)
Set type.
void setControlDown(bool controlDown)
Set control down.
static constexpr int32_t KEYCODE_RETURN
static constexpr int32_t KEYCODE_RIGHT_ALT
static constexpr int32_t KEYCODE_DOWN
void setKeyChar(char keyChar)
Set key char.
static constexpr int32_t KEYCODE_LEFT_ALT
static constexpr int32_t KEYCODE_SPACE
static constexpr int32_t KEYCODE_F10
void setTime(int64_t time)
Time in milliseconds.
static constexpr int32_t KEYCODE_END
static constexpr int32_t KEYCODE_BACKSPACE
void setMetaDown(bool metaDown)
Set meta down.
static constexpr int32_t KEYCODE_TAB_SHIFT
static constexpr int32_t KEYCODE_DELETE
static constexpr int32_t KEYCODE_UP
static constexpr int32_t KEYCODE_LEFT_SHIFT
static constexpr int32_t KEYCODE_RIGHT
static constexpr int32_t KEYCODE_F2
static constexpr int32_t KEYCODE_F3
void setShiftDown(bool shiftDown)
Set shift down.
static constexpr int32_t KEYCODE_F4
static constexpr int32_t KEYCODE_RIGHT_SHIFT
static constexpr int32_t KEYCODE_F1
static constexpr int32_t KEYCODE_F8
static constexpr int32_t KEYCODE_RIGHT_CONTROL
static constexpr int32_t KEYCODE_F11