public class Shortcut extends Object
BogusEvent means to bind user-defined actions
from a BogusEvent.
Every BogusEvent instance has a shortcut which represents a
gesture-id(), for instance, the button being dragged and the modifier key
pressed (see modifiers()) at the very moment an user interaction takes place,
such as when she drags a giving mouse button while pressing the 'CTRL' modifier key.
See BogusEvent.shortcut(). Note that for the shortcut
description() to work properly, gesture-id()s should be registered at
the shortcut class first (see registerID(String)).
Different bogus event types should be related to different shortcuts. The current implementation supports the following event/shortcut types:
MotionEvent /
MotionShortcut. Note that motion-event derived classes:
DOF1Event, DOF2Event,
DOF3Event, DOF6Event, are also
related to motion shortcuts.ClickEvent / ClickShortcut
KeyboardEvent /
KeyboardShortcuteventClass().e.g.,
protected Class<? extends CustomEvent> eventClass() {
return CustomEvent.class;
}
and implement a register id routine either from registerID(Class, String) or
registerID(Class, int, String), e.g.,
public static int registerID(int id, String description) {
return Shortcut.registerID(CustomShortcut.class, id, description);
}
Note that if your CustomShortcut class defines it's own attributes, its
hashCode() and equals(Object) methods should be overridden as well.
| Constructor and Description |
|---|
Shortcut()
Constructs an "empty" shortcut.
|
Shortcut(int _id)
Defines a shortcut from the given id.
|
Shortcut(int m,
int i) |
| Modifier and Type | Method and Description |
|---|---|
String |
description()
Shortcut description.
|
boolean |
equals(Object obj) |
int |
hashCode() |
static boolean |
hasID(Class<? extends Shortcut> clazz,
int id)
Returns
true if the given Shortcut clazz id is registered and
false otherwise. |
static boolean |
hasID(int id)
Same as
return Shortcut.hasID(Shortcut.class, id). |
int |
id()
Returns the shortcut's id.
|
int |
modifiers()
Returns the shortcut's modifiers mask.
|
static int |
registerID(Class<? extends Shortcut> clazz,
int id,
String description)
Registers (and returns) the given
id for the shortcut clazz with the
given description. |
static int |
registerID(Class<? extends Shortcut> clazz,
String description)
Registers (and returns) the first available
id for the shortcut clazz
with the given description. |
static int |
registerID(int id,
String description)
Same as
return registerID(Shortcut.class, id, description). |
static int |
registerID(String description)
Same as
return registerID(Shortcut.class, description). |
public Shortcut()
Shortcut(int) with the integer
parameter being NO_NOMODIFIER_MASK.public Shortcut(int _id)
_id - gesture-idpublic Shortcut(int m,
int i)
m - modifier mask defining the shortcutpublic static int registerID(Class<? extends Shortcut> clazz, String description)
id for the shortcut clazz
with the given description.registerID(Class, int, String),
hasID(Class, int)public static boolean hasID(Class<? extends Shortcut> clazz, int id)
true if the given Shortcut clazz id is registered and
false otherwise.public static int registerID(Class<? extends Shortcut> clazz, int id, String description)
id for the shortcut clazz with the
given description.registerID(Class, String),
hasID(Class, int)public static int registerID(int id,
String description)
return registerID(Shortcut.class, id, description).registerID(Class, int, String),
hasID(Class, int)public static int registerID(String description)
return registerID(Shortcut.class, description).registerID(Class, String),
hasID(Class, int)public static boolean hasID(int id)
return Shortcut.hasID(Shortcut.class, id).registerID(int, String),
hasID(Class, int)public String description()
public int modifiers()
public int id()
Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia