public class Event extends Object implements Pool.Poolable
By default an event will "bubble" up through an actor's parent's handlers (see setBubbles(boolean)
).
An actor's capture listeners can stop()
an event to prevent child actors from seeing it.
An Event may be marked as "handled" which will end its propagation outside of the Stage (see handle()
). The default
Actor.fire(Event)
will mark events handled if an EventListener
returns true.
A cancelled event will be stopped and handled. Additionally, many actors will undo the side-effects of a canceled event. (See
cancel()
.)
InputEvent
,
Actor.fire(Event)
Constructor and Description |
---|
Event() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Marks this event cancelled.
|
boolean |
getBubbles() |
Actor |
getListenerActor()
Returns the actor that this listener is attached to.
|
Stage |
getStage()
The stage for the actor the event was fired on.
|
Actor |
getTarget()
Returns the actor that the event originated from.
|
void |
handle()
Marks this event as handled.
|
boolean |
isCancelled() |
boolean |
isCapture()
If true, the event was fired during the capture phase.
|
boolean |
isHandled()
|
boolean |
isStopped() |
void |
reset()
Resets the object for reuse.
|
void |
setBubbles(boolean bubbles)
If true, after the event is fired on the target actor, it will also be fired on each of the parent actors, all the way to
the root.
|
void |
setCapture(boolean capture) |
void |
setListenerActor(Actor listenerActor) |
void |
setStage(Stage stage) |
void |
setTarget(Actor targetActor) |
void |
stop()
Marks this event has being stopped.
|
public void handle()
Stage
event
methods to return true, which will eat the event so it is not passed on to the application under the stage.public void cancel()
public void stop()
listener actor
are notified, but after that no other listeners are notified.public void reset()
Pool.Poolable
reset
in interface Pool.Poolable
public Actor getTarget()
public void setTarget(Actor targetActor)
public Actor getListenerActor()
public void setListenerActor(Actor listenerActor)
public boolean getBubbles()
public void setBubbles(boolean bubbles)
public boolean isHandled()
public boolean isStopped()
stop()
public boolean isCancelled()
cancel()
public void setCapture(boolean capture)
public boolean isCapture()
Actor.fire(Event)
public void setStage(Stage stage)
public Stage getStage()
Copyright © 2017. All rights reserved.