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