Class VerticalGroup
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.Actor
-
- com.badlogic.gdx.scenes.scene2d.Group
-
- com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
-
- com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
-
public class VerticalGroup extends WidgetGroup
A group that lays out its children top to bottom vertically, with optional wrapping.Group.getChildren()can be sorted to change the order of the actors (egActor.setZIndex(int)). This can be easier than usingTablewhen actors need to be inserted into or removed from the middle of the group.invalidate()must be called after changing the children order.The preferred width is the largest preferred width of any child. The preferred height is the sum of the children's preferred heights plus spacing. The preferred size is slightly different when
wrapis enabled. The min size is the preferred size and the max size is 0.Widgets are sized using their
preferred height, so widgets which return 0 as their preferred height will be given a height of 0.
-
-
Constructor Summary
Constructors Constructor Description VerticalGroup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VerticalGroupalign(int align)Sets the alignment of all widgets within the vertical group.VerticalGroupbottom()SetsAlign.bottomand clearsAlign.topfor the alignment of all widgets within the vertical group.VerticalGroupcenter()Sets the alignment of all widgets within the vertical group toAlign.center.VerticalGroupcolumnAlign(int columnAlign)Sets the vertical alignment of each column of widgets whenwrappingis enabled and sets the horizontal alignment of widgets within each column.VerticalGroupcolumnBottom()AddsAlign.bottomand clearsAlign.topfor the alignment of each column of widgets whenwrappingis enabled.VerticalGroupcolumnCenter()Sets the alignment of widgets within each column toAlign.center.VerticalGroupcolumnLeft()AddsAlign.leftand clearsAlign.rightfor the alignment of widgets within each column.VerticalGroupcolumnRight()AddsAlign.rightand clearsAlign.leftfor the alignment of widgets within each column.VerticalGroupcolumnTop()AddsAlign.topand clearsAlign.bottomfor the alignment of each column of widgets whenwrappingis enabled.protected voiddrawDebugBounds(ShapeRenderer shapes)Draws a rectangle for the bounds of this actor ifActor.getDebug()is true.VerticalGroupexpand()VerticalGroupexpand(boolean expand)When true and wrap is false, the columns will take up the entire vertical group width.VerticalGroupfill()VerticalGroupfill(float fill)intgetAlign()intgetColumns()When wrapping is enabled, the number of columns may be > 1.booleangetExpand()floatgetFill()floatgetPadBottom()floatgetPadLeft()floatgetPadRight()floatgetPadTop()floatgetPrefHeight()floatgetPrefWidth()booleangetReverse()floatgetSpace()booleangetWrap()floatgetWrapSpace()VerticalGroupgrow()Sets fill to 1 and expand to true.voidinvalidate()Invalidates this actor's layout, causingLayout.layout()to happen the next timeLayout.validate()is called.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.VerticalGroupleft()AddsAlign.leftand clearsAlign.rightfor the alignment of all widgets within the vertical group.VerticalGrouppad(float pad)Sets the padTop, padLeft, padBottom, and padRight to the specified value.VerticalGrouppad(float top, float left, float bottom, float right)VerticalGrouppadBottom(float padBottom)VerticalGrouppadLeft(float padLeft)VerticalGrouppadRight(float padRight)VerticalGrouppadTop(float padTop)VerticalGroupreverse()The children will be displayed last to first.VerticalGroupreverse(boolean reverse)If true, the children will be displayed last to first.VerticalGroupright()AddsAlign.rightand clearsAlign.leftfor the alignment of all widgets within the vertical group.voidsetRound(boolean round)If true (the default), positions and sizes are rounded to integers.VerticalGroupspace(float space)Sets the vertical space between children.VerticalGrouptop()SetsAlign.topand clearsAlign.bottomfor the alignment of all widgets within the vertical group.VerticalGroupwrap()If false, the widgets are arranged in a single column and the preferred height is the widget heights plus spacing.VerticalGroupwrap(boolean wrap)VerticalGroupwrapSpace(float wrapSpace)Sets the horizontal space between columns when wrap is enabled.-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, draw, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, hit, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, clear, clearChildren, clearChildren, computeTransform, debugAll, drawChildren, drawDebug, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, removeActor, removeActor, removeActorAt, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toString
-
Methods inherited from class com.badlogic.gdx.scenes.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, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, 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, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront
-
-
-
-
Method Detail
-
invalidate
public void invalidate()
Description copied from interface:LayoutInvalidates this actor's layout, causingLayout.layout()to happen the next timeLayout.validate()is called. This method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).- Specified by:
invalidatein interfaceLayout- Overrides:
invalidatein classWidgetGroup
-
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
-
getPrefWidth
public float getPrefWidth()
- Specified by:
getPrefWidthin interfaceLayout- Overrides:
getPrefWidthin classWidgetGroup
-
getPrefHeight
public float getPrefHeight()
- Specified by:
getPrefHeightin interfaceLayout- Overrides:
getPrefHeightin classWidgetGroup
-
getColumns
public int getColumns()
When wrapping is enabled, the number of columns may be > 1.
-
setRound
public void setRound(boolean round)
If true (the default), positions and sizes are rounded to integers.
-
reverse
public VerticalGroup reverse()
The children will be displayed last to first.
-
reverse
public VerticalGroup reverse(boolean reverse)
If true, the children will be displayed last to first.
-
getReverse
public boolean getReverse()
-
space
public VerticalGroup space(float space)
Sets the vertical space between children.
-
getSpace
public float getSpace()
-
wrapSpace
public VerticalGroup wrapSpace(float wrapSpace)
Sets the horizontal space between columns when wrap is enabled.
-
getWrapSpace
public float getWrapSpace()
-
pad
public VerticalGroup pad(float pad)
Sets the padTop, padLeft, padBottom, and padRight to the specified value.
-
pad
public VerticalGroup pad(float top, float left, float bottom, float right)
-
padTop
public VerticalGroup padTop(float padTop)
-
padLeft
public VerticalGroup padLeft(float padLeft)
-
padBottom
public VerticalGroup padBottom(float padBottom)
-
padRight
public VerticalGroup padRight(float padRight)
-
getPadTop
public float getPadTop()
-
getPadLeft
public float getPadLeft()
-
getPadBottom
public float getPadBottom()
-
getPadRight
public float getPadRight()
-
align
public VerticalGroup align(int align)
Sets the alignment of all widgets within the vertical group. Set toAlign.center,Align.top,Align.bottom,Align.left,Align.right, or any combination of those.
-
center
public VerticalGroup center()
Sets the alignment of all widgets within the vertical group toAlign.center. This clears any other alignment.
-
top
public VerticalGroup top()
SetsAlign.topand clearsAlign.bottomfor the alignment of all widgets within the vertical group.
-
left
public VerticalGroup left()
AddsAlign.leftand clearsAlign.rightfor the alignment of all widgets within the vertical group.
-
bottom
public VerticalGroup bottom()
SetsAlign.bottomand clearsAlign.topfor the alignment of all widgets within the vertical group.
-
right
public VerticalGroup right()
AddsAlign.rightand clearsAlign.leftfor the alignment of all widgets within the vertical group.
-
getAlign
public int getAlign()
-
fill
public VerticalGroup fill()
-
fill
public VerticalGroup fill(float fill)
- Parameters:
fill- 0 will use preferred height.
-
getFill
public float getFill()
-
expand
public VerticalGroup expand()
-
expand
public VerticalGroup expand(boolean expand)
When true and wrap is false, the columns will take up the entire vertical group width.
-
getExpand
public boolean getExpand()
-
grow
public VerticalGroup grow()
Sets fill to 1 and expand to true.
-
wrap
public VerticalGroup wrap()
If false, the widgets are arranged in a single column and the preferred height is the widget heights plus spacing.If true, the widgets will wrap using the height of the vertical group. The preferred height of the group will be 0 as it is expected that something external will set the height of the group. Widgets are sized to their preferred height unless it is larger than the group's height, in which case they are sized to the group's height but not less than their minimum height. Default is false.
When wrap is enabled, the group's preferred width depends on the height of the group. In some cases the parent of the group will need to layout twice: once to set the height of the group and a second time to adjust to the group's new preferred width.
-
wrap
public VerticalGroup wrap(boolean wrap)
-
getWrap
public boolean getWrap()
-
columnAlign
public VerticalGroup columnAlign(int columnAlign)
Sets the vertical alignment of each column of widgets whenwrappingis enabled and sets the horizontal alignment of widgets within each column. Set toAlign.center,Align.top,Align.bottom,Align.left,Align.right, or any combination of those.
-
columnCenter
public VerticalGroup columnCenter()
Sets the alignment of widgets within each column toAlign.center. This clears any other alignment.
-
columnTop
public VerticalGroup columnTop()
AddsAlign.topand clearsAlign.bottomfor the alignment of each column of widgets whenwrappingis enabled.
-
columnLeft
public VerticalGroup columnLeft()
AddsAlign.leftand clearsAlign.rightfor the alignment of widgets within each column.
-
columnBottom
public VerticalGroup columnBottom()
AddsAlign.bottomand clearsAlign.topfor the alignment of each column of widgets whenwrappingis enabled.
-
columnRight
public VerticalGroup columnRight()
AddsAlign.rightand clearsAlign.leftfor the alignment of widgets within each column.
-
drawDebugBounds
protected void drawDebugBounds(ShapeRenderer shapes)
Description copied from class:ActorDraws a rectangle for the bounds of this actor ifActor.getDebug()is true.- Overrides:
drawDebugBoundsin classActor
-
-