Fix bounds check
[nikiroo-utils.git] / src / jexer / TKeypress.java
... / ...
CommitLineData
1/*
2 * Jexer - Java Text User Interface
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (C) 2017 Kevin Lamonte
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
25 *
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
27 * @version 1
28 */
29package jexer;
30
31/**
32 * This class represents keystrokes.
33 */
34public final class TKeypress {
35
36 // Various special keystrokes
37
38 /**
39 * "No key".
40 */
41 public static final int NONE = 255;
42
43 /**
44 * Function key F1.
45 */
46 public static final int F1 = 1;
47
48 /**
49 * Function key F2.
50 */
51 public static final int F2 = 2;
52
53 /**
54 * Function key F3.
55 */
56 public static final int F3 = 3;
57
58 /**
59 * Function key F4.
60 */
61 public static final int F4 = 4;
62
63 /**
64 * Function key F5.
65 */
66 public static final int F5 = 5;
67
68 /**
69 * Function key F6.
70 */
71 public static final int F6 = 6;
72
73 /**
74 * Function key F7.
75 */
76 public static final int F7 = 7;
77
78 /**
79 * Function key F8.
80 */
81 public static final int F8 = 8;
82
83 /**
84 * Function key F9.
85 */
86 public static final int F9 = 9;
87
88 /**
89 * Function key F10.
90 */
91 public static final int F10 = 10;
92
93 /**
94 * Function key F11.
95 */
96 public static final int F11 = 11;
97
98 /**
99 * Function key F12.
100 */
101 public static final int F12 = 12;
102
103 /**
104 * Home.
105 */
106 public static final int HOME = 20;
107
108 /**
109 * End.
110 */
111 public static final int END = 21;
112
113 /**
114 * Page up.
115 */
116 public static final int PGUP = 22;
117
118 /**
119 * Page down.
120 */
121 public static final int PGDN = 23;
122
123 /**
124 * Insert.
125 */
126 public static final int INS = 24;
127
128 /**
129 * Delete.
130 */
131 public static final int DEL = 25;
132
133 /**
134 * Right arrow.
135 */
136 public static final int RIGHT = 30;
137
138 /**
139 * Left arrow.
140 */
141 public static final int LEFT = 31;
142
143 /**
144 * Up arrow.
145 */
146 public static final int UP = 32;
147
148 /**
149 * Down arrow.
150 */
151 public static final int DOWN = 33;
152
153 /**
154 * Tab.
155 */
156 public static final int TAB = 40;
157
158 /**
159 * Back-tab (shift-tab).
160 */
161 public static final int BTAB = 41;
162
163 /**
164 * Enter.
165 */
166 public static final int ENTER = 42;
167
168 /**
169 * Escape.
170 */
171 public static final int ESC = 43;
172
173 /**
174 * If true, ch is meaningless, use keyCode instead.
175 */
176 private boolean isFunctionKey;
177
178 /**
179 * Getter for isFunctionKey.
180 *
181 * @return if true, ch is meaningless, use keyCode instead
182 */
183 public boolean isFnKey() {
184 return isFunctionKey;
185 }
186
187 /**
188 * Will be set to F1, F2, HOME, END, etc. if isKey is true.
189 */
190 private int keyCode;
191
192 /**
193 * Getter for function key code.
194 *
195 * @return function key code int value (only valid is isKey is true)
196 */
197 public int getKeyCode() {
198 return keyCode;
199 }
200
201 /**
202 * Keystroke modifier ALT.
203 */
204 private boolean alt;
205
206 /**
207 * Getter for ALT.
208 *
209 * @return alt value
210 */
211 public boolean isAlt() {
212 return alt;
213 }
214
215 /**
216 * Keystroke modifier CTRL.
217 */
218 private boolean ctrl;
219
220 /**
221 * Getter for CTRL.
222 *
223 * @return ctrl value
224 */
225 public boolean isCtrl() {
226 return ctrl;
227 }
228
229 /**
230 * Keystroke modifier SHIFT.
231 */
232 private boolean shift;
233
234 /**
235 * Getter for SHIFT.
236 *
237 * @return shift value
238 */
239 public boolean isShift() {
240 return shift;
241 }
242
243 /**
244 * The character received.
245 */
246 private char ch;
247
248 /**
249 * Getter for character.
250 *
251 * @return the character (only valid if isKey is false)
252 */
253 public char getChar() {
254 return ch;
255 }
256
257 /**
258 * Public constructor makes an immutable instance.
259 *
260 * @param isKey is true, this is a function key
261 * @param fnKey the function key code (only valid if isKey is true)
262 * @param ch the character (only valid if fnKey is false)
263 * @param alt if true, ALT was pressed with this keystroke
264 * @param ctrl if true, CTRL was pressed with this keystroke
265 * @param shift if true, SHIFT was pressed with this keystroke
266 */
267 public TKeypress(final boolean isKey, final int fnKey, final char ch,
268 final boolean alt, final boolean ctrl, final boolean shift) {
269
270 this.isFunctionKey = isKey;
271 this.keyCode = fnKey;
272 this.ch = ch;
273 this.alt = alt;
274 this.ctrl = ctrl;
275 this.shift = shift;
276 }
277
278 /**
279 * Create a duplicate instance.
280 *
281 * @return duplicate intance
282 */
283 public TKeypress dup() {
284 TKeypress keypress = new TKeypress(isFunctionKey, keyCode, ch,
285 alt, ctrl, shift);
286 return keypress;
287 }
288
289 /**
290 * Comparison check. All fields must match to return true.
291 *
292 * @param rhs another TKeypress instance
293 * @return true if all fields are equal
294 */
295 @Override
296 public boolean equals(final Object rhs) {
297 if (!(rhs instanceof TKeypress)) {
298 return false;
299 }
300
301 TKeypress that = (TKeypress) rhs;
302 return ((isFunctionKey == that.isFunctionKey)
303 && (keyCode == that.keyCode)
304 && (ch == that.ch)
305 && (alt == that.alt)
306 && (ctrl == that.ctrl)
307 && (shift == that.shift));
308 }
309
310 /**
311 * Comparison check, omitting the ctrl/alt/shift flags.
312 *
313 * @param rhs another TKeypress instance
314 * @return true if all fields (except for ctrl/alt/shift) are equal
315 */
316 public boolean equalsWithoutModifiers(final Object rhs) {
317 if (!(rhs instanceof TKeypress)) {
318 return false;
319 }
320
321 TKeypress that = (TKeypress) rhs;
322 return ((isFunctionKey == that.isFunctionKey)
323 && (keyCode == that.keyCode)
324 && (ch == that.ch));
325 }
326
327 /**
328 * Hashcode uses all fields in equals().
329 *
330 * @return the hash
331 */
332 @Override
333 public int hashCode() {
334 int A = 13;
335 int B = 23;
336 int hash = A;
337 hash = (B * hash) + (isFunctionKey ? 1 : 0);
338 hash = (B * hash) + keyCode;
339 hash = (B * hash) + ch;
340 hash = (B * hash) + (alt ? 1 : 0);
341 hash = (B * hash) + (ctrl ? 1 : 0);
342 hash = (B * hash) + (shift ? 1 : 0);
343 return hash;
344 }
345
346 /**
347 * Make human-readable description of this TKeypress.
348 *
349 * @return displayable String
350 */
351 @Override
352 public String toString() {
353 if (isFunctionKey) {
354 switch (keyCode) {
355 case F1:
356 return String.format("%s%s%sF1",
357 ctrl ? "Ctrl+" : "",
358 alt ? "Alt+" : "",
359 shift ? "Shift+" : "");
360 case F2:
361 return String.format("%s%s%sF2",
362 ctrl ? "Ctrl+" : "",
363 alt ? "Alt+" : "",
364 shift ? "Shift+" : "");
365 case F3:
366 return String.format("%s%s%sF3",
367 ctrl ? "Ctrl+" : "",
368 alt ? "Alt+" : "",
369 shift ? "Shift+" : "");
370 case F4:
371 return String.format("%s%s%sF4",
372 ctrl ? "Ctrl+" : "",
373 alt ? "Alt+" : "",
374 shift ? "Shift+" : "");
375 case F5:
376 return String.format("%s%s%sF5",
377 ctrl ? "Ctrl+" : "",
378 alt ? "Alt+" : "",
379 shift ? "Shift+" : "");
380 case F6:
381 return String.format("%s%s%sF6",
382 ctrl ? "Ctrl+" : "",
383 alt ? "Alt+" : "",
384 shift ? "Shift+" : "");
385 case F7:
386 return String.format("%s%s%sF7",
387 ctrl ? "Ctrl+" : "",
388 alt ? "Alt+" : "",
389 shift ? "Shift+" : "");
390 case F8:
391 return String.format("%s%s%sF8",
392 ctrl ? "Ctrl+" : "",
393 alt ? "Alt+" : "",
394 shift ? "Shift+" : "");
395 case F9:
396 return String.format("%s%s%sF9",
397 ctrl ? "Ctrl+" : "",
398 alt ? "Alt+" : "",
399 shift ? "Shift+" : "");
400 case F10:
401 return String.format("%s%s%sF10",
402 ctrl ? "Ctrl+" : "",
403 alt ? "Alt+" : "",
404 shift ? "Shift+" : "");
405 case F11:
406 return String.format("%s%s%sF11",
407 ctrl ? "Ctrl+" : "",
408 alt ? "Alt+" : "",
409 shift ? "Shift+" : "");
410 case F12:
411 return String.format("%s%s%sF12",
412 ctrl ? "Ctrl+" : "",
413 alt ? "Alt+" : "",
414 shift ? "Shift+" : "");
415 case HOME:
416 return String.format("%s%s%sHOME",
417 ctrl ? "Ctrl+" : "",
418 alt ? "Alt+" : "",
419 shift ? "Shift+" : "");
420 case END:
421 return String.format("%s%s%sEND",
422 ctrl ? "Ctrl+" : "",
423 alt ? "Alt+" : "",
424 shift ? "Shift+" : "");
425 case PGUP:
426 return String.format("%s%s%sPGUP",
427 ctrl ? "Ctrl+" : "",
428 alt ? "Alt+" : "",
429 shift ? "Shift+" : "");
430 case PGDN:
431 return String.format("%s%s%sPGDN",
432 ctrl ? "Ctrl+" : "",
433 alt ? "Alt+" : "",
434 shift ? "Shift+" : "");
435 case INS:
436 return String.format("%s%s%sINS",
437 ctrl ? "Ctrl+" : "",
438 alt ? "Alt+" : "",
439 shift ? "Shift+" : "");
440 case DEL:
441 return String.format("%s%s%sDEL",
442 ctrl ? "Ctrl+" : "",
443 alt ? "Alt+" : "",
444 shift ? "Shift+" : "");
445 case RIGHT:
446 return String.format("%s%s%sRIGHT",
447 ctrl ? "Ctrl+" : "",
448 alt ? "Alt+" : "",
449 shift ? "Shift+" : "");
450 case LEFT:
451 return String.format("%s%s%sLEFT",
452 ctrl ? "Ctrl+" : "",
453 alt ? "Alt+" : "",
454 shift ? "Shift+" : "");
455 case UP:
456 return String.format("%s%s%sUP",
457 ctrl ? "Ctrl+" : "",
458 alt ? "Alt+" : "",
459 shift ? "Shift+" : "");
460 case DOWN:
461 return String.format("%s%s%sDOWN",
462 ctrl ? "Ctrl+" : "",
463 alt ? "Alt+" : "",
464 shift ? "Shift+" : "");
465 case TAB:
466 return String.format("%s%s%sTAB",
467 ctrl ? "Ctrl+" : "",
468 alt ? "Alt+" : "",
469 shift ? "Shift+" : "");
470 case BTAB:
471 return String.format("%s%s%sBTAB",
472 ctrl ? "Ctrl+" : "",
473 alt ? "Alt+" : "",
474 shift ? "Shift+" : "");
475 case ENTER:
476 return String.format("%s%s%sENTER",
477 ctrl ? "Ctrl+" : "",
478 alt ? "Alt+" : "",
479 shift ? "Shift+" : "");
480 case ESC:
481 return String.format("%s%s%sESC",
482 ctrl ? "Ctrl+" : "",
483 alt ? "Alt+" : "",
484 shift ? "Shift+" : "");
485 default:
486 return String.format("--UNKNOWN--");
487 }
488 } else {
489 if (alt && !shift && !ctrl) {
490 // Alt-X
491 return String.format("Alt+%c", Character.toUpperCase(ch));
492 } else if (!alt && shift && !ctrl) {
493 // Shift-X
494 return String.format("%c", ch);
495 } else if (!alt && !shift && ctrl) {
496 // Ctrl-X
497 return String.format("Ctrl+%c", ch);
498 } else if (alt && shift && !ctrl) {
499 // Alt-Shift-X
500 return String.format("Alt+Shift+%c", ch);
501 } else if (!alt && shift && ctrl) {
502 // Ctrl-Shift-X
503 return String.format("Ctrl+Shift+%c", ch);
504 } else if (alt && !shift && ctrl) {
505 // Ctrl-Alt-X
506 return String.format("Ctrl+Alt+%c", Character.toUpperCase(ch));
507 } else if (alt && shift && ctrl) {
508 // Ctrl-Alt-Shift-X
509 return String.format("Ctrl+Alt+Shift+%c",
510 Character.toUpperCase(ch));
511 } else {
512 // X
513 return String.format("%c", ch);
514 }
515 }
516 }
517
518 /**
519 * Convert a keypress to lowercase. Function keys and alt/ctrl keys are
520 * not converted.
521 *
522 * @return a new instance with the key converted
523 */
524 public TKeypress toLowerCase() {
525 TKeypress newKey = new TKeypress(isFunctionKey, keyCode, ch, alt, ctrl,
526 shift);
527 if (!isFunctionKey && (ch >= 'A') && (ch <= 'Z') && !ctrl && !alt) {
528 newKey.shift = false;
529 newKey.ch += 32;
530 }
531 return newKey;
532 }
533
534 /**
535 * Convert a keypress to uppercase. Function keys and alt/ctrl keys are
536 * not converted.
537 *
538 * @return a new instance with the key converted
539 */
540 public TKeypress toUpperCase() {
541 TKeypress newKey = new TKeypress(isFunctionKey, keyCode, ch, alt, ctrl,
542 shift);
543 if (!isFunctionKey && (ch >= 'a') && (ch <= 'z') && !ctrl && !alt) {
544 newKey.shift = true;
545 newKey.ch -= 32;
546 }
547 return newKey;
548 }
549
550 // Special "no-key" keypress, used to ignore undefined keystrokes
551 public static final TKeypress kbNoKey = new TKeypress(true,
552 TKeypress.NONE, ' ', false, false, false);
553
554 // Normal keys
555 public static final TKeypress kbF1 = new TKeypress(true,
556 TKeypress.F1, ' ', false, false, false);
557 public static final TKeypress kbF2 = new TKeypress(true,
558 TKeypress.F2, ' ', false, false, false);
559 public static final TKeypress kbF3 = new TKeypress(true,
560 TKeypress.F3, ' ', false, false, false);
561 public static final TKeypress kbF4 = new TKeypress(true,
562 TKeypress.F4, ' ', false, false, false);
563 public static final TKeypress kbF5 = new TKeypress(true,
564 TKeypress.F5, ' ', false, false, false);
565 public static final TKeypress kbF6 = new TKeypress(true,
566 TKeypress.F6, ' ', false, false, false);
567 public static final TKeypress kbF7 = new TKeypress(true,
568 TKeypress.F7, ' ', false, false, false);
569 public static final TKeypress kbF8 = new TKeypress(true,
570 TKeypress.F8, ' ', false, false, false);
571 public static final TKeypress kbF9 = new TKeypress(true,
572 TKeypress.F9, ' ', false, false, false);
573 public static final TKeypress kbF10 = new TKeypress(true,
574 TKeypress.F10, ' ', false, false, false);
575 public static final TKeypress kbF11 = new TKeypress(true,
576 TKeypress.F11, ' ', false, false, false);
577 public static final TKeypress kbF12 = new TKeypress(true,
578 TKeypress.F12, ' ', false, false, false);
579 public static final TKeypress kbAltF1 = new TKeypress(true,
580 TKeypress.F1, ' ', true, false, false);
581 public static final TKeypress kbAltF2 = new TKeypress(true,
582 TKeypress.F2, ' ', true, false, false);
583 public static final TKeypress kbAltF3 = new TKeypress(true,
584 TKeypress.F3, ' ', true, false, false);
585 public static final TKeypress kbAltF4 = new TKeypress(true,
586 TKeypress.F4, ' ', true, false, false);
587 public static final TKeypress kbAltF5 = new TKeypress(true,
588 TKeypress.F5, ' ', true, false, false);
589 public static final TKeypress kbAltF6 = new TKeypress(true,
590 TKeypress.F6, ' ', true, false, false);
591 public static final TKeypress kbAltF7 = new TKeypress(true,
592 TKeypress.F7, ' ', true, false, false);
593 public static final TKeypress kbAltF8 = new TKeypress(true,
594 TKeypress.F8, ' ', true, false, false);
595 public static final TKeypress kbAltF9 = new TKeypress(true,
596 TKeypress.F9, ' ', true, false, false);
597 public static final TKeypress kbAltF10 = new TKeypress(true,
598 TKeypress.F10, ' ', true, false, false);
599 public static final TKeypress kbAltF11 = new TKeypress(true,
600 TKeypress.F11, ' ', true, false, false);
601 public static final TKeypress kbAltF12 = new TKeypress(true,
602 TKeypress.F12, ' ', true, false, false);
603 public static final TKeypress kbCtrlF1 = new TKeypress(true,
604 TKeypress.F1, ' ', false, true, false);
605 public static final TKeypress kbCtrlF2 = new TKeypress(true,
606 TKeypress.F2, ' ', false, true, false);
607 public static final TKeypress kbCtrlF3 = new TKeypress(true,
608 TKeypress.F3, ' ', false, true, false);
609 public static final TKeypress kbCtrlF4 = new TKeypress(true,
610 TKeypress.F4, ' ', false, true, false);
611 public static final TKeypress kbCtrlF5 = new TKeypress(true,
612 TKeypress.F5, ' ', false, true, false);
613 public static final TKeypress kbCtrlF6 = new TKeypress(true,
614 TKeypress.F6, ' ', false, true, false);
615 public static final TKeypress kbCtrlF7 = new TKeypress(true,
616 TKeypress.F7, ' ', false, true, false);
617 public static final TKeypress kbCtrlF8 = new TKeypress(true,
618 TKeypress.F8, ' ', false, true, false);
619 public static final TKeypress kbCtrlF9 = new TKeypress(true,
620 TKeypress.F9, ' ', false, true, false);
621 public static final TKeypress kbCtrlF10 = new TKeypress(true,
622 TKeypress.F10, ' ', false, true, false);
623 public static final TKeypress kbCtrlF11 = new TKeypress(true,
624 TKeypress.F11, ' ', false, true, false);
625 public static final TKeypress kbCtrlF12 = new TKeypress(true,
626 TKeypress.F12, ' ', false, true, false);
627 public static final TKeypress kbShiftF1 = new TKeypress(true,
628 TKeypress.F1, ' ', false, false, true);
629 public static final TKeypress kbShiftF2 = new TKeypress(true,
630 TKeypress.F2, ' ', false, false, true);
631 public static final TKeypress kbShiftF3 = new TKeypress(true,
632 TKeypress.F3, ' ', false, false, true);
633 public static final TKeypress kbShiftF4 = new TKeypress(true,
634 TKeypress.F4, ' ', false, false, true);
635 public static final TKeypress kbShiftF5 = new TKeypress(true,
636 TKeypress.F5, ' ', false, false, true);
637 public static final TKeypress kbShiftF6 = new TKeypress(true,
638 TKeypress.F6, ' ', false, false, true);
639 public static final TKeypress kbShiftF7 = new TKeypress(true,
640 TKeypress.F7, ' ', false, false, true);
641 public static final TKeypress kbShiftF8 = new TKeypress(true,
642 TKeypress.F8, ' ', false, false, true);
643 public static final TKeypress kbShiftF9 = new TKeypress(true,
644 TKeypress.F9, ' ', false, false, true);
645 public static final TKeypress kbShiftF10 = new TKeypress(true,
646 TKeypress.F10, ' ', false, false, true);
647 public static final TKeypress kbShiftF11 = new TKeypress(true,
648 TKeypress.F11, ' ', false, false, true);
649 public static final TKeypress kbShiftF12 = new TKeypress(true,
650 TKeypress.F12, ' ', false, false, true);
651 public static final TKeypress kbEnter = new TKeypress(true,
652 TKeypress.ENTER, ' ', false, false, false);
653 public static final TKeypress kbTab = new TKeypress(true,
654 TKeypress.TAB, ' ', false, false, false);
655 public static final TKeypress kbEsc = new TKeypress(true,
656 TKeypress.ESC, ' ', false, false, false);
657 public static final TKeypress kbHome = new TKeypress(true,
658 TKeypress.HOME, ' ', false, false, false);
659 public static final TKeypress kbEnd = new TKeypress(true,
660 TKeypress.END, ' ', false, false, false);
661 public static final TKeypress kbPgUp = new TKeypress(true,
662 TKeypress.PGUP, ' ', false, false, false);
663 public static final TKeypress kbPgDn = new TKeypress(true,
664 TKeypress.PGDN, ' ', false, false, false);
665 public static final TKeypress kbIns = new TKeypress(true,
666 TKeypress.INS, ' ', false, false, false);
667 public static final TKeypress kbDel = new TKeypress(true,
668 TKeypress.DEL, ' ', false, false, false);
669 public static final TKeypress kbUp = new TKeypress(true,
670 TKeypress.UP, ' ', false, false, false);
671 public static final TKeypress kbDown = new TKeypress(true,
672 TKeypress.DOWN, ' ', false, false, false);
673 public static final TKeypress kbLeft = new TKeypress(true,
674 TKeypress.LEFT, ' ', false, false, false);
675 public static final TKeypress kbRight = new TKeypress(true,
676 TKeypress.RIGHT, ' ', false, false, false);
677 public static final TKeypress kbAltEnter = new TKeypress(true,
678 TKeypress.ENTER, ' ', true, false, false);
679 public static final TKeypress kbAltTab = new TKeypress(true,
680 TKeypress.TAB, ' ', true, false, false);
681 public static final TKeypress kbAltEsc = new TKeypress(true,
682 TKeypress.ESC, ' ', true, false, false);
683 public static final TKeypress kbAltHome = new TKeypress(true,
684 TKeypress.HOME, ' ', true, false, false);
685 public static final TKeypress kbAltEnd = new TKeypress(true,
686 TKeypress.END, ' ', true, false, false);
687 public static final TKeypress kbAltPgUp = new TKeypress(true,
688 TKeypress.PGUP, ' ', true, false, false);
689 public static final TKeypress kbAltPgDn = new TKeypress(true,
690 TKeypress.PGDN, ' ', true, false, false);
691 public static final TKeypress kbAltIns = new TKeypress(true,
692 TKeypress.INS, ' ', true, false, false);
693 public static final TKeypress kbAltDel = new TKeypress(true,
694 TKeypress.DEL, ' ', true, false, false);
695 public static final TKeypress kbAltUp = new TKeypress(true,
696 TKeypress.UP, ' ', true, false, false);
697 public static final TKeypress kbAltDown = new TKeypress(true,
698 TKeypress.DOWN, ' ', true, false, false);
699 public static final TKeypress kbAltLeft = new TKeypress(true,
700 TKeypress.LEFT, ' ', true, false, false);
701 public static final TKeypress kbAltRight = new TKeypress(true,
702 TKeypress.RIGHT, ' ', true, false, false);
703 public static final TKeypress kbCtrlEnter = new TKeypress(true,
704 TKeypress.ENTER, ' ', false, true, false);
705 public static final TKeypress kbCtrlTab = new TKeypress(true,
706 TKeypress.TAB, ' ', false, true, false);
707 public static final TKeypress kbCtrlEsc = new TKeypress(true,
708 TKeypress.ESC, ' ', false, true, false);
709 public static final TKeypress kbCtrlHome = new TKeypress(true,
710 TKeypress.HOME, ' ', false, true, false);
711 public static final TKeypress kbCtrlEnd = new TKeypress(true,
712 TKeypress.END, ' ', false, true, false);
713 public static final TKeypress kbCtrlPgUp = new TKeypress(true,
714 TKeypress.PGUP, ' ', false, true, false);
715 public static final TKeypress kbCtrlPgDn = new TKeypress(true,
716 TKeypress.PGDN, ' ', false, true, false);
717 public static final TKeypress kbCtrlIns = new TKeypress(true,
718 TKeypress.INS, ' ', false, true, false);
719 public static final TKeypress kbCtrlDel = new TKeypress(true,
720 TKeypress.DEL, ' ', false, true, false);
721 public static final TKeypress kbCtrlUp = new TKeypress(true,
722 TKeypress.UP, ' ', false, true, false);
723 public static final TKeypress kbCtrlDown = new TKeypress(true,
724 TKeypress.DOWN, ' ', false, true, false);
725 public static final TKeypress kbCtrlLeft = new TKeypress(true,
726 TKeypress.LEFT, ' ', false, true, false);
727 public static final TKeypress kbCtrlRight = new TKeypress(true,
728 TKeypress.RIGHT, ' ', false, true, false);
729 public static final TKeypress kbShiftEnter = new TKeypress(true,
730 TKeypress.ENTER, ' ', false, false, true);
731 public static final TKeypress kbShiftTab = new TKeypress(true,
732 TKeypress.TAB, ' ', false, false, true);
733 public static final TKeypress kbBackTab = new TKeypress(true,
734 TKeypress.BTAB, ' ', false, false, false);
735 public static final TKeypress kbShiftEsc = new TKeypress(true,
736 TKeypress.ESC, ' ', false, false, true);
737 public static final TKeypress kbShiftHome = new TKeypress(true,
738 TKeypress.HOME, ' ', false, false, true);
739 public static final TKeypress kbShiftEnd = new TKeypress(true,
740 TKeypress.END, ' ', false, false, true);
741 public static final TKeypress kbShiftPgUp = new TKeypress(true,
742 TKeypress.PGUP, ' ', false, false, true);
743 public static final TKeypress kbShiftPgDn = new TKeypress(true,
744 TKeypress.PGDN, ' ', false, false, true);
745 public static final TKeypress kbShiftIns = new TKeypress(true,
746 TKeypress.INS, ' ', false, false, true);
747 public static final TKeypress kbShiftDel = new TKeypress(true,
748 TKeypress.DEL, ' ', false, false, true);
749 public static final TKeypress kbShiftUp = new TKeypress(true,
750 TKeypress.UP, ' ', false, false, true);
751 public static final TKeypress kbShiftDown = new TKeypress(true,
752 TKeypress.DOWN, ' ', false, false, true);
753 public static final TKeypress kbShiftLeft = new TKeypress(true,
754 TKeypress.LEFT, ' ', false, false, true);
755 public static final TKeypress kbShiftRight = new TKeypress(true,
756 TKeypress.RIGHT, ' ', false, false, true);
757 public static final TKeypress kbA = new TKeypress(false,
758 0, 'a', false, false, false);
759 public static final TKeypress kbB = new TKeypress(false,
760 0, 'b', false, false, false);
761 public static final TKeypress kbC = new TKeypress(false,
762 0, 'c', false, false, false);
763 public static final TKeypress kbD = new TKeypress(false,
764 0, 'd', false, false, false);
765 public static final TKeypress kbE = new TKeypress(false,
766 0, 'e', false, false, false);
767 public static final TKeypress kbF = new TKeypress(false,
768 0, 'f', false, false, false);
769 public static final TKeypress kbG = new TKeypress(false,
770 0, 'g', false, false, false);
771 public static final TKeypress kbH = new TKeypress(false,
772 0, 'h', false, false, false);
773 public static final TKeypress kbI = new TKeypress(false,
774 0, 'i', false, false, false);
775 public static final TKeypress kbJ = new TKeypress(false,
776 0, 'j', false, false, false);
777 public static final TKeypress kbK = new TKeypress(false,
778 0, 'k', false, false, false);
779 public static final TKeypress kbL = new TKeypress(false,
780 0, 'l', false, false, false);
781 public static final TKeypress kbM = new TKeypress(false,
782 0, 'm', false, false, false);
783 public static final TKeypress kbN = new TKeypress(false,
784 0, 'n', false, false, false);
785 public static final TKeypress kbO = new TKeypress(false,
786 0, 'o', false, false, false);
787 public static final TKeypress kbP = new TKeypress(false,
788 0, 'p', false, false, false);
789 public static final TKeypress kbQ = new TKeypress(false,
790 0, 'q', false, false, false);
791 public static final TKeypress kbR = new TKeypress(false,
792 0, 'r', false, false, false);
793 public static final TKeypress kbS = new TKeypress(false,
794 0, 's', false, false, false);
795 public static final TKeypress kbT = new TKeypress(false,
796 0, 't', false, false, false);
797 public static final TKeypress kbU = new TKeypress(false,
798 0, 'u', false, false, false);
799 public static final TKeypress kbV = new TKeypress(false,
800 0, 'v', false, false, false);
801 public static final TKeypress kbW = new TKeypress(false,
802 0, 'w', false, false, false);
803 public static final TKeypress kbX = new TKeypress(false,
804 0, 'x', false, false, false);
805 public static final TKeypress kbY = new TKeypress(false,
806 0, 'y', false, false, false);
807 public static final TKeypress kbZ = new TKeypress(false,
808 0, 'z', false, false, false);
809 public static final TKeypress kbSpace = new TKeypress(false,
810 0, ' ', false, false, false);
811 public static final TKeypress kbAltA = new TKeypress(false,
812 0, 'a', true, false, false);
813 public static final TKeypress kbAltB = new TKeypress(false,
814 0, 'b', true, false, false);
815 public static final TKeypress kbAltC = new TKeypress(false,
816 0, 'c', true, false, false);
817 public static final TKeypress kbAltD = new TKeypress(false,
818 0, 'd', true, false, false);
819 public static final TKeypress kbAltE = new TKeypress(false,
820 0, 'e', true, false, false);
821 public static final TKeypress kbAltF = new TKeypress(false,
822 0, 'f', true, false, false);
823 public static final TKeypress kbAltG = new TKeypress(false,
824 0, 'g', true, false, false);
825 public static final TKeypress kbAltH = new TKeypress(false,
826 0, 'h', true, false, false);
827 public static final TKeypress kbAltI = new TKeypress(false,
828 0, 'i', true, false, false);
829 public static final TKeypress kbAltJ = new TKeypress(false,
830 0, 'j', true, false, false);
831 public static final TKeypress kbAltK = new TKeypress(false,
832 0, 'k', true, false, false);
833 public static final TKeypress kbAltL = new TKeypress(false,
834 0, 'l', true, false, false);
835 public static final TKeypress kbAltM = new TKeypress(false,
836 0, 'm', true, false, false);
837 public static final TKeypress kbAltN = new TKeypress(false,
838 0, 'n', true, false, false);
839 public static final TKeypress kbAltO = new TKeypress(false,
840 0, 'o', true, false, false);
841 public static final TKeypress kbAltP = new TKeypress(false,
842 0, 'p', true, false, false);
843 public static final TKeypress kbAltQ = new TKeypress(false,
844 0, 'q', true, false, false);
845 public static final TKeypress kbAltR = new TKeypress(false,
846 0, 'r', true, false, false);
847 public static final TKeypress kbAltS = new TKeypress(false,
848 0, 's', true, false, false);
849 public static final TKeypress kbAltT = new TKeypress(false,
850 0, 't', true, false, false);
851 public static final TKeypress kbAltU = new TKeypress(false,
852 0, 'u', true, false, false);
853 public static final TKeypress kbAltV = new TKeypress(false,
854 0, 'v', true, false, false);
855 public static final TKeypress kbAltW = new TKeypress(false,
856 0, 'w', true, false, false);
857 public static final TKeypress kbAltX = new TKeypress(false,
858 0, 'x', true, false, false);
859 public static final TKeypress kbAltY = new TKeypress(false,
860 0, 'y', true, false, false);
861 public static final TKeypress kbAltZ = new TKeypress(false,
862 0, 'z', true, false, false);
863 public static final TKeypress kbCtrlA = new TKeypress(false,
864 0, 'A', false, true, false);
865 public static final TKeypress kbCtrlB = new TKeypress(false,
866 0, 'B', false, true, false);
867 public static final TKeypress kbCtrlC = new TKeypress(false,
868 0, 'C', false, true, false);
869 public static final TKeypress kbCtrlD = new TKeypress(false,
870 0, 'D', false, true, false);
871 public static final TKeypress kbCtrlE = new TKeypress(false,
872 0, 'E', false, true, false);
873 public static final TKeypress kbCtrlF = new TKeypress(false,
874 0, 'F', false, true, false);
875 public static final TKeypress kbCtrlG = new TKeypress(false,
876 0, 'G', false, true, false);
877 public static final TKeypress kbCtrlH = new TKeypress(false,
878 0, 'H', false, true, false);
879 public static final TKeypress kbCtrlI = new TKeypress(false,
880 0, 'I', false, true, false);
881 public static final TKeypress kbCtrlJ = new TKeypress(false,
882 0, 'J', false, true, false);
883 public static final TKeypress kbCtrlK = new TKeypress(false,
884 0, 'K', false, true, false);
885 public static final TKeypress kbCtrlL = new TKeypress(false,
886 0, 'L', false, true, false);
887 public static final TKeypress kbCtrlM = new TKeypress(false,
888 0, 'M', false, true, false);
889 public static final TKeypress kbCtrlN = new TKeypress(false,
890 0, 'N', false, true, false);
891 public static final TKeypress kbCtrlO = new TKeypress(false,
892 0, 'O', false, true, false);
893 public static final TKeypress kbCtrlP = new TKeypress(false,
894 0, 'P', false, true, false);
895 public static final TKeypress kbCtrlQ = new TKeypress(false,
896 0, 'Q', false, true, false);
897 public static final TKeypress kbCtrlR = new TKeypress(false,
898 0, 'R', false, true, false);
899 public static final TKeypress kbCtrlS = new TKeypress(false,
900 0, 'S', false, true, false);
901 public static final TKeypress kbCtrlT = new TKeypress(false,
902 0, 'T', false, true, false);
903 public static final TKeypress kbCtrlU = new TKeypress(false,
904 0, 'U', false, true, false);
905 public static final TKeypress kbCtrlV = new TKeypress(false,
906 0, 'V', false, true, false);
907 public static final TKeypress kbCtrlW = new TKeypress(false,
908 0, 'W', false, true, false);
909 public static final TKeypress kbCtrlX = new TKeypress(false,
910 0, 'X', false, true, false);
911 public static final TKeypress kbCtrlY = new TKeypress(false,
912 0, 'Y', false, true, false);
913 public static final TKeypress kbCtrlZ = new TKeypress(false,
914 0, 'Z', false, true, false);
915 public static final TKeypress kbAltShiftA = new TKeypress(false,
916 0, 'A', true, false, true);
917 public static final TKeypress kbAltShiftB = new TKeypress(false,
918 0, 'B', true, false, true);
919 public static final TKeypress kbAltShiftC = new TKeypress(false,
920 0, 'C', true, false, true);
921 public static final TKeypress kbAltShiftD = new TKeypress(false,
922 0, 'D', true, false, true);
923 public static final TKeypress kbAltShiftE = new TKeypress(false,
924 0, 'E', true, false, true);
925 public static final TKeypress kbAltShiftF = new TKeypress(false,
926 0, 'F', true, false, true);
927 public static final TKeypress kbAltShiftG = new TKeypress(false,
928 0, 'G', true, false, true);
929 public static final TKeypress kbAltShiftH = new TKeypress(false,
930 0, 'H', true, false, true);
931 public static final TKeypress kbAltShiftI = new TKeypress(false,
932 0, 'I', true, false, true);
933 public static final TKeypress kbAltShiftJ = new TKeypress(false,
934 0, 'J', true, false, true);
935 public static final TKeypress kbAltShiftK = new TKeypress(false,
936 0, 'K', true, false, true);
937 public static final TKeypress kbAltShiftL = new TKeypress(false,
938 0, 'L', true, false, true);
939 public static final TKeypress kbAltShiftM = new TKeypress(false,
940 0, 'M', true, false, true);
941 public static final TKeypress kbAltShiftN = new TKeypress(false,
942 0, 'N', true, false, true);
943 public static final TKeypress kbAltShiftO = new TKeypress(false,
944 0, 'O', true, false, true);
945 public static final TKeypress kbAltShiftP = new TKeypress(false,
946 0, 'P', true, false, true);
947 public static final TKeypress kbAltShiftQ = new TKeypress(false,
948 0, 'Q', true, false, true);
949 public static final TKeypress kbAltShiftR = new TKeypress(false,
950 0, 'R', true, false, true);
951 public static final TKeypress kbAltShiftS = new TKeypress(false,
952 0, 'S', true, false, true);
953 public static final TKeypress kbAltShiftT = new TKeypress(false,
954 0, 'T', true, false, true);
955 public static final TKeypress kbAltShiftU = new TKeypress(false,
956 0, 'U', true, false, true);
957 public static final TKeypress kbAltShiftV = new TKeypress(false,
958 0, 'V', true, false, true);
959 public static final TKeypress kbAltShiftW = new TKeypress(false,
960 0, 'W', true, false, true);
961 public static final TKeypress kbAltShiftX = new TKeypress(false,
962 0, 'X', true, false, true);
963 public static final TKeypress kbAltShiftY = new TKeypress(false,
964 0, 'Y', true, false, true);
965 public static final TKeypress kbAltShiftZ = new TKeypress(false,
966 0, 'Z', true, false, true);
967
968 /**
969 * Backspace as ^H.
970 */
971 public static final TKeypress kbBackspace = new TKeypress(false,
972 0, 'H', false, true, false);
973
974 /**
975 * Backspace as ^?.
976 */
977 public static final TKeypress kbBackspaceDel = new TKeypress(false,
978 0, (char)0x7F, false, false, false);
979
980}