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