public class Container<T extends Actor> extends WidgetGroup
Table with a single cell but is more lightweight.| Constructor and Description |
|---|
Container()
Creates a container with no actor.
|
Container(T actor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addActor(Actor actor)
Deprecated.
Container may have only a single child.
|
void |
addActorAfter(Actor actorAfter,
Actor actor)
Deprecated.
Container may have only a single child.
|
void |
addActorAt(int index,
Actor actor)
Deprecated.
Container may have only a single child.
|
void |
addActorBefore(Actor actorBefore,
Actor actor)
Deprecated.
Container may have only a single child.
|
Container<T> |
align(int align)
Sets the alignment of the actor within the container.
|
Container<T> |
background(Drawable background) |
Container<T> |
bottom()
Sets
Align.bottom and clears Align.top for the alignment of the actor within the container. |
Container<T> |
center()
Sets the alignment of the actor within the container to
Align.center. |
void |
draw(Batch batch,
float parentAlpha)
If this method is overridden, the super method or
WidgetGroup.validate() should be called to ensure the widget group is laid
out. |
protected void |
drawBackground(Batch batch,
float parentAlpha,
float x,
float y)
Called to draw the background, before clipping is applied (if enabled).
|
void |
drawDebug(ShapeRenderer shapes)
Draws this actor's debug lines if
Actor.getDebug() is true and, regardless of Actor.getDebug(), calls
Actor.drawDebug(ShapeRenderer) on each child. |
Container<T> |
fill()
Sets fillX and fillY to 1.
|
Container<T> |
fill(boolean fill)
Sets fillX and fillY to 1 if true, 0 if false.
|
Container<T> |
fill(boolean x,
boolean y)
Sets fillX and fillY to 1 if true, 0 if false.
|
Container<T> |
fill(float x,
float y) |
Container<T> |
fillX()
Sets fillX to 1.
|
Container<T> |
fillY()
Sets fillY to 1.
|
T |
getActor() |
int |
getAlign() |
Drawable |
getBackground() |
boolean |
getClip() |
float |
getFillX() |
float |
getFillY() |
float |
getMaxHeight()
Zero indicates no max height.
|
Value |
getMaxHeightValue() |
float |
getMaxWidth()
Zero indicates no max width.
|
Value |
getMaxWidthValue() |
float |
getMinHeight() |
Value |
getMinHeightValue() |
float |
getMinWidth() |
float |
getPadBottom() |
Value |
getPadBottomValue() |
float |
getPadLeft() |
Value |
getPadLeftValue() |
float |
getPadRight() |
Value |
getPadRightValue() |
float |
getPadTop() |
Value |
getPadTopValue() |
float |
getPadX()
Returns
getPadLeft() plus getPadRight(). |
float |
getPadY()
Returns
getPadTop() plus getPadBottom(). |
float |
getPrefHeight() |
Value |
getPrefHeightValue() |
float |
getPrefWidth() |
Value |
getPrefWidthValue() |
Container<T> |
height(float height)
Sets the minHeight, prefHeight, and maxHeight to the specified value.
|
Container<T> |
height(Value height)
Sets the minHeight, prefHeight, and maxHeight to the specified value.
|
Actor |
hit(float x,
float y,
boolean touchable)
|
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls
Layout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. |
Container<T> |
left()
Sets
Align.left and clears Align.right for the alignment of the actor within the container. |
Container<T> |
maxHeight(float maxHeight) |
Container<T> |
maxHeight(Value maxHeight) |
Container<T> |
maxSize(float size)
Sets the maxWidth and maxHeight to the specified value.
|
Container<T> |
maxSize(float width,
float height)
Sets the maxWidth and maxHeight to the specified values.
|
Container<T> |
maxSize(Value size)
Sets the maxWidth and maxHeight to the specified value.
|
Container<T> |
maxSize(Value width,
Value height)
Sets the maxWidth and maxHeight to the specified values.
|
Container<T> |
maxWidth(float maxWidth) |
Container<T> |
maxWidth(Value maxWidth) |
Container<T> |
minHeight(float minHeight) |
Container<T> |
minHeight(Value minHeight) |
Container<T> |
minSize(float size)
Sets the minWidth and minHeight to the specified value.
|
Container<T> |
minSize(float width,
float height)
Sets the minWidth and minHeight to the specified values.
|
Container<T> |
minSize(Value size)
Sets the minWidth and minHeight to the specified value.
|
Container<T> |
minSize(Value width,
Value height)
Sets the minWidth and minHeight to the specified values.
|
Container<T> |
minWidth(float minWidth) |
Container<T> |
minWidth(Value minWidth) |
Container<T> |
pad(float pad)
Sets the padTop, padLeft, padBottom, and padRight to the specified value.
|
Container<T> |
pad(float top,
float left,
float bottom,
float right) |
Container<T> |
pad(Value pad)
Sets the padTop, padLeft, padBottom, and padRight to the specified value.
|
Container<T> |
pad(Value top,
Value left,
Value bottom,
Value right) |
Container<T> |
padBottom(float padBottom) |
Container<T> |
padBottom(Value padBottom) |
Container<T> |
padLeft(float padLeft) |
Container<T> |
padLeft(Value padLeft) |
Container<T> |
padRight(float padRight) |
Container<T> |
padRight(Value padRight) |
Container<T> |
padTop(float padTop) |
Container<T> |
padTop(Value padTop) |
Container<T> |
prefHeight(float prefHeight) |
Container<T> |
prefHeight(Value prefHeight) |
Container<T> |
prefSize(float size)
Sets the prefWidth and prefHeight to the specified values.
|
Container<T> |
prefSize(float width,
float height)
Sets the prefWidth and prefHeight to the specified value.
|
Container<T> |
prefSize(Value size)
Sets the prefWidth and prefHeight to the specified value.
|
Container<T> |
prefSize(Value width,
Value height)
Sets the prefWidth and prefHeight to the specified values.
|
Container<T> |
prefWidth(float prefWidth) |
Container<T> |
prefWidth(Value prefWidth) |
boolean |
removeActor(Actor actor)
Removes an actor from this group and unfocuses it.
|
boolean |
removeActor(Actor actor,
boolean unfocus)
Removes an actor from this group.
|
Container<T> |
right()
Sets
Align.right and clears Align.left for the alignment of the actor within the container. |
void |
setActor(T actor) |
void |
setBackground(Drawable background)
Sets the background drawable and adjusts the container's padding to match the background.
|
void |
setBackground(Drawable background,
boolean adjustPadding)
Sets the background drawable and, if adjustPadding is true, sets the container's padding to
Drawable.getBottomHeight() , Drawable.getTopHeight(), Drawable.getLeftWidth(), and
Drawable.getRightWidth(). |
void |
setClip(boolean enabled)
Causes the contents to be clipped if they exceed the container bounds.
|
void |
setRound(boolean round)
If true (the default), positions and sizes are rounded to integers.
|
Container<T> |
size(float size)
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.
|
Container<T> |
size(float width,
float height)
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.
|
Container<T> |
size(Value size)
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.
|
Container<T> |
size(Value width,
Value height)
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.
|
Container<T> |
top()
Sets
Align.top and clears Align.bottom for the alignment of the actor within the container. |
Container<T> |
width(float width)
Sets the minWidth, prefWidth, and maxWidth to the specified value.
|
Container<T> |
width(Value width)
Sets the minWidth, prefWidth, and maxWidth to the specified value.
|
childrenChanged, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateact, applyTransform, applyTransform, clear, clearChildren, computeTransform, debugAll, drawChildren, drawDebugChildren, findActor, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toStringaddAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontpublic Container()
public Container(T actor)
public void draw(Batch batch, float parentAlpha)
WidgetGroupWidgetGroup.validate() should be called to ensure the widget group is laid
out.draw in class WidgetGroupparentAlpha - Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.protected void drawBackground(Batch batch, float parentAlpha, float x, float y)
public void setBackground(Drawable background)
setBackground(Drawable, boolean)public void setBackground(Drawable background, boolean adjustPadding)
Drawable.getBottomHeight() , Drawable.getTopHeight(), Drawable.getLeftWidth(), and
Drawable.getRightWidth().background - If null, the background will be cleared and padding removed.public Container<T> background(Drawable background)
setBackground(Drawable)public Drawable getBackground()
public void layout()
LayoutLayout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. This method should almost never be called directly, instead Layout.validate() should be used.layout in interface Layoutlayout in class WidgetGrouppublic void setActor(T actor)
actor - May be null.public T getActor()
public void addActor(Actor actor)
GroupaddActor in class GroupsetActor(Actor)public void addActorAt(int index,
Actor actor)
GroupaddActorAt in class Groupindex - May be greater than the number of children.setActor(Actor)public void addActorBefore(Actor actorBefore, Actor actor)
GroupaddActorBefore in class GroupsetActor(Actor)public void addActorAfter(Actor actorAfter, Actor actor)
GroupaddActorAfter in class GroupsetActor(Actor)public boolean removeActor(Actor actor)
GroupGroup.removeActor(Actor, boolean) with true.removeActor in class Grouppublic boolean removeActor(Actor actor, boolean unfocus)
Groupcleared so the actions will be returned to their
pool, if any. This is not done automatically.removeActor in class Groupunfocus - If true, Stage.unfocus(Actor) is called.public Container<T> size(Value size)
public Container<T> size(Value width, Value height)
public Container<T> size(float size)
public Container<T> size(float width, float height)
public Container<T> width(Value width)
public Container<T> width(float width)
public Container<T> height(Value height)
public Container<T> height(float height)
public Container<T> minSize(Value size)
public Container<T> minSize(Value width, Value height)
public Container<T> minSize(float size)
public Container<T> minSize(float width, float height)
public Container<T> prefSize(Value size)
public Container<T> prefSize(Value width, Value height)
public Container<T> prefSize(float width, float height)
public Container<T> prefSize(float size)
public Container<T> maxSize(Value size)
public Container<T> maxSize(Value width, Value height)
public Container<T> maxSize(float size)
public Container<T> maxSize(float width, float height)
public Container<T> pad(Value pad)
public Container<T> pad(float pad)
public Container<T> align(int align)
Align.center, Align.top, Align.bottom,
Align.left, Align.right, or any combination of those.public Container<T> center()
Align.center. This clears any other alignment.public Container<T> top()
Align.top and clears Align.bottom for the alignment of the actor within the container.public Container<T> left()
Align.left and clears Align.right for the alignment of the actor within the container.public Container<T> bottom()
Align.bottom and clears Align.top for the alignment of the actor within the container.public Container<T> right()
Align.right and clears Align.left for the alignment of the actor within the container.public float getMinWidth()
getMinWidth in interface LayoutgetMinWidth in class WidgetGrouppublic Value getMinHeightValue()
public float getMinHeight()
getMinHeight in interface LayoutgetMinHeight in class WidgetGrouppublic Value getPrefWidthValue()
public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class WidgetGrouppublic Value getPrefHeightValue()
public float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class WidgetGrouppublic Value getMaxWidthValue()
public float getMaxWidth()
LayoutgetMaxWidth in interface LayoutgetMaxWidth in class WidgetGrouppublic Value getMaxHeightValue()
public float getMaxHeight()
LayoutgetMaxHeight in interface LayoutgetMaxHeight in class WidgetGrouppublic Value getPadTopValue()
public float getPadTop()
public Value getPadLeftValue()
public float getPadLeft()
public Value getPadBottomValue()
public float getPadBottom()
public Value getPadRightValue()
public float getPadRight()
public float getPadX()
getPadLeft() plus getPadRight().public float getPadY()
getPadTop() plus getPadBottom().public float getFillX()
public float getFillY()
public int getAlign()
public void setRound(boolean round)
public void setClip(boolean enabled)
Group.setTransform(boolean) to true.public boolean getClip()
public Actor hit(float x, float y, boolean touchable)
Actortouchable and
visible, or null if no actor was hit. The point is specified in the actor's local coordinate system
(0,0 is the bottom left of the actor and width,height is the upper right).
This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not occur on this Actor.
The default implementation returns this actor if the point is within this actor's bounds.
hit in class Grouptouchable - If true, the hit detection will respect the touchability.Touchablepublic void drawDebug(ShapeRenderer shapes)
GroupActor.getDebug() is true and, regardless of Actor.getDebug(), calls
Actor.drawDebug(ShapeRenderer) on each child.