public class Button extends DisplayGroup implements UIObject
Modifier and Type | Field and Description |
---|---|
static GLColor |
DIMMED_COLOR |
protected Sprite9 |
mButtonSprite |
protected DisplayObject |
mContentGroup |
protected boolean |
mEnabled |
protected boolean |
mFocus |
protected int |
mState |
protected Texture[] |
mTextures |
protected boolean |
mTouchable |
protected TouchListener |
mTouchListener |
static int |
STATE_DISABLED |
static int |
STATE_DOWN |
static int |
STATE_UP |
ATT_CACHE_ENABLED, ATT_CLIPPING_ENABLED, ATT_TOUCHABLE, mCacheDrawer, mCacheEnabled, mCacheFrameBuffer, mCachePolicy, mCacheProjection, mChildren, mChildrenDisplayOrder, mChildrenIds, mClippingEnabled, mClipStageRect, mNumChildren, mOriginalScissor, mOriginalScissorEnabled, mVisibleTouchables, mWrapContentHeight, mWrapContentWidth
ATT_ALPHA, ATT_ANIMATOR, ATT_BLEND_MODE, ATT_COLOR, ATT_DEBUG, ATT_ORIGIN_AT_CENTER, ATT_ROTATION, ATT_VISIBLE, mAlive, mAlpha, mAlphaTestEnabled, mAutoUpdateBounds, mBlendFunc, mBounds, mBypassCameraClipping, mColor, mDebugFlags, mFrameDuration, mHasTransformValues, mId, mInvalidateFlags, mManipulators, mMask, mMatrix, mNumManipulators, mOrigin, mParent, mPerspectiveEnabled, mPivot, mPosition, mRotation, mRotationVectorX, mRotationVectorY, mRotationVectorZ, mScale, mScene, mSceneSize, mSize, mSkew, mTransformMatrix, mTransformMatrixValues, mUIConstraint, mVisible, mZ, TAG
FLIP_X, FLIP_Y
ALL, ALPHA, BLEND, BOUNDS, CACHE, CHILDREN, COLOR, DEPTH, FRAME, ORIGIN, PARENT, PARENT_BOUNDS, PERSPECTIVE, PIVOT, POSITION, ROTATION, SCALE, SIZE, SKEW, TEXTURE, TEXTURE_COORDS, TRANSFORM_MATRIX, VERTICES, VISIBILITY, VISUAL
CACHE_WHEN_CHILDREN_CHANGED, CACHE_WHEN_CHILDREN_STABLE
Constructor and Description |
---|
Button() |
Modifier and Type | Method and Description |
---|---|
protected void |
createChildren() |
Sprite9 |
getButtonSprite() |
TouchListener |
getTouchListener() |
boolean |
hitTest(float x,
float y) |
boolean |
isEnabled() |
boolean |
isTouchable() |
boolean |
onTouchEvent(MotionEvent event)
Note: This is called from UI-Thread
|
void |
set9Patches(float left,
float right,
float top,
float bottom) |
void |
setContent(DisplayObject contentGroup) |
protected void |
setContentForced(DisplayObject contentGroup) |
void |
setEnabled(boolean enabled) |
void |
setSize(float w,
float h) |
protected void |
setState(int state) |
void |
setTextures(Texture... textures) |
void |
setTouchable(boolean touchable) |
void |
setTouchListener(TouchListener listener) |
void |
setXMLAttributes(XmlPullParser xmlParser,
UIManager manager) |
boolean |
update(int deltaTime) |
addChild, addChild, clearCache, dispose, draw, drawChildren, getCachePolicy, getCacheProjection, getChildAt, getChildById, getChildIndex, getNumChildren, getNumGrandChildren, getObjectTree, initCache, isCacheEnabled, isChildInBounds, isClippingEnabled, isWrapContenHeight, isWrapContentWidth, onAddedChild, onAddedToScene, onRemovedChild, onRemovedFromScene, removeAllChildren, removeChild, removeChild, sendChildToBottom, sendChildToTop, setCacheEnabled, setCachePolicy, setCacheProjection, setChildrenDisplayOrder, setClippingEnabled, setWrapContentHeight, setWrapContentWidth, swapChildren, swapChildren, updateChildren
addManipulator, drawBounds, drawEnd, drawStart, drawWireframe, getAlpha, getBlendFunc, getBounds, getColor, getDebugFlags, getFps, getGlobalPosition, getHeight, getId, getInheritedBlendFunc, getInheritedColor, getManipulator, getMask, getMatrix, getNumManipulators, getOrigin, getParent, getParentMatrix, getPivot, getPosition, getRotation, getScale, getScene, getSceneSize, getSize, getSkew, getUIConstraint, getWidth, getX, getY, getZ, globalToLocal, invalidate, invalidate, isAlive, isAlphaTestEnabled, isAutoUpdateBounds, isBypassCameraClipping, isOriginAtCenter, isPerspectiveEnabled, isVisible, localToGlobal, move, moveTo, onAdded, onCreateChildren, onPreConcatParentMatrix, onRemoved, queueEvent, removeAllManipulators, removeFromParent, removeManipulator, rotate, setAlive, setAlpha, setAlphaTestEnabled, setAutoUpdateBounds, setBlendFunc, setBypassCameraClipping, setColor, setDebugFlags, setFps, setId, setMask, setOrigin, setOrigin, setOriginAtCenter, setPerspectiveEnabled, setPivot, setPivot, setPivotAtCenter, setPosition, setPosition, setRotation, setRotationVector, setScale, setScale, setSize, setSkew, setUIConstraint, setVisible, setX, setY, setZ, shouldDraw, toString, updateBounds, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
draw, isPerspectiveEnabled, onAdded, onCreateChildren, setPerspectiveEnabled
addManipulator, dispose, getAlpha, getBlendFunc, getBounds, getColor, getFps, getId, getInheritedBlendFunc, getInheritedColor, getManipulator, getNumManipulators, getObjectTree, getOrigin, getParent, getPivot, getScene, getSkew, getZ, globalToLocal, invalidate, invalidate, isAlive, isAutoUpdateBounds, isVisible, localToGlobal, onAddedToScene, onRemoved, onRemovedFromScene, queueEvent, removeAllManipulators, removeFromParent, removeManipulator, setAlive, setAlpha, setAutoUpdateBounds, setBlendFunc, setColor, setFps, setId, setOrigin, setOrigin, setOriginAtCenter, setPivot, setPivot, setPivotAtCenter, setSkew, setVisible, setZ, shouldDraw, updateBounds
getHeight, getPosition, getRotation, getScale, getSize, getWidth, getX, getY, move, moveTo, rotate, setPosition, setPosition, setRotation, setScale, setScale, setSize, setX, setY
getMatrix, getScene, getSize, globalToLocal, invalidate, invalidate, localToGlobal, queueEvent
public static final GLColor DIMMED_COLOR
public static final int STATE_UP
public static final int STATE_DOWN
public static final int STATE_DISABLED
protected boolean mEnabled
protected int mState
protected Texture[] mTextures
protected boolean mTouchable
protected boolean mFocus
protected Sprite9 mButtonSprite
protected DisplayObject mContentGroup
protected TouchListener mTouchListener
public boolean update(int deltaTime)
update
in interface Displayable
update
in class BaseDisplayObject
protected void createChildren()
public void setTextures(Texture... textures)
public void setSize(float w, float h)
setSize
in interface Manipulatable
setSize
in class BaseDisplayObject
public void setContent(DisplayObject contentGroup)
public void set9Patches(float left, float right, float top, float bottom)
protected void setContentForced(DisplayObject contentGroup)
protected void setState(int state)
public boolean isEnabled()
public void setEnabled(boolean enabled)
public Sprite9 getButtonSprite()
public boolean hitTest(float x, float y)
x
- y
- public void setTouchable(boolean touchable)
setTouchable
in interface Touchable
setTouchable
in class DisplayGroup
public boolean isTouchable()
isTouchable
in interface Touchable
isTouchable
in class DisplayGroup
public TouchListener getTouchListener()
public void setTouchListener(TouchListener listener)
public boolean onTouchEvent(MotionEvent event)
onTouchEvent
in interface Touchable
onTouchEvent
in class DisplayGroup
public void setXMLAttributes(XmlPullParser xmlParser, UIManager manager)
setXMLAttributes
in interface DisplayObject
setXMLAttributes
in class DisplayGroup