001: /*******************************************************************************
002: * Copyright (c) 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jface.bindings.keys;
011:
012: /**
013: * <p>
014: * A facilitiy for converting the formal representation for key strokes
015: * (i.e., used in persistence) into real key stroke instances.
016: * </p>
017: *
018: * @since 3.1
019: */
020: public interface IKeyLookup {
021: /**
022: * The formal name of the 'Alt' key.
023: */
024: public static final String ALT_NAME = "ALT"; //$NON-NLS-1$
025:
026: /**
027: * The formal name of the 'Arrow Down' key.
028: */
029: public static final String ARROW_DOWN_NAME = "ARROW_DOWN"; //$NON-NLS-1$
030:
031: /**
032: * The formal name of the 'Arrow Left' key.
033: */
034: public static final String ARROW_LEFT_NAME = "ARROW_LEFT"; //$NON-NLS-1$
035:
036: /**
037: * The formal name of the 'Arrow Right' key.
038: */
039: public static final String ARROW_RIGHT_NAME = "ARROW_RIGHT"; //$NON-NLS-1$
040:
041: /**
042: * The formal name of the 'Arrow Up' key.
043: */
044: public static final String ARROW_UP_NAME = "ARROW_UP"; //$NON-NLS-1$
045:
046: /**
047: * An alternate name for the backspace key.
048: */
049: public static final String BACKSPACE_NAME = "BACKSPACE"; //$NON-NLS-1$
050:
051: /**
052: * The formal name for the 'Break' key.
053: */
054: public static final String BREAK_NAME = "BREAK"; //$NON-NLS-1$
055:
056: /**
057: * The formal name of the backspace key.
058: */
059: public static final String BS_NAME = "BS"; //$NON-NLS-1$
060:
061: /**
062: * The formal name for the 'Caps Lock' key.
063: */
064: public static final String CAPS_LOCK_NAME = "CAPS_LOCK"; //$NON-NLS-1$
065:
066: /**
067: * The formal name of the 'Command' key.
068: */
069: public static final String COMMAND_NAME = "COMMAND"; //$NON-NLS-1$
070:
071: /**
072: * The formal name of the carriage return (U+000D)
073: */
074: public static final String CR_NAME = "CR"; //$NON-NLS-1$
075:
076: /**
077: * The formal name of the 'Ctrl' key.
078: */
079: public static final String CTRL_NAME = "CTRL"; //$NON-NLS-1$
080:
081: /**
082: * The formal name of the delete (U+007F) key
083: */
084: public static final String DEL_NAME = "DEL"; //$NON-NLS-1$
085:
086: /**
087: * An alternative name for the delete key.
088: */
089: public static final String DELETE_NAME = "DELETE"; //$NON-NLS-1$
090:
091: /**
092: * The formal name of the 'End' key.
093: */
094: public static final String END_NAME = "END"; //$NON-NLS-1$
095:
096: /**
097: * An alternative name for the enter key.
098: */
099: public static final String ENTER_NAME = "ENTER"; //$NON-NLS-1$
100:
101: /**
102: * The formal name of the escape (U+001B) key.
103: */
104: public static final String ESC_NAME = "ESC"; //$NON-NLS-1$
105:
106: /**
107: * An alternative name for the escape key.
108: */
109: public static final String ESCAPE_NAME = "ESCAPE"; //$NON-NLS-1$
110:
111: /**
112: * The formal name of the 'F1' key.
113: */
114: public static final String F1_NAME = "F1"; //$NON-NLS-1$
115:
116: /**
117: * The formal name of the 'F10' key.
118: */
119: public static final String F10_NAME = "F10"; //$NON-NLS-1$
120:
121: /**
122: * The formal name of the 'F11' key.
123: */
124: public static final String F11_NAME = "F11"; //$NON-NLS-1$
125:
126: /**
127: * The formal name of the 'F12' key.
128: */
129: public static final String F12_NAME = "F12"; //$NON-NLS-1$
130:
131: /**
132: * The formal name of the 'F13' key.
133: */
134: public static final String F13_NAME = "F13"; //$NON-NLS-1$
135:
136: /**
137: * The formal name of the 'F14' key.
138: */
139: public static final String F14_NAME = "F14"; //$NON-NLS-1$
140:
141: /**
142: * The formal name of the 'F15' key.
143: */
144: public static final String F15_NAME = "F15"; //$NON-NLS-1$
145:
146: /**
147: * The formal name of the 'F2' key.
148: */
149: public static final String F2_NAME = "F2"; //$NON-NLS-1$
150:
151: /**
152: * The formal name of the 'F3' key.
153: */
154: public static final String F3_NAME = "F3"; //$NON-NLS-1$
155:
156: /**
157: * The formal name of the 'F4' key.
158: */
159: public static final String F4_NAME = "F4"; //$NON-NLS-1$
160:
161: /**
162: * The formal name of the 'F5' key.
163: */
164: public static final String F5_NAME = "F5"; //$NON-NLS-1$
165:
166: /**
167: * The formal name of the 'F6' key.
168: */
169: public static final String F6_NAME = "F6"; //$NON-NLS-1$
170:
171: /**
172: * The formal name of the 'F7' key.
173: */
174: public static final String F7_NAME = "F7"; //$NON-NLS-1$
175:
176: /**
177: * The formal name of the 'F8' key.
178: */
179: public static final String F8_NAME = "F8"; //$NON-NLS-1$
180:
181: /**
182: * The formal name of the 'F9' key.
183: */
184: public static final String F9_NAME = "F9"; //$NON-NLS-1$
185:
186: /**
187: * The formal name of the form feed (U+000C) key.
188: */
189: public static final String FF_NAME = "FF"; //$NON-NLS-1$
190:
191: /**
192: * The formal name of the 'Home' key.
193: */
194: public static final String HOME_NAME = "HOME"; //$NON-NLS-1$
195:
196: /**
197: * The formal name of the 'Insert' key.
198: */
199: public static final String INSERT_NAME = "INSERT"; //$NON-NLS-1$
200:
201: /**
202: * The formal name of the line feed (U+000A) key.
203: */
204: public static final String LF_NAME = "LF"; //$NON-NLS-1$
205:
206: /**
207: * The formal name of the 'M1' key.
208: */
209: public static final String M1_NAME = "M1"; //$NON-NLS-1$
210:
211: /**
212: * The formal name of the 'M2' key.
213: */
214: public static final String M2_NAME = "M2"; //$NON-NLS-1$
215:
216: /**
217: * The formal name of the 'M3' key.
218: */
219: public static final String M3_NAME = "M3"; //$NON-NLS-1$
220:
221: /**
222: * The formal name of the 'M4' key.
223: */
224: public static final String M4_NAME = "M4"; //$NON-NLS-1$
225:
226: /**
227: * The formal name of the null (U+0000) key.
228: */
229: public static final String NUL_NAME = "NUL"; //$NON-NLS-1$
230:
231: /**
232: * The formal name of the 'NumLock' key.
233: */
234: public static final String NUM_LOCK_NAME = "NUM_LOCK"; //$NON-NLS-1$
235:
236: /**
237: * The formal name of the '0' key on the numpad.
238: */
239: public static final String NUMPAD_0_NAME = "NUMPAD_0"; //$NON-NLS-1$
240:
241: /**
242: * The formal name of the '1' key on the numpad.
243: */
244: public static final String NUMPAD_1_NAME = "NUMPAD_1"; //$NON-NLS-1$
245:
246: /**
247: * The formal name of the '2' key on the numpad.
248: */
249: public static final String NUMPAD_2_NAME = "NUMPAD_2"; //$NON-NLS-1$
250:
251: /**
252: * The formal name of the '3' key on the numpad.
253: */
254: public static final String NUMPAD_3_NAME = "NUMPAD_3"; //$NON-NLS-1$
255:
256: /**
257: * The formal name of the '4' key on the numpad.
258: */
259: public static final String NUMPAD_4_NAME = "NUMPAD_4"; //$NON-NLS-1$
260:
261: /**
262: * The formal name of the '5' key on the numpad.
263: */
264: public static final String NUMPAD_5_NAME = "NUMPAD_5"; //$NON-NLS-1$
265:
266: /**
267: * The formal name of the '6' key on the numpad.
268: */
269: public static final String NUMPAD_6_NAME = "NUMPAD_6"; //$NON-NLS-1$
270:
271: /**
272: * The formal name of the '7' key on the numpad.
273: */
274: public static final String NUMPAD_7_NAME = "NUMPAD_7"; //$NON-NLS-1$
275:
276: /**
277: * The formal name of the '8' key on the numpad.
278: */
279: public static final String NUMPAD_8_NAME = "NUMPAD_8"; //$NON-NLS-1$
280:
281: /**
282: * The formal name of the '9' key on the numpad.
283: */
284: public static final String NUMPAD_9_NAME = "NUMPAD_9"; //$NON-NLS-1$
285:
286: /**
287: * The formal name of the 'Add' key on the numpad.
288: */
289: public static final String NUMPAD_ADD_NAME = "NUMPAD_ADD"; //$NON-NLS-1$
290:
291: /**
292: * The formal name of the 'Decimal' key on the numpad.
293: */
294: public static final String NUMPAD_DECIMAL_NAME = "NUMPAD_DECIMAL"; //$NON-NLS-1$
295:
296: /**
297: * The formal name of the 'Divide' key on the numpad.
298: */
299: public static final String NUMPAD_DIVIDE_NAME = "NUMPAD_DIVIDE"; //$NON-NLS-1$
300:
301: /**
302: * The formal name of the 'Enter' key on the numpad.
303: */
304: public static final String NUMPAD_ENTER_NAME = "NUMPAD_ENTER"; //$NON-NLS-1$
305:
306: /**
307: * The formal name of the '=' key on the numpad.
308: */
309: public static final String NUMPAD_EQUAL_NAME = "NUMPAD_EQUAL"; //$NON-NLS-1$
310:
311: /**
312: * The formal name of the 'Multiply' key on the numpad.
313: */
314: public static final String NUMPAD_MULTIPLY_NAME = "NUMPAD_MULTIPLY"; //$NON-NLS-1$
315:
316: /**
317: * The formal name of the 'Subtract' key on the numpad.
318: */
319: public static final String NUMPAD_SUBTRACT_NAME = "NUMPAD_SUBTRACT"; //$NON-NLS-1$
320:
321: /**
322: * The formal name of the 'Page Down' key.
323: */
324: public static final String PAGE_DOWN_NAME = "PAGE_DOWN"; //$NON-NLS-1$
325:
326: /**
327: * The formal name of the 'Page Up' key.
328: */
329: public static final String PAGE_UP_NAME = "PAGE_UP"; //$NON-NLS-1$
330:
331: /**
332: * The formal name for the 'Pause' key.
333: */
334: public static final String PAUSE_NAME = "PAUSE"; //$NON-NLS-1$
335:
336: /**
337: * The formal name for the 'Print Screen' key.
338: */
339: public static final String PRINT_SCREEN_NAME = "PRINT_SCREEN"; //$NON-NLS-1$
340:
341: /**
342: * An alternative name for the enter key.
343: */
344: public static final String RETURN_NAME = "RETURN"; //$NON-NLS-1$
345:
346: /**
347: * The formal name for the 'Scroll Lock' key.
348: */
349: public static final String SCROLL_LOCK_NAME = "SCROLL_LOCK"; //$NON-NLS-1$
350:
351: /**
352: * The formal name of the 'Shift' key.
353: */
354: public static final String SHIFT_NAME = "SHIFT"; //$NON-NLS-1$
355:
356: /**
357: * The formal name of the space (U+0020) key.
358: */
359: public static final String SPACE_NAME = "SPACE"; //$NON-NLS-1$
360:
361: /**
362: * The formal name of the tab (U+0009) key.
363: */
364: public static final String TAB_NAME = "TAB"; //$NON-NLS-1$
365:
366: /**
367: * The formal name of the vertical tab (U+000B) key.
368: */
369: public static final String VT_NAME = "VT"; //$NON-NLS-1$
370:
371: /**
372: * Looks up a single natural key by its formal name, and returns the integer
373: * representation for this natural key
374: *
375: * @param name
376: * The formal name of the natural key to look-up; must not be
377: * <code>null</code>.
378: * @return The integer representation of this key. If the natural key cannot
379: * be found, then this method returns <code>0</code>.
380: */
381: public int formalKeyLookup(String name);
382:
383: /**
384: * Looks up a single natural key by its formal name, and returns the integer
385: * representation for this natural key
386: *
387: * @param name
388: * The formal name of the natural key to look-up; must not be
389: * <code>null</code>.
390: * @return The integer representation of this key. If the natural key cannot
391: * be found, then this method returns <code>0</code>.
392: */
393: public Integer formalKeyLookupInteger(String name);
394:
395: /**
396: * Looks up a single modifier key by its formal name, and returns the integer
397: * representation for this modifier key
398: *
399: * @param name
400: * The formal name of the modifier key to look-up; must not be
401: * <code>null</code>.
402: * @return The integer representation of this key. If the modifier key
403: * cannot be found, then this method returns <code>0</code>.
404: */
405: public int formalModifierLookup(String name);
406:
407: /**
408: * Looks up a key value, and returns the formal string representation for
409: * that key
410: *
411: * @param key
412: * The key to look-up.
413: * @return The formal string representation of this key. If this key cannot
414: * be found, then it is simply the character corresponding to that
415: * integer value.
416: */
417: public String formalNameLookup(int key);
418:
419: /**
420: * Returns the integer representation of the ALT key.
421: *
422: * @return The ALT key
423: */
424: public int getAlt();
425:
426: /**
427: * Returns the integer representation of the COMMAND key.
428: *
429: * @return The COMMAND key
430: */
431: public int getCommand();
432:
433: /**
434: * Returns the integer representation of the CTRL key.
435: *
436: * @return The CTRL key
437: */
438: public int getCtrl();
439:
440: /**
441: * Returns the integer representation of the SHIFT key.
442: *
443: * @return The SHIFT key
444: */
445: public int getShift();
446:
447: /**
448: * Returns whether the given key is a modifier key.
449: *
450: * @param key
451: * The integer value of the key to check.
452: * @return <code>true</code> if the key is one of the modifier keys;
453: * <code>false</code> otherwise.
454: */
455: public boolean isModifierKey(int key);
456: }
|