Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
KeyEvent.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2010-2025 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef GAMP_WTKEYEVENT_HPP_
25#define GAMP_WTKEYEVENT_HPP_
26
27#include <memory>
28#include <string>
29#include <jau/bitfield.hpp>
30#include <jau/cpp_lang_util.hpp>
31#include <jau/enum_util.hpp>
32#include <jau/int_math_ct.hpp>
33#include <jau/fraction_type.hpp>
34#include <jau/string_util.hpp>
35
37
38namespace gamp::wt::event {
39 /** \addtogroup Gamp_WT
40 *
41 * @{
42 */
43
44 /// Virtual key code following UTF16 specification
45 enum class VKeyCode : uint16_t {
46 //
47 // Unicode: Non printable controls: [0x00 - 0x1F]
48 //
49
50 /**
51 * This value, {@value}, is used to indicate that the keyCode is unknown.
52 */
54
55 /// Alias for VK_UNDEFINED
57
58 VK_FREE01 = 0x01u,
59
60 /** Constant for the HOME function key. ASCII: Start Of Text. */
61 VK_HOME = 0x02u,
62
63 /** Constant for the END function key. ASCII: End Of Text. */
64 VK_END = 0x03u,
65
66 /** Constant for the END function key. ASCII: End Of Transmission. */
67 VK_FINAL = 0x04u,
68
69 /** Constant for the PRINT function key. ASCII: Enquiry. */
71
72 VK_FREE06 = 0x06u,
73 VK_FREE07 = 0x07u,
74
75 /** Constant for the BACK SPACE key "\b"u, matching ASCII. Printable! */
77
78 /** Constant for the HORIZ TAB key "\t"u, matching ASCII. Printable! */
79 VK_TAB = 0x09u,
80
81 /** LINE_FEED "\n"u, matching ASCIIu, n/a on keyboard. */
82 VK_LINEFEED = 0x0Au,
83
84 /** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */
85 VK_PAGE_DOWN = 0x0Bu,
86
87 /** Constant for the CLEAR keyu, i.e. FORM FEEDu, matching ASCII. */
88 VK_CLEAR = 0x0Cu,
89
90 /** Constant for the ENTER keyu, i.e. CARRIAGE RETURNu, matching ASCII. Printable! */
91 VK_ENTER = 0x0Du,
92
93 VK_FREE0E = 0x0Eu,
94
95 /** Constant for the SHIFT function key. ASCII: shift-in. */
96 VK_SHIFT = 0x0Fu,
97
98 /** Constant for the PAGE UP function key. ASCII: Data Link Escape. */
99 VK_PAGE_UP = 0x10u,
100
101 /** Constant for the CTRL function key. ASCII: device-ctrl-one. */
102 VK_CONTROL = 0x11u,
103
104 /** Constant for the ALT function key. ASCII: device-ctrl-two. */
105 VK_ALT = 0x12u,
106
107 VK_FREE13 = 0x13u,
108
109 /** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */
111
112 VK_FREE15 = 0x15u,
113
114 /** Constant for the PAUSE function key. ASCII: sync-idle. */
115 VK_PAUSE = 0x16u,
116
117 /** <b>scroll lock</b> key. ASCII: End Of Transmission Block. */
119
120 /** Constant for the CANCEL function key. ASCII: Cancel. */
121 VK_CANCEL = 0x18u,
122
123 VK_FREE19 = 0x19u,
124
125 /** Constant for the INSERT function key. ASCII: Substitute. */
126 VK_INSERT = 0x1Au,
127
128 /** Constant for the ESCAPE function key. ASCII: Escape. */
129 VK_ESCAPE = 0x1Bu,
130
131 /** Constant for the Convert function keyu, Japanese "henkan". ASCII: File Separator. */
132 VK_CONVERT = 0x1Cu,
133
134 /** Constant for the Don't Convert function keyu, Japanese "muhenkan". ASCII: Group Separator.*/
136
137 /** Constant for the Accept or Commit function keyu, Japanese "kakutei". ASCII: Record Separator.*/
138 VK_ACCEPT = 0x1Eu,
139
140 /** Constant for the Mode Change (?). ASCII: Unit Separator.*/
142
143 //
144 // Unicode: Printable [0x20 - 0x7E]
145 // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78]u, used for keyCode/keySym Fn function keys
146 //
147
148 /** Constant for the SPACE function key. ASCII: SPACE. */
149 VK_SPACE = 0x20u,
150
151 /** Constant for the "!" key. */
153
154 /** Constant for the """ key. */
155 VK_QUOTEDBL = 0x22u,
156
157 /** Constant for the "#" key. */
159
160 /** Constant for the "$" key. */
161 VK_DOLLAR = 0x24u,
162
163 /** Constant for the "%" key. */
164 VK_PERCENT = 0x25u,
165
166 /** Constant for the "&" key. */
168
169 /** Constant for the "'" key. */
170 VK_QUOTE = 0x27u,
171
172 /** Constant for the "(" key. */
174
175 /** Constant for the ")" key. */
177
178 /** Constant for the "*" key */
179 VK_ASTERISK = 0x2Au,
180
181 /** Constant for the "+" key. */
182 VK_PLUS = 0x2Bu,
183
184 /** Constant for the comma keyu, "u," */
185 VK_COMMA = 0x2Cu,
186
187 /** Constant for the minus keyu, "-" */
188 VK_MINUS = 0x2Du,
189
190 /** Constant for the period keyu, "." */
191 VK_PERIOD = 0x2Eu,
192
193 /** Constant for the forward slash keyu, "/" */
194 VK_SLASH = 0x2Fu,
195
196 /** VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39] */
197 VK_0 = 0x30u,
198 /** See {@link #VK_0}. */
199 VK_1 = 0x31u,
200 /** See {@link #VK_0}. */
201 VK_2 = 0x32u,
202 /** See {@link #VK_0}. */
203 VK_3 = 0x33u,
204 /** See {@link #VK_0}. */
205 VK_4 = 0x34u,
206 /** See {@link #VK_0}. */
207 VK_5 = 0x35u,
208 /** See {@link #VK_0}. */
209 VK_6 = 0x36u,
210 /** See {@link #VK_0}. */
211 VK_7 = 0x37u,
212 /** See {@link #VK_0}. */
213 VK_8 = 0x38u,
214 /** See {@link #VK_0}. */
215 VK_9 = 0x39u,
216
217 /** Constant for the ":" key. */
218 VK_COLON = 0x3Au,
219
220 /** Constant for the semicolon keyu, "u," */
222
223 /** Constant for the equals keyu, "<" */
224 VK_LESS = 0x3Cu,
225
226 /** Constant for the equals keyu, "=" */
227 VK_EQUALS = 0x3Du,
228
229 /** Constant for the equals keyu, ">" */
230 VK_GREATER = 0x3Eu,
231
232 /** Constant for the equals keyu, "?" */
234
235 /** Constant for the equals keyu, "@" */
236 VK_AT = 0x40u,
237
238 /** VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A) */
239 VK_A = 0x41u,
240 /** See {@link #VK_A}. */
241 VK_B = 0x42u,
242 /** See {@link #VK_A}. */
243 VK_C = 0x43u,
244 /** See {@link #VK_A}. */
245 VK_D = 0x44u,
246 /** See {@link #VK_A}. */
247 VK_E = 0x45u,
248 /** See {@link #VK_A}. */
249 VK_F = 0x46u,
250 /** See {@link #VK_A}. */
251 VK_G = 0x47u,
252 /** See {@link #VK_A}. */
253 VK_H = 0x48u,
254 /** See {@link #VK_A}. */
255 VK_I = 0x49u,
256 /** See {@link #VK_A}. */
257 VK_J = 0x4Au,
258 /** See {@link #VK_A}. */
259 VK_K = 0x4Bu,
260 /** See {@link #VK_A}. */
261 VK_L = 0x4Cu,
262 /** See {@link #VK_A}. */
263 VK_M = 0x4Du,
264 /** See {@link #VK_A}. */
265 VK_N = 0x4Eu,
266 /** See {@link #VK_A}. */
267 VK_O = 0x4Fu,
268 /** See {@link #VK_A}. */
269 VK_P = 0x50u,
270 /** See {@link #VK_A}. */
271 VK_Q = 0x51u,
272 /** See {@link #VK_A}. */
273 VK_R = 0x52u,
274 /** See {@link #VK_A}. */
275 VK_S = 0x53u,
276 /** See {@link #VK_A}. */
277 VK_T = 0x54u,
278 /** See {@link #VK_A}. */
279 VK_U = 0x55u,
280 /** See {@link #VK_A}. */
281 VK_V = 0x56u,
282 /** See {@link #VK_A}. */
283 VK_W = 0x57u,
284 /** See {@link #VK_A}. */
285 VK_X = 0x58u,
286 /** See {@link #VK_A}. */
287 VK_Y = 0x59u,
288 /** See {@link #VK_A}. */
289 VK_Z = 0x5Au,
290
291 /** Constant for the open bracket keyu, "[" */
293
294 /**Constant for the back slash keyu, "\" */
296
297 /** Constant for the close bracket keyu, "]" */
299
300 /** Constant for the "^" key. */
302
303 /** Constant for the "_" key */
305
306 /** Constant for the "`" key */
308
309 /** Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym. */
310
311 /**
312 * Constant for the F<i>n</i> function keys.
313 * <p>
314 * F1..F24u, i.e. F<i>n</i>u, are mapped from on <code>0x60+n</code> -> <code>[0x61 .. 0x78]</code>.
315 * </p>
316 * <p>
317 * <b>Warning:</b> The F<i>n</i> function keys <b>do collide</b> with unicode characters small 'a' thru 'x'!<br/>
318 * See <a href="#unicodeCollision">Unicode Collision</a> for details.
319 * </p>
320 */
321 VK_F1 = ( 0x60U + 1U ),
322
323 /** Constant for the F2 function key. See {@link #VK_F1}. */
324 VK_F2 = ( 0x60U + 2U ),
325
326 /** Constant for the F3 function key. See {@link #VK_F1}. */
327 VK_F3 = ( 0x60U + 3U ),
328
329 /** Constant for the F4 function key. See {@link #VK_F1}. */
330 VK_F4 = ( 0x60U + 4U ),
331
332 /** Constant for the F5 function key. See {@link #VK_F1}. */
333 VK_F5 = ( 0x60U + 5U ),
334
335 /** Constant for the F6 function key. See {@link #VK_F1}. */
336 VK_F6 = ( 0x60U + 6U ),
337
338 /** Constant for the F7 function key. See {@link #VK_F1}. */
339 VK_F7 = ( 0x60U + 7U ),
340
341 /** Constant for the F8 function key. See {@link #VK_F1}. */
342 VK_F8 = ( 0x60U + 8U ),
343
344 /** Constant for the F9 function key. See {@link #VK_F1}. */
345 VK_F9 = ( 0x60U + 9U ),
346
347 /** Constant for the F11 function key. See {@link #VK_F1}. */
348 VK_F10 = ( 0x60U +10U ),
349
350 /** Constant for the F11 function key. See {@link #VK_F1}. */
351 VK_F11 = ( 0x60U +11U ),
352
353 /** Constant for the F12 function key. See {@link #VK_F1}.*/
354 VK_F12 = ( 0x60U +12U ),
355
356 /** Constant for the F13 function key. See {@link #VK_F1}. */
357 VK_F13 = ( 0x60U +13U ),
358
359 /** Constant for the F14 function key. See {@link #VK_F1}. */
360 VK_F14 = ( 0x60U +14U ),
361
362 /** Constant for the F15 function key. See {@link #VK_F1}. */
363 VK_F15 = ( 0x60U +15U ),
364
365 /** Constant for the F16 function key. See {@link #VK_F1}. */
366 VK_F16 = ( 0x60U +16U ),
367
368 /** Constant for the F17 function key. See {@link #VK_F1}. */
369 VK_F17 = ( 0x60U +17U ),
370
371 /** Constant for the F18 function key. See {@link #VK_F1}. */
372 VK_F18 = ( 0x60U +18U ),
373
374 /** Constant for the F19 function key. See {@link #VK_F1}. */
375 VK_F19 = ( 0x60U +19U ),
376
377 /** Constant for the F20 function key. See {@link #VK_F1}. */
378 VK_F20 = ( 0x60U +20U ),
379
380 /** Constant for the F21 function key. See {@link #VK_F1}. */
381 VK_F21 = ( 0x60U +21U ),
382
383 /** Constant for the F22 function key. See {@link #VK_F1}. */
384 VK_F22 = ( 0x60U +22U ),
385
386 /** Constant for the F23 function key. See {@link #VK_F1}. */
387 VK_F23 = ( 0x60U +23U ),
388
389 /** Constant for the F24 function key. See {@link #VK_F1}. */
390 VK_F24 = ( 0x60U +24U ),
391
392
393 /** Constant for the "{" key */
395 /** Constant for the "|" key */
396 VK_PIPE = 0x7Cu,
397 /** Constant for the "}" key */
399
400 /** Constant for the "~" keyu, matching ASCII */
401 VK_TILDE = 0x7Eu,
402
403 //
404 // Unicode: Non printable controls: [0x7F - 0x9F]
405 //
406 // Numpad keys [0x7F - 0x8E] are printable
407 //
408
409 /** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */
411
412 /** Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control. */
413 VK_NUMPAD0 = 0x80u,
414 /** See {@link #VK_NUMPAD0}. */
415 VK_NUMPAD1 = 0x81u,
416 /** See {@link #VK_NUMPAD0}. */
417 VK_NUMPAD2 = 0x82u,
418 /** See {@link #VK_NUMPAD0}. */
419 VK_NUMPAD3 = 0x83u,
420 /** See {@link #VK_NUMPAD0}. */
421 VK_NUMPAD4 = 0x84u,
422 /** See {@link #VK_NUMPAD0}. */
423 VK_NUMPAD5 = 0x85u,
424 /** See {@link #VK_NUMPAD0}. */
425 VK_NUMPAD6 = 0x86u,
426 /** See {@link #VK_NUMPAD0}. */
427 VK_NUMPAD7 = 0x87u,
428 /** See {@link #VK_NUMPAD0}. */
429 VK_NUMPAD8 = 0x88u,
430 /** See {@link #VK_NUMPAD0}. */
431 VK_NUMPAD9 = 0x89u,
432
433 /** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */
434 VK_DECIMAL = 0x8Au,
435
436 /** Numeric keypad <b>add</b> key. Non printable UTF control. */
437 VK_ADD = 0x8Bu,
438
439 /** Numeric keypad <b>subtract</b> key. Non printable UTF control. */
440 VK_SUBTRACT = 0x8Cu,
441
442 /** Numeric keypad <b>multiply</b> key. Non printable UTF control. */
443 VK_MULTIPLY = 0x8Du,
444
445 /** Numeric keypad <b>divide</b> key. Non printable UTF control. */
446 VK_DIVIDE = 0x8Eu,
447
448 /** Constant for the DEL keyu, matching ASCII. Non printable UTF control. */
449 VK_DELETE = 0x93u,
450
451 /** Numeric keypad <b>num lock</b> key. Non printable UTF control. */
452 VK_NUM_LOCK = 0x94u,
453
454 /** Constant for the cursor- or numerical-pad <b>left</b> arrow key. Non printable UTF control. */
455 VK_LEFT = 0x95u,
456
457 /** Constant for the cursor- or numerical-pad <b>up</b> arrow key. Non printable UTF control. */
458 VK_UP = 0x96u,
459
460 /** Constant for the cursor- or numerical-pad <b>right</b> arrow key. Non printable UTF control. */
461 VK_RIGHT = 0x97u,
462
463 /** Constant for the cursor- or numerical pad <b>down</b> arrow key. Non printable UTF control. */
464 VK_DOWN = 0x98u,
465
466 /** Constant for the Context Menu key. Non printable UTF control. */
468
469 /**
470 * Constant for the MS "Windows" function key.
471 * It is used for both the left and right version of the key.
472 */
473 VK_WINDOWS = 0x9Au,
474
475 /** Constant for the Meta function key. */
476 VK_META = 0x9Bu,
477
478 /** Constant for the Help function key. */
479 VK_HELP = 0x9Cu,
480
481 /** Constant for the Compose function key. */
482 VK_COMPOSE = 0x9Du,
483
484 /** Constant for the Begin function key. */
485 VK_BEGIN = 0x9Eu,
486
487 /** Constant for the Stop function key. */
488 VK_STOP = 0x9Fu,
489
490 //
491 // Unicode: Printable [0x00A0 - 0xDFFF]
492 //
493
494 /** Constant for the inverted exclamation mark key. */
496
497 /** Constant for the Euro currency sign key. */
498 VK_EURO_SIGN = 0x20ACu,
499
500 //
501 // Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
502 //
503
504 /* for Sun keyboards */
505 VK_CUT = 0xF879u,
506 VK_COPY = 0xF87Au,
507 VK_PASTE = 0xF87Bu,
508 VK_UNDO = 0xF87Cu,
509 VK_AGAIN = 0xF87Du,
510 VK_FIND = 0xF87Eu,
511 VK_PROPS = 0xF87Fu,
512
513 /* for input method support on Asian Keyboards */
514
515 /**
516 * Constant for the input method on/off key.
517 */
518 /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
520
521 /**
522 * Constant for the Code Input function key.
523 */
524 /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
525 VK_CODE_INPUT = 0xF891u,
526
527 /**
528 * Constant for the Roman Characters function key.
529 */
530 /* Japanese PC 106 keyboard: roumaji */
532
533 /**
534 * Constant for the All Candidates function key.
535 */
536 /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
538
539 /**
540 * Constant for the Previous Candidate function key.
541 */
542 /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
544
545 /**
546 * Constant for the Alphanumeric function key.
547 */
548 /* Japanese PC 106 keyboard: eisuu */
550
551 /**
552 * Constant for the Katakana function key.
553 */
554 /* Japanese PC 106 keyboard: katakana */
555 VK_KATAKANA = 0xF896u,
556
557 /**
558 * Constant for the Hiragana function key.
559 */
560 /* Japanese PC 106 keyboard: hiragana */
561 VK_HIRAGANA = 0xF897u,
562
563 /**
564 * Constant for the Full-Width Characters function key.
565 */
566 /* Japanese PC 106 keyboard: zenkaku */
567 VK_FULL_WIDTH = 0xF898u,
568
569 /**
570 * Constant for the Half-Width Characters function key.
571 */
572 /* Japanese PC 106 keyboard: hankaku */
573 VK_HALF_WIDTH = 0xF89Au,
574
575 /**
576 * Constant for the Japanese-Katakana function key.
577 * This key switches to a Japanese input method and selects its Katakana input mode.
578 */
579 /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
581
582 /**
583 * Constant for the Japanese-Hiragana function key.
584 * This key switches to a Japanese input method and selects its Hiragana input mode.
585 */
586 /* Japanese Macintosh keyboard */
588
589 /**
590 * Constant for the Japanese-Roman function key.
591 * This key switches to a Japanese input method and selects its Roman-Direct input mode.
592 */
593 /* Japanese Macintosh keyboard */
595
596 /**
597 * Constant for the locking Kana function key.
598 * This key locks the keyboard into a Kana layout.
599 */
600 /* Japanese PC 106 keyboard with special Windows driver - eisuu + Controlu, Japanese Solaris keyboard: kana */
601 VK_KANA_LOCK = 0xF89Fu,
602
603 /**
604 * Constant for Keyboard became invisible, e.g. Android's soft keyboard Back button hit while keyboard is visible.
605 */
607
608 };
609 constexpr uint16_t operator*(const VKeyCode v) noexcept { return static_cast<uint16_t>(v); }
610
611 constexpr bool operator==(const VKeyCode lhs, const VKeyCode rhs) noexcept {
612 return *lhs == *rhs;
613 }
614
615 /**
616 * Returns <code>true</code> if given <code>uniChar</code> represents a printable character,
617 * i.e. a value other than VKeyCode::VK_UNDEFINED and not a control or non-printable private code.
618 * <p>
619 * A printable character is neither a {@link #isModifierKey(short) modifier key}, nor an {@link #isActionKey(short) action key}.
620 * </p>
621 * <p>
622 * Otherwise returns <code>false</code>.
623 * </p>
624 * <p>
625 * Distinction of key character and virtual key code is made due to <a href="#unicodeCollision">unicode collision</a>.
626 * </p>
627 *
628 * @param uniChar the UTF-16 unicode value, which maybe a virtual key code or key character.
629 * @param isKeyChar true if <code>uniChar</code> is a key character, otherwise a virtual key code
630 */
631 bool isPrintableKey(uint16_t uniChar, bool isKeyChar) noexcept;
632
633 /**
634 * Returns <code>true</code> if given <code>uniCode</code> represents a printable character,
635 * i.e. a value other than VKeyCode::VK_UNDEFINED and not a control or non-printable private code.
636 * <p>
637 * A printable character is neither a KeyEvent::isModifierKey(), nor an KeyEvent::isActionKey().
638 * </p>
639 * <p>
640 * Otherwise returns <code>false</code>.
641 * </p>
642 * @param uniChar the UTF-16 VKeyCode unicode value.
643 */
644 inline bool isPrintableKey(VKeyCode vKey, bool isKeyChar) noexcept { return isPrintableKey(*vKey, isKeyChar); }
645
646 /**
647 * @param keyChar UTF16 value to map. It is expected that the incoming keyChar value is unshifted and unmodified,
648 * however, lower case a-z is mapped to {@link KeyEvent#VK_A} - {@link KeyEvent#VK_Z}.
649 * @return {@link KeyEvent} virtual key (VK) value.
650 */
651 constexpr VKeyCode toVKeyCode(uint16_t keyChar) noexcept {
652 if( 'a' <= keyChar && keyChar <= 'z' ) {
653 return VKeyCode( ( keyChar - uint16_t('a') ) + *VKeyCode::VK_A );
654 }
655 return VKeyCode(keyChar);
656 }
657
658 /**
659 * Returns <code>true</code> if the given <code>virtualKey</code> represents a modifier key, otherwise <code>false</code>.
660 * <p>
661 * A modifier key is one of VKeyCode::VK_SHIFT, VKeyCode::VK_CONTROL, VKeyCode::VK_ALT, VKeyCode::VK_META.
662 * </p>
663 */
664 constexpr bool isModifierKey(VKeyCode vKey) {
665 switch (vKey) {
668 case VKeyCode::VK_ALT:
670 return true;
671 default:
672 return false;
673 }
674 }
675
676 /**
677 * <a name="eventDelivery"><h5>KeyEvent Delivery</h5></a>
678 *
679 * Key events are delivered in the following order:
680 * <p>
681 * <table border="0">
682 * <tr><th>#</th><th>Event Type</th> <th>Constraints</th> <th>Notes</th></tr>
683 * <tr><td>1</td><td>{@link #EVENT_KEY_PRESSED} </td><td> <i> excluding {@link #isAutoRepeat() auto-repeat}-{@link #isModifierKey() modifier} keys</i></td><td></td></tr>
684 * <tr><td>2</td><td>{@link #EVENT_KEY_RELEASED} </td><td> <i> excluding {@link #isAutoRepeat() auto-repeat}-{@link #isModifierKey() modifier} keys</i></td><td></td></tr>
685 * </table>
686 * </p>
687 * In case the native platform does not
688 * deliver keyboard events in the above order or skip events,
689 * the NEWT driver will reorder and inject synthetic events if required.
690 * <p>
691 * Besides regular modifiers like InputModifier::shift etc.,
692 * the InputModifier::autorepeat bit is added if repetition is detected, following above constraints.
693 * </p>
694 * <p>
695 * Auto-Repeat shall behave as follow:
696 * <pre>
697 P = pressed, R = released
698 0 = normal, 1 = auto-repeat
699
700 P(0), [ R(1), P(1), R(1), ..], R(0)
701 * </pre>
702 * The idea is if you mask out auto-repeat in your event listener
703 * you just get one long pressed P/R tuple for {@link #isPrintableKey() printable} and {@link #isActionKey() Action} keys.
704 * </p>
705 * <p>
706 * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
707 * and {@link #EVENT_KEY_RELEASED released} events including {@link #isAutoRepeat() auto-repeat}.
708 * </p>
709 * <p>
710 * {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events.
711 * </p>
712 * <p>
713 * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
714 * excluding {@link #isAutoRepeat() auto-repeat}.
715 * They will also influence subsequent event's {@link #getModifiers() modifier} bits while pressed.
716 * </p>
717 *
718 * <a name="unicodeMapping"><h5>Unicode Mapping</h5></a>
719 * <p>
720 * {@link #getKeyChar() Key-chars}, as well as
721 * {@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols}
722 * use the UTF-16 unicode space w/o collision.
723 *
724 * </p>
725 * <p>
726 * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols},
727 * i.e. {@link #isModifierKey() modifier-} and {@link #isActionKey() action-}keys,
728 * are mapped to unicode's control and private range and do not collide w/ {@link #isPrintableKey() printable} unicode values
729 * with the following exception.
730 * </p>
731 *
732 * <a name="unicodeCollision"><h5>Unicode Collision</h5></a>
733 * <p>
734 * The following {@link #getKeyCode() Key-code}s and {@link #getKeySymbol() key-symbol}s collide w/ unicode space:<br/>
735 * <table border="1">
736 * <tr><th>unicode range</th> <th>virtual key code</th> <th>unicode character</th></tr>
737 * <tr><td>[0x61 .. 0x78]</td> <td>[{@link #VK_F1}..{@link #VK_F24}]</td> <td>['a'..'x']</td></tr>
738 * </table>
739 * </p>
740 * <p>
741 * Collision was chosen for {@link #getKeyCode() Key-code} and {@link #getKeySymbol() key-symbol} mapping
742 * to allow a minimal code range, i.e. <code>[0..255]</code>.
743 * The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
744 * e.g. to implement a key-press state tracker.
745 * </p>
746 * <pre>
747 * http://www.utf8-chartable.de/unicode-utf8-table.pl
748 * http://www.unicode.org/Public/5.1.0/ucd/PropList.txt
749 * https://en.wikipedia.org/wiki/Mapping_of_Unicode_characters
750 * https://en.wikipedia.org/wiki/Unicode_control_characters
751 * https://en.wikipedia.org/wiki/Private_Use_%28Unicode%29#Private_Use_Areas
752 * </pre>
753 * </p>
754 */
755 class KeyEvent : public InputEvent {
756 private:
757 VKeyCode m_keySym;
758 uint16_t m_keyChar;
759 uint8_t m_flags;
760 static constexpr uint8_t F_MODIFIER_MASK = 1 << 0;
761 static constexpr uint8_t F_ACTION_MASK = 1 << 1;
762 static constexpr uint8_t F_PRINTABLE_MASK = 1 << 2;
763
764 std::string getEventTypeString() const noexcept {
765 switch(type()) {
766 case EVENT_KEY_PRESSED: return "PRESSED";
767 case EVENT_KEY_RELEASED: return "RELEASD";
768 default: return "unknown (" + std::to_string(type()) + ")";
769 }
770 }
771 public:
773 VKeyCode keySym, InputModifier keySymMods, uint16_t keyChar) noexcept
774 : InputEvent(type, when, source, globalMods), m_keySym(keySym), m_keyChar(keyChar), m_flags(0)
775 {
776 // cache modifier and action flags
778 m_flags |= F_PRINTABLE_MASK;
779 } else if( ::gamp::wt::event::has_any(keySymMods, InputModifier::modifier) ) {
780 m_flags |= F_MODIFIER_MASK;
781 } else {
782 // A = U - ( P + M )
783 m_flags |= F_ACTION_MASK;
784 }
785 }
786
787 /**
788 * Returns the virtual <i>key symbol</i> reflecting the current <i>keyboard layout</i>.
789 * <p>
790 * For {@link #isPrintableKey() printable keys}, the <i>key symbol</i> is the {@link #isModifierKey() unmodified}
791 * representation of the UTF-16 {@link #getKeyChar() key char}.<br/>
792 * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'.
793 * </p>
794 * @see #isPrintableKey()
795 * @see #getKeyChar()
796 * @see #getKeyCode()
797 */
798 constexpr VKeyCode keySym() const noexcept { return m_keySym; }
799
800 /**
801 * Returns the <i>UTF-16</i> character reflecting the {@link #getKeySymbol() key symbol}
802 * incl. active {@link #isModifierKey() modifiers}.
803 * @see #getKeySymbol()
804 * @see #getKeyCode()
805 */
806 constexpr uint16_t keyChar() const noexcept { return m_keyChar; }
807
808 /**
809 * Returns <code>true</code> if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char}
810 * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED}
811 * and not a control or non-printable private code.
812 * <p>
813 * A printable character is neither a {@link #isModifierKey(short) modifier key}, nor an {@link #isActionKey(short) action key}.
814 * </p>
815 * <p>
816 * Otherwise returns <code>false</code>.
817 * </p>
818 */
819 constexpr bool isPrintableKey() const noexcept { return 0 != ( F_PRINTABLE_MASK & m_flags ); }
820
821 /**
822 * Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a modifier key,
823 * otherwise <code>false</code>.
824 * <p>
825 * See {@link #isModifierKey(short)} for details.
826 * </p>
827 * <p>
828 * Note: Implementation uses a cached value.
829 * </p>
830 */
831 constexpr bool isModifierKey() const noexcept { return 0 != ( F_MODIFIER_MASK & m_flags ); }
832
833 /**
834 * Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a non-printable and
835 * non-{@link #isModifierKey(short) modifier} action key, otherwise <code>false</code>.
836 * <p>
837 * Hence it is the set A of all keys U w/o printable P and w/o modifiers M:
838 * <code> A = U - ( P + M ) </code>
839 * </p>
840 * @see #isPrintableKey()
841 * @see #isModifierKey()
842 */
843 constexpr bool isActionKey() const noexcept { return 0 != ( F_ACTION_MASK & m_flags ); }
844
845 /**
846 * Returns true if event matches original key typed semantics, i.e.:
847 * <pre>
848 isPrintableKey() && !is_set(InputModifier::autorepeat)
849 * </pre>
850 */
851 constexpr bool isTyped() const noexcept {
853 }
854
855 std::string toString() const noexcept {
856 std::string res = "KeyEvent[";
857 res.append(getEventTypeString()).append(", sym ").append(jau::to_hexstring(*m_keySym))
858 .append(", char ").append(jau::to_hexstring(m_keyChar));
859 if( isPrintableKey() ) {
860 res.append(" `").append(std::string(1, (char)m_keyChar)).append("`");
861 }
862 res.append("), ");
863 if( isPrintableKey() ) {
864 res.append("printable");
865 } else if( isModifierKey() ) {
866 res.append("modifier");
867 } else if( isActionKey() ) {
868 res.append("actionkey");
869 }
870 res.append(", ").append(InputEvent::toString()).append("]");
871 return res;
872 }
873 };
874 inline std::ostream& operator<<(std::ostream& out, const KeyEvent& v) {
875 return out << v.toString();
876 }
877
879 public:
881
882 virtual ~KeyboardTracker() noexcept = default;
883 virtual InputModifier modifier() const noexcept = 0;
884 virtual bool isPressed(VKeyCode) const noexcept = 0;
885 virtual const PressedKeyCodes& pressedKeyCodes() const noexcept = 0;
886 };
887
888 /**
889 * Listener for multiple KeyEvent.
890 *
891 * @see KeyEvent
892 */
894 {
895 public:
896 virtual ~KeyListener() noexcept = default;
897
898 /** A key has been {@link KeyEvent#EVENT_KEY_PRESSED pressed}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}. */
899 virtual void keyPressed(KeyEvent& /*e*/, const KeyboardTracker&) {}
900
901 /**
902 * A key has been {@link KeyEvent#EVENT_KEY_RELEASED released}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}.
903 * <p>
904 * To simulated the removed <code>keyTyped(KeyEvent e)</code> semantics, see KeyEvent::isTyped().
905 * </p>
906 */
907 virtual void keyReleased(KeyEvent& /*e*/, const KeyboardTracker&) {}
908 };
909 typedef std::shared_ptr<KeyListener> KeyListenerRef;
910
911 /**@}*/
912
913}
914
915#endif /* GAMP_WTKEYEVENT_HPP_ */
InputEvent(uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods) noexcept
Definition Event.hpp:207
std::string toString() const noexcept
Definition Event.hpp:302
constexpr bool is_set(InputModifier bits) const noexcept
Use with single bits, e.g.
Definition Event.hpp:213
constexpr bool isPrintableKey() const noexcept
Returns true if key symbol and key char represents a printable character, i.e.
Definition KeyEvent.hpp:819
KeyEvent(uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier globalMods, VKeyCode keySym, InputModifier keySymMods, uint16_t keyChar) noexcept
Definition KeyEvent.hpp:772
constexpr uint16_t keyChar() const noexcept
Returns the UTF-16 character reflecting the key symbol incl.
Definition KeyEvent.hpp:806
std::string toString() const noexcept
Definition KeyEvent.hpp:855
constexpr bool isTyped() const noexcept
Returns true if event matches original key typed semantics, i.e.:
Definition KeyEvent.hpp:851
constexpr bool isActionKey() const noexcept
Returns true if key symbol represents a non-printable and non-modifier action key,...
Definition KeyEvent.hpp:843
constexpr bool isModifierKey() const noexcept
Returns true if key symbol represents a modifier key, otherwise false.
Definition KeyEvent.hpp:831
constexpr VKeyCode keySym() const noexcept
Returns the virtual key symbol reflecting the current keyboard layout.
Definition KeyEvent.hpp:798
Listener for multiple KeyEvent.
Definition KeyEvent.hpp:894
virtual void keyPressed(KeyEvent &, const KeyboardTracker &)
A key has been pressed, excluding auto-repeat modifier keys.
Definition KeyEvent.hpp:899
virtual void keyReleased(KeyEvent &, const KeyboardTracker &)
A key has been released, excluding auto-repeat modifier keys.
Definition KeyEvent.hpp:907
virtual ~KeyListener() noexcept=default
jau::bitfield< 256 > PressedKeyCodes
Definition KeyEvent.hpp:880
virtual const PressedKeyCodes & pressedKeyCodes() const noexcept=0
virtual bool isPressed(VKeyCode) const noexcept=0
virtual InputModifier modifier() const noexcept=0
virtual ~KeyboardTracker() noexcept=default
constexpr const WindowWeakPtr & source() const noexcept
Definition Event.hpp:85
constexpr const jau::fraction_timespec & when() const noexcept
Definition Event.hpp:84
constexpr uint16_t type() const noexcept
Definition Event.hpp:83
Simple bitfield template for efficient bit storage access in O(1).
Definition bitfield.hpp:41
constexpr bool has_any(const E mask, const E bits) noexcept
constexpr std::underlying_type_t< E > operator*(const E v) noexcept
constexpr bool operator==(const E lhs, const E rhs) noexcept
std::ostream & operator<<(std::ostream &os, const T v)
constexpr VKeyCode toVKeyCode(uint16_t keyChar) noexcept
Definition KeyEvent.hpp:651
std::shared_ptr< KeyListener > KeyListenerRef
Definition KeyEvent.hpp:909
constexpr bool isModifierKey(VKeyCode vKey)
Returns true if the given virtualKey represents a modifier key, otherwise false.
Definition KeyEvent.hpp:664
VKeyCode
Virtual key code following UTF16 specification.
Definition KeyEvent.hpp:45
bool isPrintableKey(uint16_t uniChar, bool isKeyChar) noexcept
Returns true if given uniChar represents a printable character, i.e.
Definition gamp_wt.cpp:55
static constexpr uint16_t EVENT_KEY_PRESSED
A key has been pressed, excluding auto-repeat-modifier keys.
Definition Event.hpp:57
std::shared_ptr< Window > WindowRef
Definition Event.hpp:36
static constexpr uint16_t EVENT_KEY_RELEASED
A key has been released, excluding auto-repeat-modifier keys.
Definition Event.hpp:59
@ repeat
Event is caused by auto-repeat.
Definition Event.hpp:175
@ VK_QUOTEDBL
Constant for the """ key.
Definition KeyEvent.hpp:155
@ VK_F3
Constant for the F3 function key.
Definition KeyEvent.hpp:327
@ VK_SEMICOLON
Constant for the semicolon keyu, "u,".
Definition KeyEvent.hpp:221
@ VK_PLUS
Constant for the "+" key.
Definition KeyEvent.hpp:182
@ VK_F6
Constant for the F6 function key.
Definition KeyEvent.hpp:336
@ VK_HOME
Constant for the HOME function key.
Definition KeyEvent.hpp:61
@ VK_STOP
Constant for the Stop function key.
Definition KeyEvent.hpp:488
@ VK_QUESTIONMARK
Constant for the equals keyu, "?".
Definition KeyEvent.hpp:233
@ VK_F10
Constant for the F11 function key.
Definition KeyEvent.hpp:348
@ VK_ADD
Numeric keypad add key.
Definition KeyEvent.hpp:437
@ VK_ESCAPE
Constant for the ESCAPE function key.
Definition KeyEvent.hpp:129
@ VK_UNDERSCORE
Constant for the "_" key.
Definition KeyEvent.hpp:304
@ VK_COMPOSE
Constant for the Compose function key.
Definition KeyEvent.hpp:482
@ VK_ASTERISK
Constant for the "*" key.
Definition KeyEvent.hpp:179
@ VK_KEYBOARD_INVISIBLE
Constant for Keyboard became invisible, e.g.
Definition KeyEvent.hpp:606
@ VK_F5
Constant for the F5 function key.
Definition KeyEvent.hpp:333
@ VK_MODECHANGE
Constant for the Mode Change (?).
Definition KeyEvent.hpp:141
@ VK_META
Constant for the Meta function key.
Definition KeyEvent.hpp:476
@ VK_ACCEPT
Constant for the Accept or Commit function keyu, Japanese "kakutei".
Definition KeyEvent.hpp:138
@ VK_NUMPAD4
See VK_NUMPAD0.
Definition KeyEvent.hpp:421
@ VK_PERCENT
Constant for the "%" key.
Definition KeyEvent.hpp:164
@ VK_F23
Constant for the F23 function key.
Definition KeyEvent.hpp:387
@ VK_F7
Constant for the F7 function key.
Definition KeyEvent.hpp:339
@ VK_F8
Constant for the F8 function key.
Definition KeyEvent.hpp:342
@ VK_WINDOWS
Constant for the MS "Windows" function key.
Definition KeyEvent.hpp:473
@ VK_BACK_SPACE
Constant for the BACK SPACE key "\b"u, matching ASCII.
Definition KeyEvent.hpp:76
@ VK_ALL_CANDIDATES
Constant for the All Candidates function key.
Definition KeyEvent.hpp:537
@ VK_AMPERSAND
Constant for the "&" key.
Definition KeyEvent.hpp:167
@ VK_KANA_LOCK
Constant for the locking Kana function key.
Definition KeyEvent.hpp:601
@ VK_CONVERT
Constant for the Convert function keyu, Japanese "henkan".
Definition KeyEvent.hpp:132
@ VK_F15
Constant for the F15 function key.
Definition KeyEvent.hpp:363
@ VK_F13
Constant for the F13 function key.
Definition KeyEvent.hpp:357
@ VK_RIGHT
Constant for the cursor- or numerical-pad right arrow key.
Definition KeyEvent.hpp:461
@ VK_INPUT_METHOD_ON_OFF
Constant for the input method on/off key.
Definition KeyEvent.hpp:519
@ VK_F18
Constant for the F18 function key.
Definition KeyEvent.hpp:372
@ VK_PREVIOUS_CANDIDATE
Constant for the Previous Candidate function key.
Definition KeyEvent.hpp:543
@ VK_DIVIDE
Numeric keypad divide key.
Definition KeyEvent.hpp:446
@ VK_F22
Constant for the F22 function key.
Definition KeyEvent.hpp:384
@ VK_F24
Constant for the F24 function key.
Definition KeyEvent.hpp:390
@ VK_OPEN_BRACKET
Constant for the open bracket keyu, "[".
Definition KeyEvent.hpp:292
@ VK_HALF_WIDTH
Constant for the Half-Width Characters function key.
Definition KeyEvent.hpp:573
@ VK_KATAKANA
Constant for the Katakana function key.
Definition KeyEvent.hpp:555
@ VK_RIGHT_BRACE
Constant for the "}" key.
Definition KeyEvent.hpp:398
@ VK_DOWN
Constant for the cursor- or numerical pad down arrow key.
Definition KeyEvent.hpp:464
@ VK_NUMPAD2
See VK_NUMPAD0.
Definition KeyEvent.hpp:417
@ VK_ALPHANUMERIC
Constant for the Alphanumeric function key.
Definition KeyEvent.hpp:549
@ VK_HELP
Constant for the Help function key.
Definition KeyEvent.hpp:479
@ VK_DECIMAL
Numeric keypad decimal separator key.
Definition KeyEvent.hpp:434
@ VK_CONTROL
Constant for the CTRL function key.
Definition KeyEvent.hpp:102
@ VK_PRINTSCREEN
Constant for the PRINT function key.
Definition KeyEvent.hpp:70
@ VK_F1
Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym.
Definition KeyEvent.hpp:321
@ VK_COMMA
Constant for the comma keyu, "u,".
Definition KeyEvent.hpp:185
@ VK_A
VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A)
Definition KeyEvent.hpp:239
@ VK_F17
Constant for the F17 function key.
Definition KeyEvent.hpp:369
@ VK_F2
Constant for the F2 function key.
Definition KeyEvent.hpp:324
@ VK_ENTER
Constant for the ENTER keyu, i.e.
Definition KeyEvent.hpp:91
@ VK_F12
Constant for the F12 function key.
Definition KeyEvent.hpp:354
@ VK_PIPE
Constant for the "|" key.
Definition KeyEvent.hpp:396
@ VK_BACK_SLASH
Constant for the back slash keyu, "\".
Definition KeyEvent.hpp:295
@ VK_NUMPAD3
See VK_NUMPAD0.
Definition KeyEvent.hpp:419
@ VK_QUOTE
Constant for the "'" key.
Definition KeyEvent.hpp:170
@ VK_UP
Constant for the cursor- or numerical-pad up arrow key.
Definition KeyEvent.hpp:458
@ VK_NUMPAD6
See VK_NUMPAD0.
Definition KeyEvent.hpp:425
@ VK_BACK_QUOTE
Constant for the "`" key.
Definition KeyEvent.hpp:307
@ VK_EURO_SIGN
Constant for the Euro currency sign key.
Definition KeyEvent.hpp:498
@ VK_END
Constant for the END function key.
Definition KeyEvent.hpp:64
@ VK_SPACE
Constant for the SPACE function key.
Definition KeyEvent.hpp:149
@ VK_AT
Constant for the equals keyu, "@".
Definition KeyEvent.hpp:236
@ VK_LEFT_BRACE
Constant for the "{" key.
Definition KeyEvent.hpp:394
@ VK_FULL_WIDTH
Constant for the Full-Width Characters function key.
Definition KeyEvent.hpp:567
@ VK_CAPS_LOCK
Constant for the CAPS LOCK function key.
Definition KeyEvent.hpp:110
@ VK_CIRCUMFLEX
Constant for the "^" key.
Definition KeyEvent.hpp:301
@ VK_PERIOD
Constant for the period keyu, ".".
Definition KeyEvent.hpp:191
@ VK_NUMPAD7
See VK_NUMPAD0.
Definition KeyEvent.hpp:427
@ VK_NUMPAD9
See VK_NUMPAD0.
Definition KeyEvent.hpp:431
@ VK_TAB
Constant for the HORIZ TAB key "\t"u, matching ASCII.
Definition KeyEvent.hpp:79
@ VK_HIRAGANA
Constant for the Hiragana function key.
Definition KeyEvent.hpp:561
@ VK_PAGE_DOWN
Constant for the PAGE DOWN function key.
Definition KeyEvent.hpp:85
@ VK_NONCONVERT
Constant for the Don't Convert function keyu, Japanese "muhenkan".
Definition KeyEvent.hpp:135
@ VK_UNDEFINED
This value, {@value}, is used to indicate that the keyCode is unknown.
Definition KeyEvent.hpp:53
@ VK_LEFT
Constant for the cursor- or numerical-pad left arrow key.
Definition KeyEvent.hpp:455
@ VK_F4
Constant for the F4 function key.
Definition KeyEvent.hpp:330
@ VK_FINAL
Constant for the END function key.
Definition KeyEvent.hpp:67
@ VK_F16
Constant for the F16 function key.
Definition KeyEvent.hpp:366
@ VK_SHIFT
Constant for the SHIFT function key.
Definition KeyEvent.hpp:96
@ VK_F20
Constant for the F20 function key.
Definition KeyEvent.hpp:378
@ VK_NUMPAD5
See VK_NUMPAD0.
Definition KeyEvent.hpp:423
@ VK_COLON
Constant for the ":" key.
Definition KeyEvent.hpp:218
@ VK_F14
Constant for the F14 function key.
Definition KeyEvent.hpp:360
@ VK_CODE_INPUT
Constant for the Code Input function key.
Definition KeyEvent.hpp:525
@ VK_JAPANESE_HIRAGANA
Constant for the Japanese-Hiragana function key.
Definition KeyEvent.hpp:587
@ VK_CANCEL
Constant for the CANCEL function key.
Definition KeyEvent.hpp:121
@ VK_LEFT_PARENTHESIS
Constant for the "(" key.
Definition KeyEvent.hpp:173
@ VK_RIGHT_PARENTHESIS
Constant for the ")" key.
Definition KeyEvent.hpp:176
@ VK_0
VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39].
Definition KeyEvent.hpp:197
@ VK_JAPANESE_ROMAN
Constant for the Japanese-Roman function key.
Definition KeyEvent.hpp:594
@ VK_EQUALS
Constant for the equals keyu, "=".
Definition KeyEvent.hpp:227
@ VK_NUMPAD0
Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89).
Definition KeyEvent.hpp:413
@ VK_CONTEXT_MENU
Constant for the Context Menu key.
Definition KeyEvent.hpp:467
@ VK_F9
Constant for the F9 function key.
Definition KeyEvent.hpp:345
@ VK_PAGE_UP
Constant for the PAGE UP function key.
Definition KeyEvent.hpp:99
@ VK_INVERTED_EXCLAMATION_MARK
Constant for the inverted exclamation mark key.
Definition KeyEvent.hpp:495
@ VK_CLOSE_BRACKET
Constant for the close bracket keyu, "]".
Definition KeyEvent.hpp:298
@ VK_NUMBER_SIGN
Constant for the "#" key.
Definition KeyEvent.hpp:158
@ VK_JAPANESE_KATAKANA
Constant for the Japanese-Katakana function key.
Definition KeyEvent.hpp:580
@ VK_ALT
Constant for the ALT function key.
Definition KeyEvent.hpp:105
@ VK_MINUS
Constant for the minus keyu, "-".
Definition KeyEvent.hpp:188
@ VK_SLASH
Constant for the forward slash keyu, "/".
Definition KeyEvent.hpp:194
@ VK_INSERT
Constant for the INSERT function key.
Definition KeyEvent.hpp:126
@ VK_F19
Constant for the F19 function key.
Definition KeyEvent.hpp:375
@ VK_ROMAN_CHARACTERS
Constant for the Roman Characters function key.
Definition KeyEvent.hpp:531
@ VK_PAUSE
Constant for the PAUSE function key.
Definition KeyEvent.hpp:115
@ VK_F11
Constant for the F11 function key.
Definition KeyEvent.hpp:351
@ VK_GREATER
Constant for the equals keyu, ">".
Definition KeyEvent.hpp:230
@ VK_SEPARATOR
Numeric keypad decimal separator key.
Definition KeyEvent.hpp:410
@ VK_NUMPAD1
See VK_NUMPAD0.
Definition KeyEvent.hpp:415
@ VK_SUBTRACT
Numeric keypad subtract key.
Definition KeyEvent.hpp:440
@ VK_BEGIN
Constant for the Begin function key.
Definition KeyEvent.hpp:485
@ VK_DOLLAR
Constant for the "$" key.
Definition KeyEvent.hpp:161
@ VK_LINEFEED
LINE_FEED "\n"u, matching ASCIIu, n/a on keyboard.
Definition KeyEvent.hpp:82
@ VK_LESS
Constant for the equals keyu, "<".
Definition KeyEvent.hpp:224
@ VK_EXCLAMATION_MARK
Constant for the "!" key.
Definition KeyEvent.hpp:152
@ VK_SCROLL_LOCK
scroll lock key.
Definition KeyEvent.hpp:118
@ VK_CLEAR
Constant for the CLEAR keyu, i.e.
Definition KeyEvent.hpp:88
@ VK_MULTIPLY
Numeric keypad multiply key.
Definition KeyEvent.hpp:443
@ VK_F21
Constant for the F21 function key.
Definition KeyEvent.hpp:381
@ VK_DELETE
Constant for the DEL keyu, matching ASCII.
Definition KeyEvent.hpp:449
@ VK_TILDE
Constant for the "~" keyu, matching ASCII.
Definition KeyEvent.hpp:401
@ VK_NUMPAD8
See VK_NUMPAD0.
Definition KeyEvent.hpp:429
@ VK_NUM_LOCK
Numeric keypad num lock key.
Definition KeyEvent.hpp:452
std::string to_hexstring(value_type const &v, const bool skipLeading0x=false) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer.
Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platfor...