Artenus 2D Framework
Artenus Reference
Handles touch events for the underlying entity.
public class TouchButton
extends FilteredEntity
implements Button, Touchable

Field Summary

Fields inherited from com.annahid.libs.artenus.entities.FilteredEntity

Constructor Summary

Modifier and TypeConstructor and Description
public TouchButton(Entity target)
Creates a new touch button that adds button behavior to the underlying entity.

Method Summary

Modifier and TypeMethod and Description
public ButtonListenergetListener()
Gets the button listener currently assigned to this touch button.
public final booleanhandleTouch(TouchEvent event)
Always returns false.
public booleanhasBehavior(Behaviors behavior)
Determines whether the underlying entity has the specified behavior.
public booleanisPressed()
Returns a value indicating whether this touch button is currently in pressed state.
public voidonAttach(Scene scene)
Called when this entity is associated with a scene.
public voidonDetach(Scene scene)
Called when this entity is dissociated with a scene.
public voidrender(RenderingContext ctx, int flags)
Calls render on the underlying entity, with specified flags.
public voidsetListener(ButtonListener listener)
Sets the button listener for this touch button.

Methods inherited from com.annahid.libs.artenus.entities.FilteredEntity

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

TouchButton
public  TouchButton(
    Entity target
)
Creates a new touch button that adds button behavior to the underlying entity.
Parameters:
targetThe underlying entity

Method Detail

getListener
public ButtonListener getListener()
Gets the button listener currently assigned to this touch button.
Specified By:
handleTouch
public final boolean handleTouch(
    TouchEvent event
)
Always returns false. Touch buttons do not participate in the normal touch event pipeline. Their touch event is handled through the touch map associated with the scene.
Parameters:
eventEvent information
Specified By:
Returns:
true if handled, false otherwise
hasBehavior
public boolean hasBehavior(
    Behaviors behavior
)
Determines whether the underlying entity has the specified behavior.
Overrides:
Returns:
true if the underlying entity has the behavior, false otherwise
isPressed
public boolean isPressed()
Returns a value indicating whether this touch button is currently in pressed state.
Specified By:
Returns:
true if the button is pressed, false otherwise
onAttach
public void onAttach(
    Scene scene
)
Called when this entity is associated with a scene.
Overrides:
onDetach
public void onDetach(
    Scene scene
)
Called when this entity is dissociated with a scene.
Overrides:
render
public void render(
    RenderingContext ctx,
    int flags
)
Calls render on the underlying entity, with specified flags.
Overrides:
setListener
public void setListener(
    ButtonListener listener
)
Sets the button listener for this touch button.
Parameters:
listenerThe listener
Specified By: