Class HorizontalGroup
Table
when actors need to be inserted into or removed from the middle of the group. Group.getChildren()
can be
sorted to change the order of the actors (eg Actor.setZIndex(int)
). invalidate()
must be called after changing
the children order.
The preferred width is the sum of the children's preferred widths plus spacing. The preferred height is the largest preferred
height of any child. 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 width
, so widgets which return 0 as their preferred width
will be given a width of 0 (eg, a label with word wrap
enabled).
- Author:
- Nathan Sweet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalign
(int align) Sets the alignment of all widgets within the horizontal group.bottom()
SetsAlign.bottom
and clearsAlign.top
for the alignment of all widgets within the horizontal group.center()
Sets the alignment of all widgets within the horizontal group toAlign.center
.expand()
expand
(boolean expand) When true and wrap is false, the rows will take up the entire horizontal group height.fill()
fill
(float fill) int
getAlign()
boolean
float
getFill()
float
float
float
float
float
float
boolean
int
getRows()
When wrapping is enabled, the number of rows may be > 1.float
getSpace()
boolean
getWrap()
boolean
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 horizontal 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 horizontal group.rowAlign
(int rowAlign) Sets the horizontal alignment of each row of widgets whenwrapping
is enabled and sets the vertical alignment of widgets within each row.SetsAlign.bottom
and clearsAlign.top
for the alignment of widgets within each row.Sets the alignment of widgets within each row toAlign.center
.rowLeft()
AddsAlign.left
and clearsAlign.right
for the alignment of each row of widgets whenwrapping
is enabled.rowRight()
AddsAlign.right
and clearsAlign.left
for the alignment of each row of widgets whenwrapping
is enabled.rowTop()
SetsAlign.top
and clearsAlign.bottom
for the alignment of widgets within each row.void
setRound
(boolean round) If true (the default), positions and sizes are rounded to integers.space
(float space) Sets the horizontal space between children.top()
SetsAlign.top
and clearsAlign.bottom
for the alignment of all widgets within the horizontal group.wrap()
If false, the widgets are arranged in a single row and the preferred width is the widget widths plus spacing.wrap
(boolean wrap) Rows will wrap above the previous rows.wrapReverse
(boolean wrapReverse) If true, rows will wrap above the previous rows.wrapSpace
(float wrapSpace) Sets the vertical space between rows 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
-
HorizontalGroup
public HorizontalGroup()
-
-
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
-
getRows
public int getRows()When wrapping is enabled, the number of rows 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() -
wrapReverse
Rows will wrap above the previous rows. -
wrapReverse
If true, rows will wrap above the previous rows. -
getWrapReverse
public boolean getWrapReverse() -
space
Sets the horizontal space between children. -
getSpace
public float getSpace() -
wrapSpace
Sets the vertical space between rows 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 horizontal 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 horizontal group toAlign.center
. This clears any other alignment. -
top
SetsAlign.top
and clearsAlign.bottom
for the alignment of all widgets within the horizontal group. -
left
AddsAlign.left
and clearsAlign.right
for the alignment of all widgets within the horizontal group. -
bottom
SetsAlign.bottom
and clearsAlign.top
for the alignment of all widgets within the horizontal group. -
right
AddsAlign.right
and clearsAlign.left
for the alignment of all widgets within the horizontal group. -
getAlign
public int getAlign() -
fill
-
fill
- Parameters:
fill
- 0 will use preferred width.
-
getFill
public float getFill() -
expand
-
expand
When true and wrap is false, the rows will take up the entire horizontal group height. -
getExpand
public boolean getExpand() -
grow
Sets fill to 1 and expand to true. -
wrap
If false, the widgets are arranged in a single row and the preferred width is the widget widths plus spacing.If true, the widgets will wrap using the width of the horizontal group. The preferred width of the group will be 0 as it is expected that something external will set the width of the group. Widgets are sized to their preferred width unless it is larger than the group's width, in which case they are sized to the group's width but not less than their minimum width. Default is false.
When wrap is enabled, the group's preferred height depends on the width of the group. In some cases the parent of the group will need to layout twice: once to set the width of the group and a second time to adjust to the group's new preferred height.
-
wrap
-
getWrap
public boolean getWrap() -
rowAlign
Sets the horizontal alignment of each row of widgets whenwrapping
is enabled and sets the vertical alignment of widgets within each row. Set toAlign.center
,Align.top
,Align.bottom
,Align.left
,Align.right
, or any combination of those. -
rowCenter
Sets the alignment of widgets within each row toAlign.center
. This clears any other alignment. -
rowTop
SetsAlign.top
and clearsAlign.bottom
for the alignment of widgets within each row. -
rowLeft
AddsAlign.left
and clearsAlign.right
for the alignment of each row of widgets whenwrapping
is enabled. -
rowBottom
SetsAlign.bottom
and clearsAlign.top
for the alignment of widgets within each row. -
rowRight
AddsAlign.right
and clearsAlign.left
for the alignment of each row of widgets whenwrapping
is enabled.
-