Class VerticalGroup
Group.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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalign
(int align) Sets the alignment of all widgets within the vertical group.bottom()
SetsAlign.bottom
and clearsAlign.top
for the alignment of all widgets within the vertical group.center()
Sets the alignment of all widgets within the vertical group toAlign.center
.columnAlign
(int columnAlign) Sets the vertical alignment of each column of widgets whenwrapping
is enabled and sets the horizontal alignment of widgets within each column.AddsAlign.bottom
and clearsAlign.top
for the alignment of each column of widgets whenwrapping
is enabled.Sets the alignment of widgets within each column toAlign.center
.AddsAlign.left
and clearsAlign.right
for the alignment of widgets within each column.AddsAlign.right
and clearsAlign.left
for the alignment of widgets within each column.AddsAlign.top
and clearsAlign.bottom
for the alignment of each column of widgets whenwrapping
is enabled.expand()
expand
(boolean expand) When true and wrap is false, the columns will take up the entire vertical group width.fill()
fill
(float fill) int
getAlign()
int
When wrapping is enabled, the number of columns may be > 1.boolean
float
getFill()
float
float
float
float
float
float
boolean
float
getSpace()
boolean
getWrap()
float
grow()
Sets fill to 1 and expand to true.void
Invalidates this actor's layout, causingLayout.layout()
to happen the next timeLayout.validate()
is called.void
layout()
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()
AddsAlign.left
and clearsAlign.right
for the alignment of all widgets within the vertical group.pad
(float pad) Sets the padTop, padLeft, padBottom, and padRight to the specified value.pad
(float top, float left, float bottom, float right) padBottom
(float padBottom) padLeft
(float padLeft) padRight
(float padRight) padTop
(float padTop) reverse()
The children will be displayed last to first.reverse
(boolean reverse) If true, the children will be displayed last to first.right()
AddsAlign.right
and clearsAlign.left
for the alignment of all widgets within the vertical group.void
setRound
(boolean round) If true (the default), positions and sizes are rounded to integers.space
(float space) Sets the vertical space between children.top()
SetsAlign.top
and clearsAlign.bottom
for the alignment of all widgets within the vertical group.wrap()
If false, the widgets are arranged in a single column and the preferred height is the widget heights plus spacing.wrap
(boolean wrap) wrapSpace
(float wrapSpace) Sets the horizontal space between columns when wrap is enabled.Methods inherited from class com.prineside.tdi2.scene2d.ui.WidgetGroup
draw, getMaxHeight, getMaxHeightValue, getMaxWidth, getMaxWidthValue, getMinHeight, getMinHeightValue, getMinWidth, getMinWidthValue, getPrefHeightValue, getPrefWidthValue, hit, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setPrefHeight, setPrefHeight, setPrefWidth, setPrefWidth, setWidth, validate
Methods inherited from class com.prineside.tdi2.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, clear, clear, clearChildren, clearChildren, debugAll, drawDebug, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, removeActor, removeActor, removeActorAt, setCullingArea, setDebug, setTransform, swapActor, swapActor, toString
Methods 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
-
VerticalGroup
public VerticalGroup()
-
-
Method Details
-
invalidate
public void invalidate()Description copied from interface:Layout
Invalidates 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:
invalidate
in interfaceLayout
- Overrides:
invalidate
in classWidgetGroup
-
layout
public void layout()Description copied from interface:Layout
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. This method should almost never be called directly, insteadLayout.validate()
should be used.- Specified by:
layout
in interfaceLayout
- Overrides:
layout
in classWidgetGroup
-
getPrefWidth
public float getPrefWidth()- Specified by:
getPrefWidth
in interfaceLayout
- Overrides:
getPrefWidth
in classWidgetGroup
-
getPrefHeight
public float getPrefHeight()- Specified by:
getPrefHeight
in interfaceLayout
- Overrides:
getPrefHeight
in 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
The children will be displayed last to first. -
reverse
If true, the children will be displayed last to first. -
getReverse
public boolean getReverse() -
space
Sets the vertical space between children. -
getSpace
public float getSpace() -
wrapSpace
Sets the horizontal space between columns when wrap is enabled. -
getWrapSpace
public float getWrapSpace() -
pad
Sets the padTop, padLeft, padBottom, and padRight to the specified value. -
pad
-
padTop
-
padLeft
-
padBottom
-
padRight
-
getPadTop
public float getPadTop() -
getPadLeft
public float getPadLeft() -
getPadBottom
public float getPadBottom() -
getPadRight
public float getPadRight() -
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
Sets the alignment of all widgets within the vertical group toAlign.center
. This clears any other alignment. -
top
SetsAlign.top
and clearsAlign.bottom
for the alignment of all widgets within the vertical group. -
left
AddsAlign.left
and clearsAlign.right
for the alignment of all widgets within the vertical group. -
bottom
SetsAlign.bottom
and clearsAlign.top
for the alignment of all widgets within the vertical group. -
right
AddsAlign.right
and clearsAlign.left
for the alignment of all widgets within the vertical group. -
getAlign
public int getAlign() -
fill
-
fill
- Parameters:
fill
- 0 will use preferred height.
-
getFill
public float getFill() -
expand
-
expand
When true and wrap is false, the columns will take up the entire vertical group width. -
getExpand
public boolean getExpand() -
grow
Sets fill to 1 and expand to true. -
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
-
getWrap
public boolean getWrap() -
columnAlign
Sets the vertical alignment of each column of widgets whenwrapping
is 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
Sets the alignment of widgets within each column toAlign.center
. This clears any other alignment. -
columnTop
AddsAlign.top
and clearsAlign.bottom
for the alignment of each column of widgets whenwrapping
is enabled. -
columnLeft
AddsAlign.left
and clearsAlign.right
for the alignment of widgets within each column. -
columnBottom
AddsAlign.bottom
and clearsAlign.top
for the alignment of each column of widgets whenwrapping
is enabled. -
columnRight
AddsAlign.right
and clearsAlign.left
for the alignment of widgets within each column.
-