01: package abbot.tester;
02:
03: import java.awt.Toolkit;
04: import java.awt.event.InputEvent;
05: import abbot.Platform;
06: import abbot.util.AWT;
07:
08: /** Provides shared UI- and action-related constants. */
09:
10: public interface AWTConstants {
11:
12: int MULTI_CLICK_INTERVAL = 250; // a guess
13: /** Number of pixels traversed before a drag starts. */
14: // OSX 10(1.3.1), 5(1.4.1)
15: // Linux/X11: delay+16
16: // NOTE: could maybe install a drag gesture recognizer, but that's kinda
17: // complex for what you get out of it.
18: int DRAG_THRESHOLD = Platform.isWindows() || Platform.isMacintosh() ? 10
19: : 16;
20: int BUTTON_MASK = (InputEvent.BUTTON1_MASK
21: | InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK);
22: int POPUP_MASK = AWT.getPopupMask();
23: String POPUP_MODIFIER = AWT.getMouseModifiers(POPUP_MASK);
24: boolean POPUP_ON_PRESS = AWT.getPopupOnPress();
25: int TERTIARY_MASK = AWT.getTertiaryMask();
26: String TERTIARY_MODIFIER = AWT.getMouseModifiers(TERTIARY_MASK);
27: int MENU_SHORTCUT_MASK = Toolkit.getDefaultToolkit()
28: .getMenuShortcutKeyMask();
29: String MENU_SHORTCUT_MODIFIER = AWT
30: .getKeyModifiers(MENU_SHORTCUT_MASK);
31: String MENU_SHORTCUT_STRING = MENU_SHORTCUT_MASK == InputEvent.ALT_MASK ? "alt "
32: : MENU_SHORTCUT_MASK == InputEvent.META_MASK ? "meta "
33: : MENU_SHORTCUT_MASK == InputEvent.SHIFT_MASK ? "shift "
34: : "control ";
35: String MENU_SHORTCUT_KEYCODE = AWT.getKeyCode(AWT
36: .maskToKeyCode(MENU_SHORTCUT_MASK));
37: // VM also allows ALT, I think
38: int MOVE_MASK = InputEvent.SHIFT_MASK;
39: /** Drag/drop copy mask. */
40: int COPY_MASK = Platform.isMacintosh() ? InputEvent.ALT_MASK
41: : InputEvent.CTRL_MASK;
42: /** Drag/drop link mask. NOTE: w32 also natively uses ALT, but the VM
43: * doesn't (at least not 1.4.x).
44: */
45: int LINK_MASK = Platform.isMacintosh() ? InputEvent.ALT_MASK
46: | InputEvent.META_MASK : InputEvent.CTRL_MASK
47: | InputEvent.ALT_MASK;
48: }
|