public class PInputEventFilter extends Object
To be accepted events must contain all the modifiers listed in the andMask, at least one of the modifiers listed in the orMask, and none of the modifiers listed in the notMask. The event filter also lets you specify specific event types (mousePressed, released, ...) to accept or reject.
If the event filter is set to consume, then it will call consume on any event that it successfully accepts.
Modifier and Type | Field and Description |
---|---|
static int |
ALL_MODIFIERS_MASK
Mask representing all possible modifiers.
|
Constructor and Description |
---|
PInputEventFilter()
Creates a PInputEventFilter that accepts everything.
|
PInputEventFilter(int andMask)
Creates a PInputEventFilter that will accept events if they have the
given andMask.
|
PInputEventFilter(int andMask,
int notMask)
Creates a PInputEventFilter that will accept events if they have the
given andMask and do not contain any of the bits in the notMask.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptAllClickCounts()
Makes this filter accept all mouse click combinations.
|
void |
acceptAllEventTypes()
Makes the filter accept all event types.
|
void |
acceptEverything()
Makes this filter accept absolutely everything.
|
boolean |
acceptsEvent(PInputEvent event,
int type)
Returns true if the passed event is one that is accepted.
|
boolean |
getAcceptsAlreadyHandledEvents()
Returns whether this filter accepts events that have already been flagged
as handled.
|
boolean |
getAcceptsFocusEvents()
Returns whether this filter accepts focus events.
|
boolean |
getAcceptsKeyPressed()
Returns whether this filter accepts key pressed events.
|
boolean |
getAcceptsKeyReleased()
Returns whether this filter accepts key released events.
|
boolean |
getAcceptsKeyTyped()
Returns whether this filter accepts key typed events.
|
boolean |
getAcceptsMouseClicked()
Returns whether this filter accepts mouse clicked events.
|
boolean |
getAcceptsMouseDragged()
Returns whether this filter accepts mouse dragged events.
|
boolean |
getAcceptsMouseEntered()
Returns whether this filter accepts mouse entered events.
|
boolean |
getAcceptsMouseExited()
Returns whether this filter accepts mouse exited events.
|
boolean |
getAcceptsMouseMoved()
Returns whether this filter accepts mouse moved events.
|
boolean |
getAcceptsMousePressed()
Returns whether this filter accepts mouse pressed events.
|
boolean |
getAcceptsMouseReleased()
Returns whether this filter accepts mouse released events.
|
boolean |
getAcceptsMouseWheelRotated()
Returns whether this filter accepts mouse wheel rotated events.
|
boolean |
getMarksAcceptedEventsAsHandled()
Returns whether this filter marks events as handled if they are accepted.
|
void |
rejectAllClickCounts()
Flags all mouse click events as disallowed, regardless of button
configuration.
|
void |
rejectAllEventTypes()
Configures filter so that no events will ever get accepted.
|
void |
setAcceptClickCount(short aClickCount)
Sets the number of clicks that an incoming event must have to be accepted.
|
void |
setAcceptsAlreadyHandledEvents(boolean aBoolean)
Sets whether already handled events should be accepted.
|
void |
setAcceptsFocusEvents(boolean aBoolean)
Sets whether this filter accepts focus events.
|
void |
setAcceptsKeyPressed(boolean aBoolean)
Sets whether this filter accepts key pressed events.
|
void |
setAcceptsKeyReleased(boolean aBoolean)
Sets whether this filter accepts key released events.
|
void |
setAcceptsKeyTyped(boolean aBoolean)
Sets whether this filter accepts key typed events.
|
void |
setAcceptsMouseClicked(boolean aBoolean)
Sets whether this filter accepts mouse clicked events.
|
void |
setAcceptsMouseDragged(boolean aBoolean)
Sets whether this filter accepts mouse dragged events.
|
void |
setAcceptsMouseEntered(boolean aBoolean)
Sets whether this filter accepts mouse entered events.
|
void |
setAcceptsMouseExited(boolean aBoolean)
Sets whether this filter accepts mouse exited events.
|
void |
setAcceptsMouseMoved(boolean aBoolean)
Sets whether this filter accepts mouse moved events.
|
void |
setAcceptsMousePressed(boolean aBoolean)
Sets whether this filter accepts mouse pressed events.
|
void |
setAcceptsMouseReleased(boolean aBoolean)
Sets whether this filter accepts mouse released events.
|
void |
setAcceptsMouseWheelRotated(boolean aBoolean)
Sets whether this filter accepts mouse wheel rotation events.
|
void |
setAndMask(int aAndMask)
Sets and mask used to filter events.
|
void |
setMarksAcceptedEventsAsHandled(boolean aBoolean)
Sets whether events will be marked as dirty once accepted.
|
void |
setNotMask(int aNotMask)
Sets not mask used to filter events.
|
void |
setOrMask(int aOrMask)
Sets or mask used to filter events.
|
public static int ALL_MODIFIERS_MASK
public PInputEventFilter()
public PInputEventFilter(int andMask)
andMask
- exact pattern event modifiers must be to get acceptedpublic PInputEventFilter(int andMask, int notMask)
andMask
- exact pattern event modifiers must be to get acceptednotMask
- if any or these bits are on event is not acceptedpublic boolean acceptsEvent(PInputEvent event, int type)
event
- Event under considerationtype
- The type of event encoded as the PInputEventpublic void acceptAllClickCounts()
public void acceptAllEventTypes()
public void acceptEverything()
public boolean getAcceptsKeyPressed()
public boolean getAcceptsKeyReleased()
public boolean getAcceptsKeyTyped()
public boolean getAcceptsMouseClicked()
public boolean getAcceptsMouseDragged()
public boolean getAcceptsMouseEntered()
public boolean getAcceptsMouseExited()
public boolean getAcceptsMouseMoved()
public boolean getAcceptsMousePressed()
public boolean getAcceptsMouseReleased()
public boolean getAcceptsMouseWheelRotated()
public boolean getAcceptsFocusEvents()
public boolean getAcceptsAlreadyHandledEvents()
public boolean getMarksAcceptedEventsAsHandled()
public void rejectAllClickCounts()
public void rejectAllEventTypes()
public void setAcceptClickCount(short aClickCount)
aClickCount
- number clicks that an incoming event must have to be acceptedpublic void setAcceptsKeyPressed(boolean aBoolean)
aBoolean
- whether filter should accept key pressed eventspublic void setAcceptsKeyReleased(boolean aBoolean)
aBoolean
- whether filter should accept key released eventspublic void setAcceptsKeyTyped(boolean aBoolean)
aBoolean
- whether filter should accept key typed eventspublic void setAcceptsMouseClicked(boolean aBoolean)
aBoolean
- whether filter should accept mouse clicked eventspublic void setAcceptsMouseDragged(boolean aBoolean)
aBoolean
- whether filter should accept mouse dragged eventspublic void setAcceptsMouseEntered(boolean aBoolean)
aBoolean
- whether filter should accept mouse entered eventspublic void setAcceptsMouseExited(boolean aBoolean)
aBoolean
- whether filter should accept mouse exited eventspublic void setAcceptsMouseMoved(boolean aBoolean)
aBoolean
- whether filter should accept mouse moved eventspublic void setAcceptsMousePressed(boolean aBoolean)
aBoolean
- whether filter should accept mouse pressed eventspublic void setAcceptsMouseReleased(boolean aBoolean)
aBoolean
- whether filter should accept mouse released eventspublic void setAcceptsMouseWheelRotated(boolean aBoolean)
aBoolean
- whether filter should accept mouse wheel rotated eventspublic void setAcceptsFocusEvents(boolean aBoolean)
aBoolean
- whether filter should accept focus eventspublic void setAndMask(int aAndMask)
aAndMask
- the and mask to use for filtering eventspublic void setAcceptsAlreadyHandledEvents(boolean aBoolean)
aBoolean
- whether already handled events should be acceptedpublic void setMarksAcceptedEventsAsHandled(boolean aBoolean)
aBoolean
- whether events will be marked as dirty once acceptedpublic void setNotMask(int aNotMask)
aNotMask
- the not mask to use for filtering eventspublic void setOrMask(int aOrMask)
aOrMask
- the or mask to use for filtering eventsCopyright © 1995-2012 Piccolo2D. All Rights Reserved.