APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d.ui

public Class VerticalGroup

extends WidgetGroup
Class Inheritance
Imports
com.badlogic.gdx.graphics.glutils.ShapeRenderer, .ShapeRenderer.ShapeType, com.badlogic.gdx.scenes.scene2d.Actor, .Touchable, com.badlogic.gdx.scenes.scene2d.utils.Layout, com.badlogic.gdx.utils.Align, .FloatArray, .SnapshotArray

A group that lays out its children top to bottom vertically, with optional wrapping. getChildren() can be sorted to change the order of the actors (eg Actor#setZIndex(int)). This can be easier than using Table when 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 wrap is 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.

Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private int
private int
private FloatArray
private boolean
private float
private float
private float
private float
private float
private float
private float
private float
private boolean
private boolean
private boolean
private float
private boolean
private float

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public VerticalGroup
align(int align)

Sets the alignment of all widgets within the vertical group.

public VerticalGroup
bottom()

Sets Align#bottom and clears Align#top for the alignment of all widgets within the vertical group.

public VerticalGroup
center()

Sets the alignment of all widgets within the vertical group to Align#center.

public VerticalGroup
columnAlign(int columnAlign)

Sets the vertical alignment of each column of widgets when wrapping is enabled and sets the horizontal alignment of widgets within each column.

public VerticalGroup
columnBottom()

Adds Align#bottom and clears Align#top for the alignment of each column of widgets when wrapping is enabled.

public VerticalGroup
columnCenter()

Sets the alignment of widgets within each column to Align#center.

public VerticalGroup
columnLeft()

Adds Align#left and clears Align#right for the alignment of widgets within each column.

public VerticalGroup
columnRight()

Adds Align#right and clears Align#left for the alignment of widgets within each column.

public VerticalGroup
columnTop()

Adds Align#top and clears Align#bottom for the alignment of each column of widgets when wrapping is enabled.

private void
protected void
drawDebugBounds(ShapeRenderer shapes)

Overrides com.badlogic.gdx.scenes.scene2d.Actor.drawDebugBounds.

Draws a rectangle for the bounds of this actor if getDebug() is true.

public VerticalGroup
public VerticalGroup
expand(boolean expand)

When true and wrap is false, the columns will take up the entire vertical group width.

public VerticalGroup
fill()

public VerticalGroup
fill(float
0 will use preferred width.
fill
)

public int
public int
getColumns()

When wrapping is enabled, the number of columns may be > 1.

public boolean
public float
public float
public float
public float
public float
public float
public float
public boolean
public float
public boolean
public float
public VerticalGroup
grow()

Sets fill to 1 and expand to true.

public void
invalidate()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.invalidate.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.invalidate.

Invalidates this actor's layout, causing layout() to happen the next time validate() is called.

public void
layout()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.layout.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.layout.

Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls invalidate() on any each child whose width or height has changed, and calls validate() on each child.

private void
public VerticalGroup
left()

Adds Align#left and clears Align#right for the alignment of all widgets within the vertical group.

public VerticalGroup
pad(float pad)

Sets the padTop, padLeft, padBottom, and padRight to the specified value.

public VerticalGroup
pad(float top, float left, float bottom, float right)

public VerticalGroup
padBottom(float padBottom)

public VerticalGroup
padLeft(float padLeft)

public VerticalGroup
padRight(float padRight)

public VerticalGroup
padTop(float padTop)

public VerticalGroup
reverse()

The children will be displayed last to first.

public VerticalGroup
reverse(boolean reverse)

If true, the children will be displayed last to first.

public VerticalGroup
right()

Adds Align#right and clears Align#left for the alignment of all widgets within the vertical group.

public void
setRound(boolean round)

If true (the default), positions and sizes are rounded to integers.

public VerticalGroup
space(float space)

Sets the vertical space between children.

public VerticalGroup
top()

Sets Align#top and clears Align#bottom for the alignment of all widgets within the vertical group.

public VerticalGroup
wrap()

If false, the widgets are arranged in a single column and the preferred height is the widget heights plus spacing.

public VerticalGroup
wrap(boolean wrap)

public VerticalGroup
wrapSpace(float wrapSpace)

Sets the horizontal space between columns when wrap is enabled.

Inherited from com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup:
childrenChangeddrawgetMaxHeightgetMaxWidthgetMinHeightgetMinWidthhitinvalidateHierarchyneedsLayoutpacksetFillParentsetLayoutEnabledsizeChangedvalidate

Field Detail

alignback to summary
private int align
columnAlignback to summary
private int columnAlign
columnSizesback to summary
private FloatArray columnSizes
expandback to summary
private boolean expand
fillback to summary
private float fill
lastPrefWidthback to summary
private float lastPrefWidth
padBottomback to summary
private float padBottom
padLeftback to summary
private float padLeft
padRightback to summary
private float padRight
padTopback to summary
private float padTop
prefHeightback to summary
private float prefHeight
prefWidthback to summary
private float prefWidth
reverseback to summary
private boolean reverse
roundback to summary
private boolean round
sizeInvalidback to summary
private boolean sizeInvalid
spaceback to summary
private float space
wrapback to summary
private boolean wrap
wrapSpaceback to summary
private float wrapSpace

Constructor Detail

VerticalGroupback to summary
public VerticalGroup()

Method Detail

alignback to summary
public VerticalGroup align(int align)

Sets the alignment of all widgets within the vertical group. Set to Align#center, Align#top, Align#bottom, Align#left, Align#right, or any combination of those.

bottomback to summary
public VerticalGroup bottom()

Sets Align#bottom and clears Align#top for the alignment of all widgets within the vertical group.

centerback to summary
public VerticalGroup center()

Sets the alignment of all widgets within the vertical group to Align#center. This clears any other alignment.

columnAlignback to summary
public VerticalGroup columnAlign(int columnAlign)

Sets the vertical alignment of each column of widgets when wrapping is enabled and sets the horizontal alignment of widgets within each column. Set to Align#center, Align#top, Align#bottom, Align#left, Align#right, or any combination of those.

columnBottomback to summary
public VerticalGroup columnBottom()

Adds Align#bottom and clears Align#top for the alignment of each column of widgets when wrapping is enabled.

columnCenterback to summary
public VerticalGroup columnCenter()

Sets the alignment of widgets within each column to Align#center. This clears any other alignment.

columnLeftback to summary
public VerticalGroup columnLeft()

Adds Align#left and clears Align#right for the alignment of widgets within each column.

columnRightback to summary
public VerticalGroup columnRight()

Adds Align#right and clears Align#left for the alignment of widgets within each column.

columnTopback to summary
public VerticalGroup columnTop()

Adds Align#top and clears Align#bottom for the alignment of each column of widgets when wrapping is enabled.

computeSizeback to summary
private void computeSize()
drawDebugBoundsback to summary
protected void drawDebugBounds(ShapeRenderer shapes)

Overrides com.badlogic.gdx.scenes.scene2d.Actor.drawDebugBounds.

Doc from com.badlogic.gdx.scenes.scene2d.Actor.drawDebugBounds.

Draws a rectangle for the bounds of this actor if getDebug() is true.

expandback to summary
public VerticalGroup expand()
expandback to summary
public VerticalGroup expand(boolean expand)

When true and wrap is false, the columns will take up the entire vertical group width.

fillback to summary
public VerticalGroup fill()
fillback to summary
public VerticalGroup fill(float fill)
Parameters
fill:float

0 will use preferred width.

getAlignback to summary
public int getAlign()
getColumnsback to summary
public int getColumns()

When wrapping is enabled, the number of columns may be > 1.

getExpandback to summary
public boolean getExpand()
getFillback to summary
public float getFill()
getPadBottomback to summary
public float getPadBottom()
getPadLeftback to summary
public float getPadLeft()
getPadRightback to summary
public float getPadRight()
getPadTopback to summary
public float getPadTop()
getPrefHeightback to summary
public float getPrefHeight()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getPrefHeight.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.getPrefHeight.

getPrefWidthback to summary
public float getPrefWidth()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getPrefWidth.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.getPrefWidth.

getReverseback to summary
public boolean getReverse()
getSpaceback to summary
public float getSpace()
getWrapback to summary
public boolean getWrap()
getWrapSpaceback to summary
public float getWrapSpace()
growback to summary
public VerticalGroup grow()

Sets fill to 1 and expand to true.

invalidateback to summary
public void invalidate()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.invalidate.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.invalidate.

Doc from com.badlogic.gdx.scenes.scene2d.utils.Layout.invalidate.

Invalidates this actor's layout, causing layout() to happen the next time 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).

layoutback to summary
public void layout()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.layout.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.layout.

Doc from com.badlogic.gdx.scenes.scene2d.utils.Layout.layout.

Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls invalidate() on any each child whose width or height has changed, and calls validate() on each child. This method should almost never be called directly, instead validate() should be used.

layoutWrappedback to summary
private void layoutWrapped()
leftback to summary
public VerticalGroup left()

Adds Align#left and clears Align#right for the alignment of all widgets within the vertical group.

padback to summary
public VerticalGroup pad(float pad)

Sets the padTop, padLeft, padBottom, and padRight to the specified value.

padback to summary
public VerticalGroup pad(float top, float left, float bottom, float right)
padBottomback to summary
public VerticalGroup padBottom(float padBottom)
padLeftback to summary
public VerticalGroup padLeft(float padLeft)
padRightback to summary
public VerticalGroup padRight(float padRight)
padTopback to summary
public VerticalGroup padTop(float padTop)
reverseback to summary
public VerticalGroup reverse()

The children will be displayed last to first.

reverseback to summary
public VerticalGroup reverse(boolean reverse)

If true, the children will be displayed last to first.

rightback to summary
public VerticalGroup right()

Adds Align#right and clears Align#left for the alignment of all widgets within the vertical group.

setRoundback to summary
public void setRound(boolean round)

If true (the default), positions and sizes are rounded to integers.

spaceback to summary
public VerticalGroup space(float space)

Sets the vertical space between children.

topback to summary
public VerticalGroup top()

Sets Align#top and clears Align#bottom for the alignment of all widgets within the vertical group.

wrapback to summary
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.

wrapback to summary
public VerticalGroup wrap(boolean wrap)
wrapSpaceback to summary
public VerticalGroup wrapSpace(float wrapSpace)

Sets the horizontal space between columns when wrap is enabled.