1/*
2 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef KeyboardCodes_h
29#define KeyboardCodes_h
30
31#include <wtf/Platform.h>
32
33// FIXME: We should get rid of these Chromium-related ifdefs.
34#if PLATFORM(CHROMIUM)
35
36#if OS(WINDOWS)
37#include "KeyboardCodesWin.h"
38#else
39#include "KeyboardCodesPosix.h"
40#endif
41
42#else
43
44namespace WebCore {
45
46#if !OS(WINDOWS)
47// VK_LBUTTON (01) Left mouse button
48// VK_RBUTTON (02) Right mouse button
49// VK_CANCEL (03) Control-break processing
50// VK_MBUTTON (04) Middle mouse button (three-button mouse)
51// VK_XBUTTON1 (05)
52// VK_XBUTTON2 (06)
53
54// VK_BACK (08) BACKSPACE key
55const int VK_BACK = 0x08;
56
57// VK_TAB (09) TAB key
58const int VK_TAB = 0x09;
59
60// VK_CLEAR (0C) CLEAR key
61const int VK_CLEAR = 0x0C;
62
63// VK_RETURN (0D)
64const int VK_RETURN = 0x0D;
65
66// VK_SHIFT (10) SHIFT key
67const int VK_SHIFT = 0x10;
68
69// VK_CONTROL (11) CTRL key
70const int VK_CONTROL = 0x11;
71
72// VK_MENU (12) ALT key
73const int VK_MENU = 0x12;
74
75// VK_PAUSE (13) PAUSE key
76const int VK_PAUSE = 0x13;
77
78// VK_CAPITAL (14) CAPS LOCK key
79const int VK_CAPITAL = 0x14;
80
81// VK_KANA (15) Input Method Editor (IME) Kana mode
82const int VK_KANA = 0x15;
83
84// VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
85// VK_HANGUL (15) IME Hangul mode
86const int VK_HANGUL = 0x15;
87
88// VK_JUNJA (17) IME Junja mode
89const int VK_JUNJA = 0x17;
90
91// VK_FINAL (18) IME final mode
92const int VK_FINAL = 0x18;
93
94// VK_HANJA (19) IME Hanja mode
95const int VK_HANJA = 0x19;
96
97// VK_KANJI (19) IME Kanji mode
98const int VK_KANJI = 0x19;
99
100// VK_ESCAPE (1B) ESC key
101const int VK_ESCAPE = 0x1B;
102
103// VK_CONVERT (1C) IME convert
104const int VK_CONVERT = 0x1C;
105
106// VK_NONCONVERT (1D) IME nonconvert
107const int VK_NONCONVERT = 0x1D;
108
109// VK_ACCEPT (1E) IME accept
110const int VK_ACCEPT = 0x1E;
111
112// VK_MODECHANGE (1F) IME mode change request
113const int VK_MODECHANGE = 0x1F;
114
115// VK_SPACE (20) SPACEBAR
116const int VK_SPACE = 0x20;
117
118// VK_PRIOR (21) PAGE UP key
119const int VK_PRIOR = 0x21;
120
121// VK_NEXT (22) PAGE DOWN key
122const int VK_NEXT = 0x22;
123
124// VK_END (23) END key
125const int VK_END = 0x23;
126
127// VK_HOME (24) HOME key
128const int VK_HOME = 0x24;
129
130// VK_LEFT (25) LEFT ARROW key
131const int VK_LEFT = 0x25;
132
133// VK_UP (26) UP ARROW key
134const int VK_UP = 0x26;
135
136// VK_RIGHT (27) RIGHT ARROW key
137const int VK_RIGHT = 0x27;
138
139// VK_DOWN (28) DOWN ARROW key
140const int VK_DOWN = 0x28;
141
142// VK_SELECT (29) SELECT key
143const int VK_SELECT = 0x29;
144
145// VK_PRINT (2A) PRINT key
146const int VK_PRINT = 0x2A;
147
148// VK_EXECUTE (2B) EXECUTE key
149const int VK_EXECUTE = 0x2B;
150
151// VK_SNAPSHOT (2C) PRINT SCREEN key
152const int VK_SNAPSHOT = 0x2C;
153
154// VK_INSERT (2D) INS key
155const int VK_INSERT = 0x2D;
156
157// VK_DELETE (2E) DEL key
158const int VK_DELETE = 0x2E;
159
160// VK_HELP (2F) HELP key
161const int VK_HELP = 0x2F;
162
163#endif // OS(WINDOWS)
164
165// (30) 0 key
166const int VK_0 = 0x30;
167
168// (31) 1 key
169const int VK_1 = 0x31;
170
171// (32) 2 key
172const int VK_2 = 0x32;
173
174// (33) 3 key
175const int VK_3 = 0x33;
176
177// (34) 4 key
178const int VK_4 = 0x34;
179
180// (35) 5 key;
181
182const int VK_5 = 0x35;
183
184// (36) 6 key
185const int VK_6 = 0x36;
186
187// (37) 7 key
188const int VK_7 = 0x37;
189
190// (38) 8 key
191const int VK_8 = 0x38;
192
193// (39) 9 key
194const int VK_9 = 0x39;
195
196// (41) A key
197const int VK_A = 0x41;
198
199// (42) B key
200const int VK_B = 0x42;
201
202// (43) C key
203const int VK_C = 0x43;
204
205// (44) D key
206const int VK_D = 0x44;
207
208// (45) E key
209const int VK_E = 0x45;
210
211// (46) F key
212const int VK_F = 0x46;
213
214// (47) G key
215const int VK_G = 0x47;
216
217// (48) H key
218const int VK_H = 0x48;
219
220// (49) I key
221const int VK_I = 0x49;
222
223// (4A) J key
224const int VK_J = 0x4A;
225
226// (4B) K key
227const int VK_K = 0x4B;
228
229// (4C) L key
230const int VK_L = 0x4C;
231
232// (4D) M key
233const int VK_M = 0x4D;
234
235// (4E) N key
236const int VK_N = 0x4E;
237
238// (4F) O key
239const int VK_O = 0x4F;
240
241// (50) P key
242const int VK_P = 0x50;
243
244// (51) Q key
245const int VK_Q = 0x51;
246
247// (52) R key
248const int VK_R = 0x52;
249
250// (53) S key
251const int VK_S = 0x53;
252
253// (54) T key
254const int VK_T = 0x54;
255
256// (55) U key
257const int VK_U = 0x55;
258
259// (56) V key
260const int VK_V = 0x56;
261
262// (57) W key
263const int VK_W = 0x57;
264
265// (58) X key
266const int VK_X = 0x58;
267
268// (59) Y key
269const int VK_Y = 0x59;
270
271// (5A) Z key
272const int VK_Z = 0x5A;
273
274#if !OS(WINDOWS)
275
276// VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard)
277const int VK_LWIN = 0x5B;
278
279// VK_RWIN (5C) Right Windows key (Natural keyboard)
280const int VK_RWIN = 0x5C;
281
282// VK_APPS (5D) Applications key (Natural keyboard)
283const int VK_APPS = 0x5D;
284
285// VK_SLEEP (5F) Computer Sleep key
286const int VK_SLEEP = 0x5F;
287
288// VK_NUMPAD0 (60) Numeric keypad 0 key
289const int VK_NUMPAD0 = 0x60;
290
291// VK_NUMPAD1 (61) Numeric keypad 1 key
292const int VK_NUMPAD1 = 0x61;
293
294// VK_NUMPAD2 (62) Numeric keypad 2 key
295const int VK_NUMPAD2 = 0x62;
296
297// VK_NUMPAD3 (63) Numeric keypad 3 key
298const int VK_NUMPAD3 = 0x63;
299
300// VK_NUMPAD4 (64) Numeric keypad 4 key
301const int VK_NUMPAD4 = 0x64;
302
303// VK_NUMPAD5 (65) Numeric keypad 5 key
304const int VK_NUMPAD5 = 0x65;
305
306// VK_NUMPAD6 (66) Numeric keypad 6 key
307const int VK_NUMPAD6 = 0x66;
308
309// VK_NUMPAD7 (67) Numeric keypad 7 key
310const int VK_NUMPAD7 = 0x67;
311
312// VK_NUMPAD8 (68) Numeric keypad 8 key
313const int VK_NUMPAD8 = 0x68;
314
315// VK_NUMPAD9 (69) Numeric keypad 9 key
316const int VK_NUMPAD9 = 0x69;
317
318// VK_MULTIPLY (6A) Multiply key
319const int VK_MULTIPLY = 0x6A;
320
321// VK_ADD (6B) Add key
322const int VK_ADD = 0x6B;
323
324// VK_SEPARATOR (6C) Separator key
325const int VK_SEPARATOR = 0x6C;
326
327// VK_SUBTRACT (6D) Subtract key
328const int VK_SUBTRACT = 0x6D;
329
330// VK_DECIMAL (6E) Decimal key
331const int VK_DECIMAL = 0x6E;
332
333// VK_DIVIDE (6F) Divide key
334const int VK_DIVIDE = 0x6F;
335
336// VK_F1 (70) F1 key
337const int VK_F1 = 0x70;
338
339// VK_F2 (71) F2 key
340const int VK_F2 = 0x71;
341
342// VK_F3 (72) F3 key
343const int VK_F3 = 0x72;
344
345// VK_F4 (73) F4 key
346const int VK_F4 = 0x73;
347
348// VK_F5 (74) F5 key
349const int VK_F5 = 0x74;
350
351// VK_F6 (75) F6 key
352const int VK_F6 = 0x75;
353
354// VK_F7 (76) F7 key
355const int VK_F7 = 0x76;
356
357// VK_F8 (77) F8 key
358const int VK_F8 = 0x77;
359
360// VK_F9 (78) F9 key
361const int VK_F9 = 0x78;
362
363// VK_F10 (79) F10 key
364const int VK_F10 = 0x79;
365
366// VK_F11 (7A) F11 key
367const int VK_F11 = 0x7A;
368
369// VK_F12 (7B) F12 key
370const int VK_F12 = 0x7B;
371
372// VK_F13 (7C) F13 key
373const int VK_F13 = 0x7C;
374
375// VK_F14 (7D) F14 key
376const int VK_F14 = 0x7D;
377
378// VK_F15 (7E) F15 key
379const int VK_F15 = 0x7E;
380
381// VK_F16 (7F) F16 key
382const int VK_F16 = 0x7F;
383
384// VK_F17 (80H) F17 key
385const int VK_F17 = 0x80;
386
387// VK_F18 (81H) F18 key
388const int VK_F18 = 0x81;
389
390// VK_F19 (82H) F19 key
391const int VK_F19 = 0x82;
392
393// VK_F20 (83H) F20 key
394const int VK_F20 = 0x83;
395
396// VK_F21 (84H) F21 key
397const int VK_F21 = 0x84;
398
399// VK_F22 (85H) F22 key
400const int VK_F22 = 0x85;
401
402// VK_F23 (86H) F23 key
403const int VK_F23 = 0x86;
404
405// VK_F24 (87H) F24 key
406const int VK_F24 = 0x87;
407
408// VK_NUMLOCK (90) NUM LOCK key
409const int VK_NUMLOCK = 0x90;
410
411// VK_SCROLL (91) SCROLL LOCK key
412const int VK_SCROLL = 0x91;
413
414// VK_LSHIFT (A0) Left SHIFT key
415const int VK_LSHIFT = 0xA0;
416
417// VK_RSHIFT (A1) Right SHIFT key
418const int VK_RSHIFT = 0xA1;
419
420// VK_LCONTROL (A2) Left CONTROL key
421const int VK_LCONTROL = 0xA2;
422
423// VK_RCONTROL (A3) Right CONTROL key
424const int VK_RCONTROL = 0xA3;
425
426// VK_LMENU (A4) Left MENU key
427const int VK_LMENU = 0xA4;
428
429// VK_RMENU (A5) Right MENU key
430const int VK_RMENU = 0xA5;
431
432// VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
433const int VK_BROWSER_BACK = 0xA6;
434
435// VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
436const int VK_BROWSER_FORWARD = 0xA7;
437
438// VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
439const int VK_BROWSER_REFRESH = 0xA8;
440
441// VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
442const int VK_BROWSER_STOP = 0xA9;
443
444// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
445const int VK_BROWSER_SEARCH = 0xAA;
446
447// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
448const int VK_BROWSER_FAVORITES = 0xAB;
449
450// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
451const int VK_BROWSER_HOME = 0xAC;
452
453// VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
454const int VK_VOLUME_MUTE = 0xAD;
455
456// VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
457const int VK_VOLUME_DOWN = 0xAE;
458
459// VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
460const int VK_VOLUME_UP = 0xAF;
461
462// VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
463const int VK_MEDIA_NEXT_TRACK = 0xB0;
464
465// VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
466const int VK_MEDIA_PREV_TRACK = 0xB1;
467
468// VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
469const int VK_MEDIA_STOP = 0xB2;
470
471// VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
472const int VK_MEDIA_PLAY_PAUSE = 0xB3;
473
474// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
475const int VK_MEDIA_LAUNCH_MAIL = 0xB4;
476
477// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
478const int VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5;
479
480// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
481const int VK_MEDIA_LAUNCH_APP1 = 0xB6;
482
483// VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
484const int VK_MEDIA_LAUNCH_APP2 = 0xB7;
485
486#endif // !OS(WINDOWS)
487
488#if !OS(WINDOWS) || OS(WINCE)
489
490// VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
491const int VK_OEM_1 = 0xBA;
492
493// VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
494const int VK_OEM_PLUS = 0xBB;
495
496// VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
497const int VK_OEM_COMMA = 0xBC;
498
499// VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
500const int VK_OEM_MINUS = 0xBD;
501
502// VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
503const int VK_OEM_PERIOD = 0xBE;
504
505// VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
506const int VK_OEM_2 = 0xBF;
507
508// VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
509const int VK_OEM_3 = 0xC0;
510
511// VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
512const int VK_OEM_4 = 0xDB;
513
514// VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
515const int VK_OEM_5 = 0xDC;
516
517// VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
518const int VK_OEM_6 = 0xDD;
519
520// VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
521const int VK_OEM_7 = 0xDE;
522
523// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
524const int VK_OEM_8 = 0xDF;
525
526#endif // !OS(WINDOWS) || OS(WINCE)
527
528#if !OS(WINDOWS)
529
530// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
531const int VK_OEM_102 = 0xE2;
532
533// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
534const int VK_PROCESSKEY = 0xE5;
535
536// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
537const int VK_PACKET = 0xE7;
538
539// VK_ATTN (F6) Attn key
540const int VK_ATTN = 0xF6;
541
542// VK_CRSEL (F7) CrSel key
543const int VK_CRSEL = 0xF7;
544
545// VK_EXSEL (F8) ExSel key
546const int VK_EXSEL = 0xF8;
547
548// VK_EREOF (F9) Erase EOF key
549const int VK_EREOF = 0xF9;
550
551// VK_PLAY (FA) Play key
552const int VK_PLAY = 0xFA;
553
554// VK_ZOOM (FB) Zoom key
555const int VK_ZOOM = 0xFB;
556
557// VK_NONAME (FC) Reserved for future use
558const int VK_NONAME = 0xFC;
559
560// VK_PA1 (FD) PA1 key
561const int VK_PA1 = 0xFD;
562
563// VK_OEM_CLEAR (FE) Clear key
564const int VK_OEM_CLEAR = 0xFE;
565
566const int VK_UNKNOWN = 0;
567
568#endif // OS(WINDOWS)
569
570}
571
572#endif // PLATFORM(CHROMIUM)
573
574#endif
575