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