1 /**
2  ** grxkeys.h ---- platform independent key definitions
3  **
4  ** Copyright (c) 1997 Hartmut Schirmer
5  **
6  ** This file is part of the GRX graphics library.
7  **
8  ** The GRX graphics library is free software; you can redistribute it
9  ** and/or modify it under some conditions; see the "copying.grx" file
10  ** for details.
11  **
12  ** This library is distributed in the hope that it will be useful,
13  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  **
16  **/
17 
18 #ifndef __GRKEYS_H_INCLUDED__
19 #define __GRKEYS_H_INCLUDED__
20 
21 /*
22 ** NOTES - some keys may not be available under all systems
23 **       - key values will be differ on different systems
24 */
25 
26 #ifndef __GRX20_H_INCLUDED__
27 #include <grx20.h>
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* all keycodes should fit into 16 bit unsigned */
35 typedef unsigned short GrKeyType;
36 
37 /* no key available */
38 #define GrKey_NoKey                0x0000
39 
40 /* key typed but code outside 1..GrKey_LastDefinedKeycode */
41 #define GrKey_OutsideValidRange    0x0100
42 
43 /* standard ASCII key codes */
44 #define GrKey_Control_A            0x0001
45 #define GrKey_Control_B            0x0002
46 #define GrKey_Control_C            0x0003
47 #define GrKey_Control_D            0x0004
48 #define GrKey_Control_E            0x0005
49 #define GrKey_Control_F            0x0006
50 #define GrKey_Control_G            0x0007
51 #define GrKey_Control_H            0x0008
52 #define GrKey_Control_I            0x0009
53 #define GrKey_Control_J            0x000a
54 #define GrKey_Control_K            0x000b
55 #define GrKey_Control_L            0x000c
56 #define GrKey_Control_M            0x000d
57 #define GrKey_Control_N            0x000e
58 #define GrKey_Control_O            0x000f
59 #define GrKey_Control_P            0x0010
60 #define GrKey_Control_Q            0x0011
61 #define GrKey_Control_R            0x0012
62 #define GrKey_Control_S            0x0013
63 #define GrKey_Control_T            0x0014
64 #define GrKey_Control_U            0x0015
65 #define GrKey_Control_V            0x0016
66 #define GrKey_Control_W            0x0017
67 #define GrKey_Control_X            0x0018
68 #define GrKey_Control_Y            0x0019
69 #define GrKey_Control_Z            0x001a
70 #define GrKey_Control_LBracket     0x001b
71 #define GrKey_Control_BackSlash    0x001c
72 #define GrKey_Control_RBracket     0x001d
73 #define GrKey_Control_Caret        0x001e
74 #define GrKey_Control_Underscore   0x001f
75 #define GrKey_Space                0x0020
76 #define GrKey_ExclamationPoint     0x0021
77 #define GrKey_DoubleQuote          0x0022
78 #define GrKey_Hash                 0x0023
79 #define GrKey_Dollar               0x0024
80 #define GrKey_Percent              0x0025
81 #define GrKey_Ampersand            0x0026
82 #define GrKey_Quote                0x0027
83 #define GrKey_LParen               0x0028
84 #define GrKey_RParen               0x0029
85 #define GrKey_Star                 0x002a
86 #define GrKey_Plus                 0x002b
87 #define GrKey_Comma                0x002c
88 #define GrKey_Dash                 0x002d
89 #define GrKey_Period               0x002e
90 #define GrKey_Slash                0x002f
91 #define GrKey_0                    0x0030
92 #define GrKey_1                    0x0031
93 #define GrKey_2                    0x0032
94 #define GrKey_3                    0x0033
95 #define GrKey_4                    0x0034
96 #define GrKey_5                    0x0035
97 #define GrKey_6                    0x0036
98 #define GrKey_7                    0x0037
99 #define GrKey_8                    0x0038
100 #define GrKey_9                    0x0039
101 #define GrKey_Colon                0x003a
102 #define GrKey_SemiColon            0x003b
103 #define GrKey_LAngle               0x003c
104 #define GrKey_Equals               0x003d
105 #define GrKey_RAngle               0x003e
106 #define GrKey_QuestionMark         0x003f
107 #define GrKey_At                   0x0040
108 #define GrKey_A                    0x0041
109 #define GrKey_B                    0x0042
110 #define GrKey_C                    0x0043
111 #define GrKey_D                    0x0044
112 #define GrKey_E                    0x0045
113 #define GrKey_F                    0x0046
114 #define GrKey_G                    0x0047
115 #define GrKey_H                    0x0048
116 #define GrKey_I                    0x0049
117 #define GrKey_J                    0x004a
118 #define GrKey_K                    0x004b
119 #define GrKey_L                    0x004c
120 #define GrKey_M                    0x004d
121 #define GrKey_N                    0x004e
122 #define GrKey_O                    0x004f
123 #define GrKey_P                    0x0050
124 #define GrKey_Q                    0x0051
125 #define GrKey_R                    0x0052
126 #define GrKey_S                    0x0053
127 #define GrKey_T                    0x0054
128 #define GrKey_U                    0x0055
129 #define GrKey_V                    0x0056
130 #define GrKey_W                    0x0057
131 #define GrKey_X                    0x0058
132 #define GrKey_Y                    0x0059
133 #define GrKey_Z                    0x005a
134 #define GrKey_LBracket             0x005b
135 #define GrKey_BackSlash            0x005c
136 #define GrKey_RBracket             0x005d
137 #define GrKey_Caret                0x005e
138 #define GrKey_UnderScore           0x005f
139 #define GrKey_BackQuote            0x0060
140 #define GrKey_a                    0x0061
141 #define GrKey_b                    0x0062
142 #define GrKey_c                    0x0063
143 #define GrKey_d                    0x0064
144 #define GrKey_e                    0x0065
145 #define GrKey_f                    0x0066
146 #define GrKey_g                    0x0067
147 #define GrKey_h                    0x0068
148 #define GrKey_i                    0x0069
149 #define GrKey_j                    0x006a
150 #define GrKey_k                    0x006b
151 #define GrKey_l                    0x006c
152 #define GrKey_m                    0x006d
153 #define GrKey_n                    0x006e
154 #define GrKey_o                    0x006f
155 #define GrKey_p                    0x0070
156 #define GrKey_q                    0x0071
157 #define GrKey_r                    0x0072
158 #define GrKey_s                    0x0073
159 #define GrKey_t                    0x0074
160 #define GrKey_u                    0x0075
161 #define GrKey_v                    0x0076
162 #define GrKey_w                    0x0077
163 #define GrKey_x                    0x0078
164 #define GrKey_y                    0x0079
165 #define GrKey_z                    0x007a
166 #define GrKey_LBrace               0x007b
167 #define GrKey_Pipe                 0x007c
168 #define GrKey_RBrace               0x007d
169 #define GrKey_Tilde                0x007e
170 #define GrKey_Control_Backspace    0x007f
171 
172 /* extended key codes as defined in DJGPP */
173 #define GrKey_Alt_Escape           0x0101
174 #define GrKey_Control_At           0x0103
175 #define GrKey_Alt_Backspace        0x010e
176 #define GrKey_BackTab              0x010f
177 #define GrKey_Alt_Q                0x0110
178 #define GrKey_Alt_W                0x0111
179 #define GrKey_Alt_E                0x0112
180 #define GrKey_Alt_R                0x0113
181 #define GrKey_Alt_T                0x0114
182 #define GrKey_Alt_Y                0x0115
183 #define GrKey_Alt_U                0x0116
184 #define GrKey_Alt_I                0x0117
185 #define GrKey_Alt_O                0x0118
186 #define GrKey_Alt_P                0x0119
187 #define GrKey_Alt_LBracket         0x011a
188 #define GrKey_Alt_RBracket         0x011b
189 #define GrKey_Alt_Return           0x011c
190 #define GrKey_Alt_A                0x011e
191 #define GrKey_Alt_S                0x011f
192 #define GrKey_Alt_D                0x0120
193 #define GrKey_Alt_F                0x0121
194 #define GrKey_Alt_G                0x0122
195 #define GrKey_Alt_H                0x0123
196 #define GrKey_Alt_J                0x0124
197 #define GrKey_Alt_K                0x0125
198 #define GrKey_Alt_L                0x0126
199 #define GrKey_Alt_Semicolon        0x0127
200 #define GrKey_Alt_Quote            0x0128
201 #define GrKey_Alt_Backquote        0x0129
202 #define GrKey_Alt_Backslash        0x012b
203 #define GrKey_Alt_Z                0x012c
204 #define GrKey_Alt_X                0x012d
205 #define GrKey_Alt_C                0x012e
206 #define GrKey_Alt_V                0x012f
207 #define GrKey_Alt_B                0x0130
208 #define GrKey_Alt_N                0x0131
209 #define GrKey_Alt_M                0x0132
210 #define GrKey_Alt_Comma            0x0133
211 #define GrKey_Alt_Period           0x0134
212 #define GrKey_Alt_Slash            0x0135
213 #define GrKey_Alt_KPStar           0x0137
214 #define GrKey_F1                   0x013b
215 #define GrKey_F2                   0x013c
216 #define GrKey_F3                   0x013d
217 #define GrKey_F4                   0x013e
218 #define GrKey_F5                   0x013f
219 #define GrKey_F6                   0x0140
220 #define GrKey_F7                   0x0141
221 #define GrKey_F8                   0x0142
222 #define GrKey_F9                   0x0143
223 #define GrKey_F10                  0x0144
224 #define GrKey_Home                 0x0147
225 #define GrKey_Up                   0x0148
226 #define GrKey_PageUp               0x0149
227 #define GrKey_Alt_KPMinus          0x014a
228 #define GrKey_Left                 0x014b
229 #define GrKey_Center               0x014c
230 #define GrKey_Right                0x014d
231 #define GrKey_Alt_KPPlus           0x014e
232 #define GrKey_End                  0x014f
233 #define GrKey_Down                 0x0150
234 #define GrKey_PageDown             0x0151
235 #define GrKey_Insert               0x0152
236 #define GrKey_Delete               0x0153
237 #define GrKey_Shift_F1             0x0154
238 #define GrKey_Shift_F2             0x0155
239 #define GrKey_Shift_F3             0x0156
240 #define GrKey_Shift_F4             0x0157
241 #define GrKey_Shift_F5             0x0158
242 #define GrKey_Shift_F6             0x0159
243 #define GrKey_Shift_F7             0x015a
244 #define GrKey_Shift_F8             0x015b
245 #define GrKey_Shift_F9             0x015c
246 #define GrKey_Shift_F10            0x015d
247 #define GrKey_Control_F1           0x015e
248 #define GrKey_Control_F2           0x015f
249 #define GrKey_Control_F3           0x0160
250 #define GrKey_Control_F4           0x0161
251 #define GrKey_Control_F5           0x0162
252 #define GrKey_Control_F6           0x0163
253 #define GrKey_Control_F7           0x0164
254 #define GrKey_Control_F8           0x0165
255 #define GrKey_Control_F9           0x0166
256 #define GrKey_Control_F10          0x0167
257 #define GrKey_Alt_F1               0x0168
258 #define GrKey_Alt_F2               0x0169
259 #define GrKey_Alt_F3               0x016a
260 #define GrKey_Alt_F4               0x016b
261 #define GrKey_Alt_F5               0x016c
262 #define GrKey_Alt_F6               0x016d
263 #define GrKey_Alt_F7               0x016e
264 #define GrKey_Alt_F8               0x016f
265 #define GrKey_Alt_F9               0x0170
266 #define GrKey_Alt_F10              0x0171
267 #define GrKey_Control_Print        0x0172
268 #define GrKey_Control_Left         0x0173
269 #define GrKey_Control_Right        0x0174
270 #define GrKey_Control_End          0x0175
271 #define GrKey_Control_PageDown     0x0176
272 #define GrKey_Control_Home         0x0177
273 #define GrKey_Alt_1                0x0178
274 #define GrKey_Alt_2                0x0179
275 #define GrKey_Alt_3                0x017a
276 #define GrKey_Alt_4                0x017b
277 #define GrKey_Alt_5                0x017c
278 #define GrKey_Alt_6                0x017d
279 #define GrKey_Alt_7                0x017e
280 #define GrKey_Alt_8                0x017f
281 #define GrKey_Alt_9                0x0180
282 #define GrKey_Alt_0                0x0181
283 #define GrKey_Alt_Dash             0x0182
284 #define GrKey_Alt_Equals           0x0183
285 #define GrKey_Control_PageUp       0x0184
286 #define GrKey_F11                  0x0185
287 #define GrKey_F12                  0x0186
288 #define GrKey_Shift_F11            0x0187
289 #define GrKey_Shift_F12            0x0188
290 #define GrKey_Control_F11          0x0189
291 #define GrKey_Control_F12          0x018a
292 #define GrKey_Alt_F11              0x018b
293 #define GrKey_Alt_F12              0x018c
294 #define GrKey_Control_Up           0x018d
295 #define GrKey_Control_KPDash       0x018e
296 #define GrKey_Control_Center       0x018f
297 #define GrKey_Control_KPPlus       0x0190
298 #define GrKey_Control_Down         0x0191
299 #define GrKey_Control_Insert       0x0192
300 #define GrKey_Control_Delete       0x0193
301 #define GrKey_Control_Tab          0x0194
302 #define GrKey_Control_KPSlash      0x0195
303 #define GrKey_Control_KPStar       0x0196
304 #define GrKey_Alt_KPSlash          0x01a4
305 #define GrKey_Alt_Tab              0x01a5
306 #define GrKey_Alt_Enter            0x01a6
307 
308 /* some additional codes not in DJGPP */
309 #define GrKey_Alt_LAngle           0x01b0
310 #define GrKey_Alt_RAngle           0x01b1
311 #define GrKey_Alt_At               0x01b2
312 #define GrKey_Alt_LBrace           0x01b3
313 #define GrKey_Alt_Pipe             0x01b4
314 #define GrKey_Alt_RBrace           0x01b5
315 #define GrKey_Print                0x01b6
316 #define GrKey_Shift_Insert         0x01b7
317 #define GrKey_Shift_Home           0x01b8
318 #define GrKey_Shift_End            0x01b9
319 #define GrKey_Shift_PageUp         0x01ba
320 #define GrKey_Shift_PageDown       0x01bb
321 #define GrKey_Alt_Up               0x01bc
322 #define GrKey_Alt_Left             0x01bd
323 #define GrKey_Alt_Center           0x01be
324 #define GrKey_Alt_Right            0x01c0
325 #define GrKey_Alt_Down             0x01c1
326 #define GrKey_Alt_Insert           0x01c2
327 #define GrKey_Alt_Delete           0x01c3
328 #define GrKey_Alt_Home             0x01c4
329 #define GrKey_Alt_End              0x01c5
330 #define GrKey_Alt_PageUp           0x01c6
331 #define GrKey_Alt_PageDown         0x01c7
332 #define GrKey_Shift_Up             0x01c8
333 #define GrKey_Shift_Down           0x01c9
334 #define GrKey_Shift_Right          0x01ca
335 #define GrKey_Shift_Left           0x01cb
336 
337 /* this may be usefull for table allocation ... */
338 #define GrKey_LastDefinedKeycode   GrKey_Shift_Left
339 
340 /* some well known synomyms */
341 #define GrKey_BackSpace            GrKey_Control_H
342 #define GrKey_Tab                  GrKey_Control_I
343 #define GrKey_LineFeed             GrKey_Control_J
344 #define GrKey_Escape               GrKey_Control_LBracket
345 #define GrKey_Return               GrKey_Control_M
346 
347 /*
348 ** new functions to replace the old style
349 **   kbhit / getch / getkey / getxkey / getkbstat
350 ** keyboard interface
351 */
352 extern int GrKeyPressed(void);
353 extern GrKeyType GrKeyRead(void);
354 extern int GrKeyStat(void);
355 
356 /* some compatibility interface here ?? */
357 /* eg., #define kbhit() GrKeyPressed() ?? */
358 
359 #ifdef __cplusplus
360 }
361 #endif
362 
363 #endif /* whole file */
364