Package com.badlogic.gdx.scenes.scene2d
Class Event
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.Event
-
- All Implemented Interfaces:
Pool.Poolable
- Direct Known Subclasses:
ChangeListener.ChangeEvent,FocusListener.FocusEvent,InputEvent
public class Event extends java.lang.Object implements Pool.Poolable
The base class for all events.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 defaultActor.fire(Event)will mark events handled if anEventListenerreturns true.A cancelled event will be stopped and handled. Additionally, many actors will undo the side-effects of a canceled event. (See
cancel().)- See Also:
InputEvent,Actor.fire(Event)
-
-
Constructor Summary
Constructors Constructor Description Event()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Marks this event cancelled.booleangetBubbles()ActorgetListenerActor()Returns the actor that this listener is attached to.StagegetStage()The stage for the actor the event was fired on.ActorgetTarget()Returns the actor that the event originated from.voidhandle()Marks this event as handled.booleanisCancelled()booleanisCapture()If true, the event was fired during the capture phase.booleanisHandled()booleanisStopped()voidreset()Resets the object for reuse.voidsetBubbles(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.voidsetCapture(boolean capture)voidsetListenerActor(Actor listenerActor)voidsetStage(Stage stage)voidsetTarget(Actor targetActor)voidstop()Marks this event has being stopped.
-
-
-
Method Detail
-
handle
public void handle()
Marks this event as handled. This does not affect event propagation inside scene2d, but causes theStageInputProcessormethods to return true, which will eat the event so it is not passed on to the application under the stage.
-
cancel
public void cancel()
-
stop
public void stop()
Marks this event has being stopped. This halts event propagation. Any other listeners on thelistener actorare notified, but after that no other listeners are notified.
-
reset
public void reset()
Description copied from interface:Pool.PoolableResets the object for reuse. Object references should be nulled and fields may be set to default values.- Specified by:
resetin interfacePool.Poolable
-
getTarget
public Actor getTarget()
Returns the actor that the event originated from.
-
setTarget
public void setTarget(Actor targetActor)
-
getListenerActor
public Actor getListenerActor()
Returns the actor that this listener is attached to.
-
setListenerActor
public void setListenerActor(Actor listenerActor)
-
getBubbles
public boolean getBubbles()
-
setBubbles
public 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.
-
isHandled
public boolean isHandled()
-
isStopped
public boolean isStopped()
- See Also:
stop()
-
isCancelled
public boolean isCancelled()
- See Also:
cancel()
-
setCapture
public void setCapture(boolean capture)
-
isCapture
public boolean isCapture()
If true, the event was fired during the capture phase.- See Also:
Actor.fire(Event)
-
setStage
public void setStage(Stage stage)
-
getStage
public Stage getStage()
The stage for the actor the event was fired on.
-
-