1 | // LAF OS Library |
2 | // Copyright (C) 2012-2017 David Capello |
3 | // |
4 | // This file is released under the terms of the MIT license. |
5 | // Read LICENSE.txt for more information. |
6 | |
7 | #ifndef OS_KEYS_H_INCLUDED |
8 | #define OS_KEYS_H_INCLUDED |
9 | #pragma once |
10 | |
11 | namespace os { |
12 | |
13 | enum KeyModifiers { |
14 | kKeyNoneModifier = 0, |
15 | kKeyShiftModifier = 1, |
16 | kKeyCtrlModifier = 2, |
17 | kKeyAltModifier = 4, |
18 | kKeyCmdModifier = 8, |
19 | kKeySpaceModifier = 16, |
20 | kKeyWinModifier = 32, |
21 | kKeyUninitializedModifier = 64, |
22 | }; |
23 | |
24 | // TODO These are virtual key code (not scancodes), we should rename |
25 | // it to KeyCodes or use Unicode directly as on macOS (some |
26 | // special keys like F1, arrow keys, etc. have a special |
27 | // unicode value). |
28 | enum KeyScancode { |
29 | kKeyNil = 0, |
30 | kKeyA = 1, |
31 | kKeyB = 2, |
32 | kKeyC = 3, |
33 | kKeyD = 4, |
34 | kKeyE = 5, |
35 | kKeyF = 6, |
36 | kKeyG = 7, |
37 | kKeyH = 8, |
38 | kKeyI = 9, |
39 | kKeyJ = 10, |
40 | kKeyK = 11, |
41 | kKeyL = 12, |
42 | kKeyM = 13, |
43 | kKeyN = 14, |
44 | kKeyO = 15, |
45 | kKeyP = 16, |
46 | kKeyQ = 17, |
47 | kKeyR = 18, |
48 | kKeyS = 19, |
49 | kKeyT = 20, |
50 | kKeyU = 21, |
51 | kKeyV = 22, |
52 | kKeyW = 23, |
53 | kKeyX = 24, |
54 | kKeyY = 25, |
55 | kKeyZ = 26, |
56 | kKey0 = 27, |
57 | kKey1 = 28, |
58 | kKey2 = 29, |
59 | kKey3 = 30, |
60 | kKey4 = 31, |
61 | kKey5 = 32, |
62 | kKey6 = 33, |
63 | kKey7 = 34, |
64 | kKey8 = 35, |
65 | kKey9 = 36, |
66 | kKey0Pad = 37, |
67 | kKey1Pad = 38, |
68 | kKey2Pad = 39, |
69 | kKey3Pad = 40, |
70 | kKey4Pad = 41, |
71 | kKey5Pad = 42, |
72 | kKey6Pad = 43, |
73 | kKey7Pad = 44, |
74 | kKey8Pad = 45, |
75 | kKey9Pad = 46, |
76 | kKeyF1 = 47, |
77 | kKeyF2 = 48, |
78 | kKeyF3 = 49, |
79 | kKeyF4 = 50, |
80 | kKeyF5 = 51, |
81 | kKeyF6 = 52, |
82 | kKeyF7 = 53, |
83 | kKeyF8 = 54, |
84 | kKeyF9 = 55, |
85 | kKeyF10 = 56, |
86 | kKeyF11 = 57, |
87 | kKeyF12 = 58, |
88 | kKeyEsc = 59, |
89 | kKeyTilde = 60, |
90 | kKeyMinus = 61, |
91 | kKeyEquals = 62, |
92 | kKeyBackspace = 63, |
93 | kKeyTab = 64, |
94 | kKeyOpenbrace = 65, |
95 | kKeyClosebrace = 66, |
96 | kKeyEnter = 67, |
97 | kKeyColon = 68, |
98 | kKeyQuote = 69, |
99 | kKeyBackslash = 70, |
100 | kKeyBackslash2 = 71, |
101 | kKeyComma = 72, |
102 | kKeyStop = 73, |
103 | kKeySlash = 74, |
104 | kKeySpace = 75, |
105 | kKeyInsert = 76, |
106 | kKeyDel = 77, |
107 | kKeyHome = 78, |
108 | kKeyEnd = 79, |
109 | kKeyPageUp = 80, |
110 | kKeyPageDown = 81, |
111 | kKeyLeft = 82, |
112 | kKeyRight = 83, |
113 | kKeyUp = 84, |
114 | kKeyDown = 85, |
115 | kKeySlashPad = 86, |
116 | kKeyAsterisk = 87, |
117 | kKeyMinusPad = 88, |
118 | kKeyPlusPad = 89, |
119 | kKeyDelPad = 90, |
120 | kKeyEnterPad = 91, |
121 | kKeyPrtscr = 92, |
122 | kKeyPause = 93, |
123 | kKeyAbntC1 = 94, |
124 | kKeyYen = 95, |
125 | kKeyKana = 96, |
126 | kKeyConvert = 97, |
127 | kKeyNoconvert = 98, |
128 | kKeyAt = 99, |
129 | kKeyCircumflex = 100, |
130 | kKeyColon2 = 101, |
131 | kKeyKanji = 102, |
132 | kKeyEqualsPad = 103, // macOS |
133 | kKeyBackquote = 104, // macOS |
134 | kKeySemicolon = 105, // macOS |
135 | kKeyUnknown1 = 106, |
136 | kKeyUnknown2 = 107, |
137 | kKeyUnknown3 = 108, |
138 | kKeyUnknown4 = 109, |
139 | kKeyUnknown5 = 110, |
140 | kKeyUnknown6 = 111, |
141 | kKeyUnknown7 = 112, |
142 | kKeyUnknown8 = 113, |
143 | |
144 | kKeyFirstModifierScancode = 114, |
145 | |
146 | kKeyLShift = 114, |
147 | kKeyRShift = 115, |
148 | kKeyLControl = 116, |
149 | kKeyRControl = 117, |
150 | kKeyAlt = 118, |
151 | kKeyAltGr = 119, |
152 | kKeyLWin = 120, |
153 | kKeyRWin = 121, |
154 | = 122, |
155 | kKeyCommand = 123, |
156 | kKeyScrLock = 124, |
157 | kKeyNumLock = 125, |
158 | kKeyCapsLock = 126, |
159 | |
160 | kKeyScancodes = 127 |
161 | }; |
162 | |
163 | } // namespace os |
164 | |
165 | #endif |
166 | |