Package com.prineside.tdi2.scene2d.ui
Class Container<T extends Actor>
java.lang.Object
com.prineside.tdi2.scene2d.Actor
com.prineside.tdi2.scene2d.Group
com.prineside.tdi2.scene2d.ui.WidgetGroup
com.prineside.tdi2.scene2d.ui.Container<T>
A group with a single child that sizes and positions the child using constraints. This provides layout similar to a
Table with a single cell but is more lightweight.- Author:
- Nathan Sweet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Container may have only a single child.voidaddActorAfter(Actor actorAfter, Actor actor) Deprecated.Container may have only a single child.voidaddActorAt(int index, Actor actor) Deprecated.Container may have only a single child.voidaddActorBefore(Actor actorBefore, Actor actor) Deprecated.Container may have only a single child.align(int align) Sets the alignment of the actor within the container.background(Drawable background) bottom()SetsAlign.bottomand clearsAlign.topfor the alignment of the actor within the container.center()Sets the alignment of the actor within the container toAlign.center.clip()Sets clip to true.clip(boolean enabled) voidIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.voiddrawDebug(ShapeRenderer shapes) Draws this actor's debug lines ifActor.getDebug()is true and, regardless ofActor.getDebug(), callsActor.drawDebug(ShapeRenderer)on each child.fill()Sets fillX and fillY to 1.fill(boolean fill) Sets fillX and fillY to 1 if true, 0 if false.fill(boolean x, boolean y) Sets fillX and fillY to 1 if true, 0 if false.fill(float x, float y) fillX()Sets fillX to 1.fillY()Sets fillY to 1.getActor()intgetAlign()booleangetClip()floatgetFillX()floatgetFillY()floatZero indicates no max height.floatZero indicates no max width.floatfloatfloatfloatfloatfloatfloatgetPadX()ReturnsgetPadLeft()plusgetPadRight().floatgetPadY()ReturnsgetPadTop()plusgetPadBottom().floatfloatheight(float height) Sets the minHeight, prefHeight, and maxHeight to the specified value.Sets the minHeight, prefHeight, and maxHeight to the specified value.hit(float x, float y, boolean touchable) If this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.voidlayout()Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()on any each child whose width or height has changed, and callsLayout.validate()on each child.left()SetsAlign.leftand clearsAlign.rightfor the alignment of the actor within the container.maxHeight(float maxHeight) maxSize(float size) Sets the maxWidth and maxHeight to the specified value.maxSize(float width, float height) Sets the maxWidth and maxHeight to the specified values.Sets the maxWidth and maxHeight to the specified value.Sets the maxWidth and maxHeight to the specified values.maxWidth(float maxWidth) minHeight(float minHeight) minSize(float size) Sets the minWidth and minHeight to the specified value.minSize(float width, float height) Sets the minWidth and minHeight to the specified values.Sets the minWidth and minHeight to the specified value.Sets the minWidth and minHeight to the specified values.minWidth(float minWidth) pad(float pad) Sets the padTop, padLeft, padBottom, and padRight to the specified value.pad(float top, float left, float bottom, float right) Sets the padTop, padLeft, padBottom, and padRight to the specified value.padBottom(float padBottom) padLeft(float padLeft) padRight(float padRight) padTop(float padTop) prefHeight(float prefHeight) prefHeight(Value prefHeight) prefSize(float size) Sets the prefWidth and prefHeight to the specified values.prefSize(float width, float height) Sets the prefWidth and prefHeight to the specified value.Sets the prefWidth and prefHeight to the specified value.Sets the prefWidth and prefHeight to the specified values.prefWidth(float prefWidth) booleanremoveActor(Actor actor) Removes an actor from this group and unfocuses it.booleanremoveActor(Actor actor, boolean unfocus) Removes an actor from this group.removeActorAt(int index, boolean unfocus) Removes an actor from this group.right()SetsAlign.rightand clearsAlign.leftfor the alignment of the actor within the container.voidvoidsetBackground(Drawable background) Sets the background drawable and adjusts the container's padding to match the background.voidsetBackground(Drawable background, boolean adjustPadding) Sets the background drawable and, if adjustPadding is true, sets the container's padding toDrawable.getBottomHeight(),Drawable.getTopHeight(),Drawable.getLeftWidth(), andDrawable.getRightWidth().voidsetClip(boolean enabled) Causes the contents to be clipped if they exceed the container bounds.voidsetCullingArea(Rectangle cullingArea) Children completely outside of this rectangle will not be drawn.voidsetRound(boolean round) If true (the default), positions and sizes are rounded to integers.size(float size) Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.size(float width, float height) Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.top()SetsAlign.topand clearsAlign.bottomfor the alignment of the actor within the container.width(float width) Sets the minWidth, prefWidth, and maxWidth to the specified value.Sets the minWidth, prefWidth, and maxWidth to the specified value.Methods inherited from class com.prineside.tdi2.scene2d.ui.WidgetGroup
getMinWidthValue, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setPrefHeight, setPrefHeight, setPrefWidth, setPrefWidth, setWidth, validateMethods inherited from class com.prineside.tdi2.scene2d.Group
act, clear, clear, clearChildren, clearChildren, debugAll, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, setDebug, setTransform, swapActor, swapActor, toStringMethods inherited from class com.prineside.tdi2.scene2d.Actor
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, 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, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront
-
Constructor Details
-
Container
public Container()Creates a container with no actor. -
Container
-
-
Method Details
-
draw
Description copied from class:WidgetGroupIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.- Overrides:
drawin classWidgetGroupparentAlpha- The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all children.
-
setBackground
Sets the background drawable and adjusts the container's padding to match the background.- See Also:
-
setBackground
Sets the background drawable and, if adjustPadding is true, sets the container's padding toDrawable.getBottomHeight(),Drawable.getTopHeight(),Drawable.getLeftWidth(), andDrawable.getRightWidth().- Parameters:
background- If null, the background will be cleared and padding removed.
-
background
- See Also:
-
getBackground
-
layout
public void layout()Description copied from interface:LayoutComputes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()on any each child whose width or height has changed, and callsLayout.validate()on each child. This method should almost never be called directly, insteadLayout.validate()should be used.- Specified by:
layoutin interfaceLayout- Overrides:
layoutin classWidgetGroup
-
setCullingArea
Description copied from class:GroupChildren completely outside of this rectangle will not be drawn. This is only valid for use with unrotated and unscaled actors.- Specified by:
setCullingAreain interfaceCullable- Overrides:
setCullingAreain classGroup- Parameters:
cullingArea- May be null.
-
setActor
- Parameters:
actor- May be null.
-
getActor
- Returns:
- May be null.
-
addActor
Deprecated.Container may have only a single child.Description copied from class:GroupAdds an actor as a child of this group, removing it from its previous parent. If the actor is already a child of this group, no changes are made. -
addActorAt
Deprecated.Container may have only a single child.Description copied from class:GroupAdds an actor as a child of this group at a specific index, removing it from its previous parent. If the actor is already a child of this group, no changes are made.- Overrides:
addActorAtin classGroup- Parameters:
index- May be greater than the number of children.- See Also:
-
addActorBefore
Deprecated.Container may have only a single child.Description copied from class:GroupAdds an actor as a child of this group immediately before another child actor, removing it from its previous parent. If the actor is already a child of this group, no changes are made.- Overrides:
addActorBeforein classGroup- See Also:
-
addActorAfter
Deprecated.Container may have only a single child.Description copied from class:GroupAdds an actor as a child of this group immediately after another child actor, removing it from its previous parent. If the actor is already a child of this group, no changes are made. IfactorAfteris not in this group, the actor is added as the last child.- Overrides:
addActorAfterin classGroup- See Also:
-
removeActor
Description copied from class:GroupRemoves an actor from this group and unfocuses it. CallsGroup.removeActor(Actor, boolean)with true.- Overrides:
removeActorin classGroup
-
removeActor
Description copied from class:GroupRemoves an actor from this group. CallsGroup.removeActorAt(int, boolean)with the actor's child index.- Overrides:
removeActorin classGroup
-
removeActorAt
Description copied from class:GroupRemoves an actor from this group. If the actor will not be used again and has actions, they should beclearedso the actions will be returned to theirpool, if any. This is not done automatically.- Overrides:
removeActorAtin classGroupunfocus- If true,Stage.unfocus(Actor)is called.- Returns:
- the actor removed from this group.
-
size
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value. -
size
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values. -
size
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value. -
size
Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values. -
width
Sets the minWidth, prefWidth, and maxWidth to the specified value. -
width
Sets the minWidth, prefWidth, and maxWidth to the specified value. -
height
Sets the minHeight, prefHeight, and maxHeight to the specified value. -
height
Sets the minHeight, prefHeight, and maxHeight to the specified value. -
minSize
Sets the minWidth and minHeight to the specified value. -
minSize
Sets the minWidth and minHeight to the specified values. -
minWidth
-
minHeight
-
minSize
Sets the minWidth and minHeight to the specified value. -
minSize
Sets the minWidth and minHeight to the specified values. -
minWidth
-
minHeight
-
prefSize
Sets the prefWidth and prefHeight to the specified value. -
prefSize
Sets the prefWidth and prefHeight to the specified values. -
prefWidth
-
prefHeight
-
prefSize
Sets the prefWidth and prefHeight to the specified value. -
prefSize
Sets the prefWidth and prefHeight to the specified values. -
prefWidth
-
prefHeight
-
maxSize
Sets the maxWidth and maxHeight to the specified value. -
maxSize
Sets the maxWidth and maxHeight to the specified values. -
maxWidth
-
maxHeight
-
maxSize
Sets the maxWidth and maxHeight to the specified value. -
maxSize
Sets the maxWidth and maxHeight to the specified values. -
maxWidth
-
maxHeight
-
pad
Sets the padTop, padLeft, padBottom, and padRight to the specified value. -
pad
-
padTop
-
padLeft
-
padBottom
-
padRight
-
pad
Sets the padTop, padLeft, padBottom, and padRight to the specified value. -
pad
-
padTop
-
padLeft
-
padBottom
-
padRight
-
fill
Sets fillX and fillY to 1. -
fillX
Sets fillX to 1. -
fillY
Sets fillY to 1. -
fill
-
fill
Sets fillX and fillY to 1 if true, 0 if false. -
fill
Sets fillX and fillY to 1 if true, 0 if false. -
align
Sets the alignment of the actor within the container. Set toAlign.center,Align.top,Align.bottom,Align.left,Align.right, or any combination of those. -
center
Sets the alignment of the actor within the container toAlign.center. This clears any other alignment. -
top
SetsAlign.topand clearsAlign.bottomfor the alignment of the actor within the container. -
left
SetsAlign.leftand clearsAlign.rightfor the alignment of the actor within the container. -
bottom
SetsAlign.bottomand clearsAlign.topfor the alignment of the actor within the container. -
right
SetsAlign.rightand clearsAlign.leftfor the alignment of the actor within the container. -
getMinWidth
public float getMinWidth()- Specified by:
getMinWidthin interfaceLayout- Overrides:
getMinWidthin classWidgetGroup
-
getMinHeightValue
- Overrides:
getMinHeightValuein classWidgetGroup
-
getMinHeight
public float getMinHeight()- Specified by:
getMinHeightin interfaceLayout- Overrides:
getMinHeightin classWidgetGroup
-
getPrefWidthValue
- Overrides:
getPrefWidthValuein classWidgetGroup
-
getPrefWidth
public float getPrefWidth()- Specified by:
getPrefWidthin interfaceLayout- Overrides:
getPrefWidthin classWidgetGroup
-
getPrefHeightValue
- Overrides:
getPrefHeightValuein classWidgetGroup
-
getPrefHeight
public float getPrefHeight()- Specified by:
getPrefHeightin interfaceLayout- Overrides:
getPrefHeightin classWidgetGroup
-
getMaxWidthValue
- Overrides:
getMaxWidthValuein classWidgetGroup
-
getMaxWidth
public float getMaxWidth()Description copied from interface:LayoutZero indicates no max width.- Specified by:
getMaxWidthin interfaceLayout- Overrides:
getMaxWidthin classWidgetGroup
-
getMaxHeightValue
- Overrides:
getMaxHeightValuein classWidgetGroup
-
getMaxHeight
public float getMaxHeight()Description copied from interface:LayoutZero indicates no max height.- Specified by:
getMaxHeightin interfaceLayout- Overrides:
getMaxHeightin classWidgetGroup
-
getPadTopValue
-
getPadTop
public float getPadTop() -
getPadLeftValue
-
getPadLeft
public float getPadLeft() -
getPadBottomValue
-
getPadBottom
public float getPadBottom() -
getPadRightValue
-
getPadRight
public float getPadRight() -
getPadX
public float getPadX()ReturnsgetPadLeft()plusgetPadRight(). -
getPadY
public float getPadY()ReturnsgetPadTop()plusgetPadBottom(). -
getFillX
public float getFillX() -
getFillY
public float getFillY() -
getAlign
public int getAlign() -
setRound
public void setRound(boolean round) If true (the default), positions and sizes are rounded to integers. -
clip
Sets clip to true. -
clip
-
setClip
public void setClip(boolean enabled) Causes the contents to be clipped if they exceed the container bounds. Enabling clipping will setGroup.setTransform(boolean)to true. -
getClip
public boolean getClip() -
hit
Description copied from class:WidgetGroupIf this method is overridden, the super method orWidgetGroup.validate()should be called to ensure the widget group is laid out.- Overrides:
hitin classWidgetGrouptouchable- If true, hit detection will respect thetouchability.- See Also:
-
drawDebug
Description copied from class:GroupDraws this actor's debug lines ifActor.getDebug()is true and, regardless ofActor.getDebug(), callsActor.drawDebug(ShapeRenderer)on each child.
-