1
2
3
4
5
6 using System;
7
8 namespace System.Windows
9 {
10 public const byte VK_LBUTTON = 0x01u;
11 public const byte VK_RBUTTON = 0x02u;
12 public const byte VK_CANCEL = 0x03u;
13 public const byte VK_MBUTTON = 0x04u;
14 public const byte VK_XBUTTON1 = 0x05u;
15 public const byte VK_XBUTTON2 = 0x06u;
16 public const byte VK_BACK = 0x08u;
17 public const byte VK_TAB = 0x09u;
18 public const byte VK_CLEAR = 0x0Cu;
19 public const byte VK_RETURN = 0x0Du;
20 public const byte VK_SHIFT = 0x10u;
21 public const byte VK_CONTROL = 0x11u;
22 public const byte VK_MENU = 0x12u;
23 public const byte VK_PAUSE = 0x13u;
24 public const byte VK_CAPITAL = 0x14u;
25 public const byte VK_KANA = 0x15u;
26 public const byte VK_HANGUEL = 0x15u;
27 public const byte VK_HANGUL = 0x15u;
28 public const byte VK_IME_ON = 0x16u;
29 public const byte VK_JUNJA = 0x17u;
30 public const byte VK_FINAL = 0x18u;
31 public const byte VK_HANJA = 0x19u;
32 public const byte VK_KANJI = 0x19u;
33 public const byte VK_IME_OFF = 0x1Au;
34 public const byte VK_ESCAPE = 0x1Bu;
35 public const byte VK_CONVERT = 0x1Cu;
36 public const byte VK_NONCONVERT = 0x1Du;
37 public const byte VK_ACCEPT = 0x1Eu;
38 public const byte VK_MODECHANGE = 0x1Fu;
39 public const byte VK_SPACE = 0x20u;
40 public const byte VK_PRIOR = 0x21u;
41 public const byte VK_NEXT = 0x22u;
42 public const byte VK_END = 0x23u;
43 public const byte VK_HOME = 0x24u;
44 public const byte VK_LEFT = 0x25u;
45 public const byte VK_UP = 0x26u;
46 public const byte VK_RIGHT = 0x27u;
47 public const byte VK_DOWN = 0x28u;
48 public const byte VK_SELECT = 0x29u;
49 public const byte VK_PRINT = 0x2Au;
50 public const byte VK_EXECUTE = 0x2Bu;
51 public const byte VK_SNAPSHOT = 0x2Cu;
52 public const byte VK_INSERT = 0x2Du;
53 public const byte VK_DELETE = 0x2Eu;
54 public const byte VK_HELP = 0x2Fu;
55 public const byte VK_0 = 0x30u;
56 public const byte VK_1 = 0x31u;
57 public const byte VK_2 = 0x32u;
58 public const byte VK_3 = 0x33u;
59 public const byte VK_4 = 0x34u;
60 public const byte VK_5 = 0x35u;
61 public const byte VK_6 = 0x36u;
62 public const byte VK_7 = 0x37u;
63 public const byte VK_8 = 0x38u;
64 public const byte VK_9 = 0x39u;
65 public const byte VK_A = 0x41u;
66 public const byte VK_B = 0x42u;
67 public const byte VK_C = 0x43u;
68 public const byte VK_D = 0x44u;
69 public const byte VK_E = 0x45u;
70 public const byte VK_F = 0x46u;
71 public const byte VK_G = 0x47u;
72 public const byte VK_H = 0x48u;
73 public const byte VK_I = 0x49u;
74 public const byte VK_J = 0x4Au;
75 public const byte VK_K = 0x4Bu;
76 public const byte VK_L = 0x4Cu;
77 public const byte VK_M = 0x4Du;
78 public const byte VK_N = 0x4Eu;
79 public const byte VK_O = 0x4Fu;
80 public const byte VK_P = 0x50u;
81 public const byte VK_Q = 0x51u;
82 public const byte VK_R = 0x52u;
83 public const byte VK_S = 0x53u;
84 public const byte VK_T = 0x54u;
85 public const byte VK_U = 0x55u;
86 public const byte VK_V = 0x56u;
87 public const byte VK_W = 0x57u;
88 public const byte VK_X = 0x58u;
89 public const byte VK_Y = 0x59u;
90 public const byte VK_Z = 0x5Au;
91 public const byte VK_LWIN = 0x5Bu;
92 public const byte VK_RWIN = 0x5Cu;
93 public const byte VK_APPS = 0x5Du;
94 public const byte VK_SLEEP = 0x5Fu;
95 public const byte VK_NUMPAD0 = 0x60u;
96 public const byte VK_NUMPAD1 = 0x61u;
97 public const byte VK_NUMPAD2 = 0x62u;
98 public const byte VK_NUMPAD3 = 0x63u;
99 public const byte VK_NUMPAD4 = 0x64u;
100 public const byte VK_NUMPAD5 = 0x65u;
101 public const byte VK_NUMPAD6 = 0x66u;
102 public const byte VK_NUMPAD7 = 0x67u;
103 public const byte VK_NUMPAD8 = 0x68u;
104 public const byte VK_NUMPAD9 = 0x69u;
105 public const byte VK_MULTIPLY = 0x6Au;
106 public const byte VK_ADD = 0x6Bu;
107 public const byte VK_SEPARATOR = 0x6Cu;
108 public const byte VK_SUBTRACT = 0x6Du;
109 public const byte VK_DECIMAL = 0x6Eu;
110 public const byte VK_DIVIDE = 0x6Fu;
111 public const byte VK_F1 = 0x70u;
112 public const byte VK_F2 = 0x71u;
113 public const byte VK_F3 = 0x72u;
114 public const byte VK_F4 = 0x73u;
115 public const byte VK_F5 = 0x74u;
116 public const byte VK_F6 = 0x75u;
117 public const byte VK_F7 = 0x76u;
118 public const byte VK_F8 = 0x77u;
119 public const byte VK_F9 = 0x78u;
120 public const byte VK_F10 = 0x79u;
121 public const byte VK_F11 = 0x7Au;
122 public const byte VK_F12 = 0x7Bu;
123 public const byte VK_F13 = 0x7Cu;
124 public const byte VK_F14 = 0x7Du;
125 public const byte VK_F15 = 0x7Eu;
126 public const byte VK_F16 = 0x7Fu;
127 public const byte VK_F17 = 0x80u;
128 public const byte VK_F18 = 0x81u;
129 public const byte VK_F19 = 0x82u;
130 public const byte VK_F20 = 0x83u;
131 public const byte VK_F21 = 0x84u;
132 public const byte VK_F22 = 0x85u;
133 public const byte VK_F23 = 0x86u;
134 public const byte VK_F24 = 0x87u;
135 public const byte VK_NUMLOCK = 0x90u;
136 public const byte VK_SCROLL = 0x91u;
137 public const byte VK_LSHIFT = 0xA0u;
138 public const byte VK_RSHIFT = 0xA1u;
139 public const byte VK_LCONTROL = 0xA2u;
140 public const byte VK_RCONTROL = 0xA3u;
141 public const byte VK_LMENU = 0xA4u;
142 public const byte VK_RMENU = 0xA5u;
143 public const byte VK_BROWSER_BACK = 0xA6u;
144 public const byte VK_BROWSER_FORWARD = 0xA7u;
145 public const byte VK_BROWSER_REFRESH = 0xA8u;
146 public const byte VK_BROWSER_STOP = 0xA9u;
147 public const byte VK_BROWSER_SEARCH = 0xAAu;
148 public const byte VK_BROWSER_FAVORITES = 0xABu;
149 public const byte VK_BROWSER_HOME = 0xACu;
150 public const byte VK_VOLUME_MUTE = 0xADu;
151 public const byte VK_VOLUME_DOWN = 0xAEu;
152 public const byte VK_VOLUME_UP = 0xAFu;
153 public const byte VK_MEDIA_NEXT_TRACK = 0xB0u;
154 public const byte VK_MEDIA_PREV_TRACK = 0xB1u;
155 public const byte VK_MEDIA_STOP = 0xB2u;
156 public const byte VK_MEDIA_PLAY_PAUSE = 0xB3u;
157 public const byte VK_LAUNCH_MAIL = 0xB4u;
158 public const byte VK_LAUNCH_MEDIA_SELECT = 0xB5u;
159 public const byte VK_LAUNCH_APP1 = 0xB6u;
160 public const byte VK_LAUNCH_APP2 = 0xB7u;
161 public const byte VK_OEM_1 = 0xBAu;
162 public const byte VK_OEM_PLUS = 0xBBu;
163 public const byte VK_OEM_COMMA = 0xBCu;
164 public const byte VK_OEM_MINUS = 0xBDu;
165 public const byte VK_OEM_PEDIOD = 0xBEu;
166 public const byte VK_OEM_2 = 0xBFu;
167 public const byte VK_OEM_3 = 0xC0u;
168 public const byte VK_OEM_4 = 0xDBu;
169 public const byte VK_OEM_5 = 0xDCu;
170 public const byte VK_OEM_6 = 0xDDu;
171 public const byte VK_OEM_7 = 0xDEu;
172 public const byte VK_OEM_8 = 0xDFu;
173 public const byte VK_OEM_102 = 0xE2u;
174 public const byte VK_PROCESSKEY = 0xE5u;
175 public const byte VK_PACKET = 0xE7u;
176 public const byte VK_ATTN = 0xF6u;
177 public const byte VK_CRSEL = 0xF7u;
178 public const byte VK_EXSEL = 0xF8u;
179 public const byte VK_PLAY = 0xFAu;
180 public const byte VK_ZOOM = 0xFBu;
181 public const byte VK_PA1 = 0xFDu;
182 public const byte VK_OEM_CLEAR = 0xFEu;
183
184 public enum Keys : int
185 {
186 a = 65,
187 add = 107,
188 altModifier = 262144,
189 apps = 93,
190 attn = 246,
191 b = 66,
192 back = 8,
193 browserBack = 166,
194 browserFavorites = 171,
195 browserForward = 167,
196 browserHome = 172,
197 browserRefresh = 168,
198 browserSearch = 170,
199 browserStop = 169,
200 c = 67,
201 cancel = 3,
202 capital = 20,
203 capsLock = 20,
204 clear = 12,
205 controlModifier = 131072,
206 controlKey = 17,
207 crsel = 247,
208 d = 68,
209 d0 = 48,
210 d1 = 49,
211 d2 = 50,
212 d3 = 51,
213 d4 = 52,
214 d5 = 53,
215 d6 = 54,
216 d7 = 55,
217 d8 = 56,
218 d9 = 57,
219 decimal = 110,
220 delete_ = 46,
221 divide = 111,
222 down = 40,
223 e = 69,
224 end = 35,
225 enter = 13,
226 eraseEof = 249,
227 escape = 27,
228 execute = 43,
229 exsel = 248,
230 f = 70,
231 f1 = 112,
232 f10 = 121,
233 f11 = 122,
234 f12 = 123,
235 f13 = 124,
236 f14 = 125,
237 f15 = 126,
238 f16 = 127,
239 f17 = 128,
240 f18 = 129,
241 f19 = 130,
242 f2 = 113,
243 f20 = 131,
244 f21 = 132,
245 f22 = 133,
246 f23 = 134,
247 f24 = 135,
248 f3 = 114,
249 f4 = 115,
250 f5 = 116,
251 f6 = 117,
252 f7 = 118,
253 f8 = 119,
254 f9 = 120,
255 finalMode = 24,
256 g = 71,
257 h = 72,
258 hanguelMode = 21,
259 hangulMode = 21,
260 hanjaMode = 25,
261 help = 47,
262 home = 36,
263 i = 73,
264 imeAccept = 30,
265 imeConvert = 28,
266 imeModeChange = 31,
267 imeNonconvert = 29,
268 insert = 45,
269 j = 74,
270 junjaMode = 23,
271 k = 75,
272 kanaMode = 21,
273 kanjiMode = 25,
274 keyCode = 65535,
275 l = 75,
276 launchApplication1 = 182,
277 launchApplication2 = 183,
278 launchMail = 180,
279 lButton = 1,
280 lControlKey = 162,
281 left = 37,
282 lineFeed = 10,
283 lMenu = 164,
284 lShiftKey = 160,
285 lWin = 91,
286 m = 77,
287 mButton = 4,
288 mediaNextTrack = 176,
289 mediaPlayPause = 179,
290 mediaPreviousTrack = 177,
291 mediaStop = 178,
292 menu = 18,
293 modifiers = -65536,
294 multiply = 106,
295 n = 78,
296 next = 34,
297 noName = 252,
298 none = 0,
299 numLock = 144,
300 numPad0 = 96,
301 numPad1 = 97,
302 numPad2 = 98,
303 numPad3 = 99,
304 numPad4 = 100,
305 numPad5 = 101,
306 numPad6 = 102,
307 numPad7 = 103,
308 numPad8 = 104,
309 numPad9 = 105,
310 o = 79,
311 oem1 = 186,
312 oem102 = 226,
313 oem2 = 191,
314 oem3 = 192,
315 oem4 = 219,
316 oem5 = 220,
317 oem6 = 221,
318 oem7 = 222,
319 oem8 = 223,
320 oemBackslash = 226,
321 oemClear = 254,
322 oemCloseBrackets = 221,
323 oemComma = 188,
324 oemMinus = 189,
325 oemOpenBrackets = 219,
326 oemPediod = 190,
327 oemPipe = 220,
328 oemPlus = 187,
329 oemQuestion = 191,
330 oemQuotes = 222,
331 oemSemicolon = 186,
332 oemTilde = 192,
333 p = 80,
334 pa1 = 253,
335 packet = 231,
336 pageDown = 34,
337 pageUp = 33,
338 pause = 19,
339 play = 250,
340 print = 42,
341 printScreen = 44,
342 prior = 33,
343 processKey = 229,
344 q = 81,
345 r = 82,
346 rButton = 2,
347 rControlKey = 163,
348 return_ = 13,
349 right = 39,
350 rMenu = 165,
351 rShiftKey = 161,
352 rWin = 92,
353 s = 83,
354 scroll = 145,
355 select = 41,
356 selectMedia = 181,
357 separator = 108,
358 shiftModifier = 65536,
359 shiftKey = 16,
360 sleep = 95,
361 snapshot = 44,
362 space = 32,
363 subtract = 109,
364 t = 84,
365 tab = 9,
366 u = 85,
367 up = 38,
368 v = 86,
369 volumeDown = 174,
370 volumeMute = 173,
371 volumeUp = 175,
372 w = 87,
373 x = 88,
374 xButton1 = 5,
375 xButton2 = 6,
376 y = 89,
377 z = 90,
378 zoom = 251
379 }
380
381 public nothrow ulong GetHashCode(Keys keys)
382 {
383 return cast<ulong>(cast<int>(keys));
384 }
385
386 public const char*[] keyCodeStr =
387
;
388 "None",
389 "LButton",
390 "RButton",
391 "Cancel",
392 "MButton",
393 "XBUtton1",
394 "XButton2",
395 "",
396 "Backspace",
397 "Tab",
398 "",
399 "",
400 "Clear",
401 "Enter",
402 "",
403 "",
404 "Shift",
405 "Control",
406 "Alt",
407 "Pause",
408 "Caps Lock",
409 "Kana",
410 "IME On",
411 "Junja",
412 "Final",
413 "Hanja",
414 "IME Off",
415 "Escape",
416 "Convert",
417 "Nonconvert",
418 "Accept",
419 "Mode change",
420 "Space",
421 "Page up",
422 "Page down",
423 "End",
424 "Home",
425 "Left",
426 "Up",
427 "Right",
428 "Down",
429 "Select",
430 "Print",
431 "Execute",
432 "Snapshot",
433 "Insert",
434 "Delete",
435 "Help",
436 "0",
437 "1",
438 "2",
439 "3",
440 "4",
441 "5",
442 "6",
443 "7",
444 "8",
445 "9",
446 "",
447 "",
448 "",
449 "",
450 "",
451 "",
452 "",
453 "A",
454 "B",
455 "C",
456 "D",
457 "E",
458 "F",
459 "G",
460 "H",
461 "I",
462 "J",
463 "K",
464 "L",
465 "M",
466 "N",
467 "O",
468 "P",
469 "Q",
470 "R",
471 "S",
472 "T",
473 "U",
474 "V",
475 "W",
476 "X",
477 "Y",
478 "Z",
479 "Left Windows",
480 "Right Windows",
481 "Apps",
482 "",
483 "Sleep",
484 "Num pad 0",
485 "Num pad 1",
486 "Num pad 2",
487 "Num pad 3",
488 "Num pad 4",
489 "Num pad 5",
490 "Num pad 6",
491 "Num pad 7",
492 "Num pad 8",
493 "Num pad 9",
494 "Multiply",
495 "Add",
496 "Separator",
497 "Subtract",
498 "Decimal",
499 "Divide",
500 "F1",
501 "F2",
502 "F3",
503 "F4",
504 "F5",
505 "F6",
506 "F7",
507 "F8",
508 "F9",
509 "F10",
510 "F11",
511 "F12",
512 "F13",
513 "F14",
514 "F15",
515 "F16",
516 "F17",
517 "F18",
518 "F19",
519 "F20",
520 "F21",
521 "F22",
522 "F23",
523 "F24",
524 "",
525 "",
526 "",
527 "",
528 "",
529 "",
530 "",
531 "",
532 "Num Lock",
533 "Scroll Lock",
534 "",
535 "",
536 "",
537 "",
538 "",
539 "",
540 "",
541 "",
542 "",
543 "",
544 "",
545 "",
546 "",
547 "",
548 "Left Shift",
549 "Right Shift",
550 "Left Control",
551 "Right Control",
552 "Left Alt",
553 "Right Alt",
554 "Browser Back",
555 "Browser Forward",
556 "Browser Refresh",
557 "Browser Stop",
558 "Browser Search",
559 "Browser Favorites",
560 "Browser Home",
561 "Volume Mute",
562 "Volume Down",
563 "Volume Up",
564 "Media Next Track",
565 "Media Prev Track",
566 "Media Stop",
567 "Media Play Pause",
568 "Launch Mail",
569 "Launch Media Select",
570 "Launch Application 1",
571 "Launch Application 2",
572 "",
573 "",
574 "OEM 1",
575 "OEM Plus",
576 "OEM Comma",
577 "OEM Minus",
578 "OEM Period",
579 "OEM 2",
580 "OEM 3",
581 "",
582 "",
583 "",
584 "",
585 "",
586 "",
587 "",
588 "",
589 "",
590 "",
591 "",
592 "",
593 "",
594 "",
595 "",
596 "",
597 "",
598 "",
599 "",
600 "",
601 "",
602 "",
603 "",
604 "",
605 "",
606 "OEM 4",
607 "OEM 5",
608 "OEM 6",
609 "OEM 7",
610 "OEM 8",
611 "",
612 "",
613 "OEM 102",
614 "",
615 "",
616 "Process Key",
617 "",
618 "Packet",
619 "",
620 "",
621 "",
622 "",
623 "",
624 "",
625 "",
626 "",
627 "",
628 "",
629 "",
630 "",
631 "",
632 "Attention",
633 "CR Select",
634 "EX Select",
635 "",
636 "Play",
637 "Zoom",
638 "",
639 "PA1",
640 "OEM Clear"
641 ];
642
643 public nothrow string ToString(Keys keys)
644 {
645 string s;
646 if ((keys & Keys.controlModifier) != 0)
647 {
648 s.Append("Ctrl+");
649 }
650 if ((keys & Keys.altModifier) != 0)
651 {
652 s.Append("Alt+");
653 }
654 if ((keys & Keys.shiftModifier) != 0)
655 {
656 s.Append("Shift+");
657 }
658 Keys keyCode = cast<Keys>(keys & ~Keys.modifiers);
659 s.Append(keyCodeStr[cast<int>(keyCode)]);
660 return s;
661 }
662 }