OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * Defines the keycode values for keys that are returned by | |
7 * KeyboardEvent.keyCode. | |
8 * | |
9 * Important note: There is substantial divergence in how different browsers | |
10 * handle keycodes and their variants in different locales/keyboard layouts. We | |
11 * provide these constants to help make code processing keys more readable. | |
12 */ | |
13 abstract class KeyCode { | |
14 // These constant names were borrowed from Closure's Keycode enumeration | |
15 // class. | |
16 // http://closure-library.googlecode.com/svn/docs/closure_goog_events_keycodes .js.source.html | |
17 static final int WIN_KEY_FF_LINUX = 0; | |
18 static final int MAC_ENTER = 3; | |
19 static final int BACKSPACE = 8; | |
20 static final int TAB = 9; | |
21 /** NUM_CENTER is also NUMLOCK for FF and Safari on Mac. */ | |
Emily Fortuna
2012/11/02 23:03:17
This is the one difference -- I had defined NUMLOC
| |
22 static final int NUM_CENTER = 12; | |
23 static final int ENTER = 13; | |
24 static final int SHIFT = 16; | |
25 static final int CTRL = 17; | |
26 static final int ALT = 18; | |
27 static final int PAUSE = 19; | |
28 static final int CAPS_LOCK = 20; | |
29 static final int ESC = 27; | |
30 static final int SPACE = 32; | |
31 static final int PAGE_UP = 33; | |
32 static final int PAGE_DOWN = 34; | |
33 static final int END = 35; | |
34 static final int HOME = 36; | |
35 static final int LEFT = 37; | |
36 static final int UP = 38; | |
37 static final int RIGHT = 39; | |
38 static final int DOWN = 40; | |
39 static final int NUM_NORTH_EAST = 33; | |
40 static final int NUM_SOUTH_EAST = 34; | |
41 static final int NUM_SOUTH_WEST = 35; | |
42 static final int NUM_NORTH_WEST = 36; | |
43 static final int NUM_WEST = 37; | |
44 static final int NUM_NORTH = 38; | |
45 static final int NUM_EAST = 39; | |
46 static final int NUM_SOUTH = 40; | |
47 static final int PRINT_SCREEN = 44; | |
48 static final int INSERT = 45; | |
49 static final int NUM_INSERT = 45; | |
50 static final int DELETE = 46; | |
51 static final int NUM_DELETE = 46; | |
52 static final int ZERO = 48; | |
53 static final int ONE = 49; | |
54 static final int TWO = 50; | |
55 static final int THREE = 51; | |
56 static final int FOUR = 52; | |
57 static final int FIVE = 53; | |
58 static final int SIX = 54; | |
59 static final int SEVEN = 55; | |
60 static final int EIGHT = 56; | |
61 static final int NINE = 57; | |
62 static final int FF_SEMICOLON = 59; | |
63 static final int FF_EQUALS = 61; | |
64 /** | |
65 * CAUTION: The question mark is for US-keyboard layouts. It varies | |
66 * for other locales and keyboard layouts. | |
67 */ | |
68 static final int QUESTION_MARK = 63; | |
69 static final int A = 65; | |
70 static final int B = 66; | |
71 static final int C = 67; | |
72 static final int D = 68; | |
73 static final int E = 69; | |
74 static final int F = 70; | |
75 static final int G = 71; | |
76 static final int H = 72; | |
77 static final int I = 73; | |
78 static final int J = 74; | |
79 static final int K = 75; | |
80 static final int L = 76; | |
81 static final int M = 77; | |
82 static final int N = 78; | |
83 static final int O = 79; | |
84 static final int P = 80; | |
85 static final int Q = 81; | |
86 static final int R = 82; | |
87 static final int S = 83; | |
88 static final int T = 84; | |
89 static final int U = 85; | |
90 static final int V = 86; | |
91 static final int W = 87; | |
92 static final int X = 88; | |
93 static final int Y = 89; | |
94 static final int Z = 90; | |
95 static final int META = 91; | |
96 static final int WIN_KEY_LEFT = 91; | |
97 static final int WIN_KEY_RIGHT = 92; | |
98 static final int CONTEXT_MENU = 93; | |
99 static final int NUM_ZERO = 96; | |
100 static final int NUM_ONE = 97; | |
101 static final int NUM_TWO = 98; | |
102 static final int NUM_THREE = 99; | |
103 static final int NUM_FOUR = 100; | |
104 static final int NUM_FIVE = 101; | |
105 static final int NUM_SIX = 102; | |
106 static final int NUM_SEVEN = 103; | |
107 static final int NUM_EIGHT = 104; | |
108 static final int NUM_NINE = 105; | |
109 static final int NUM_MULTIPLY = 106; | |
110 static final int NUM_PLUS = 107; | |
111 static final int NUM_MINUS = 109; | |
112 static final int NUM_PERIOD = 110; | |
113 static final int NUM_DIVISION = 111; | |
114 static final int F1 = 112; | |
115 static final int F2 = 113; | |
116 static final int F3 = 114; | |
117 static final int F4 = 115; | |
118 static final int F5 = 116; | |
119 static final int F6 = 117; | |
120 static final int F7 = 118; | |
121 static final int F8 = 119; | |
122 static final int F9 = 120; | |
123 static final int F10 = 121; | |
124 static final int F11 = 122; | |
125 static final int F12 = 123; | |
126 static final int NUMLOCK = 144; | |
127 static final int SCROLL_LOCK = 145; | |
128 | |
129 // OS-specific media keys like volume controls and browser controls. | |
130 static final int FIRST_MEDIA_KEY = 166; | |
131 static final int LAST_MEDIA_KEY = 183; | |
132 | |
133 /** | |
134 * CAUTION: This constant requires localization for other locales and keyboard | |
135 * layouts. | |
136 */ | |
137 static final int SEMICOLON = 186; | |
138 /** | |
139 * CAUTION: This constant requires localization for other locales and keyboard | |
140 * layouts. | |
141 */ | |
142 static final int DASH = 189; | |
143 /** | |
144 * CAUTION: This constant requires localization for other locales and keyboard | |
145 * layouts. | |
146 */ | |
147 static final int EQUALS = 187; | |
148 /** | |
149 * CAUTION: This constant requires localization for other locales and keyboard | |
150 * layouts. | |
151 */ | |
152 static final int COMMA = 188; | |
153 /** | |
154 * CAUTION: This constant requires localization for other locales and keyboard | |
155 * layouts. | |
156 */ | |
157 static final int PERIOD = 190; | |
158 /** | |
159 * CAUTION: This constant requires localization for other locales and keyboard | |
160 * layouts. | |
161 */ | |
162 static final int SLASH = 191; | |
163 /** | |
164 * CAUTION: This constant requires localization for other locales and keyboard | |
165 * layouts. | |
166 */ | |
167 static final int APOSTROPHE = 192; | |
168 /** | |
169 * CAUTION: This constant requires localization for other locales and keyboard | |
170 * layouts. | |
171 */ | |
172 static final int TILDE = 192; | |
173 /** | |
174 * CAUTION: This constant requires localization for other locales and keyboard | |
175 * layouts. | |
176 */ | |
177 static final int SINGLE_QUOTE = 222; | |
178 /** | |
179 * CAUTION: This constant requires localization for other locales and keyboard | |
180 * layouts. | |
181 */ | |
182 static final int OPEN_SQUARE_BRACKET = 219; | |
183 /** | |
184 * CAUTION: This constant requires localization for other locales and keyboard | |
185 * layouts. | |
186 */ | |
187 static final int BACKSLASH = 220; | |
188 /** | |
189 * CAUTION: This constant requires localization for other locales and keyboard | |
190 * layouts. | |
191 */ | |
192 static final int CLOSE_SQUARE_BRACKET = 221; | |
193 static final int WIN_KEY = 224; | |
194 static final int MAC_FF_META = 224; | |
195 static final int WIN_IME = 229; | |
196 } | |
OLD | NEW |