com.badlogic.gdx.scenes.scene2d.ui
Class HorizontalGroup

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Actor
      extended by com.badlogic.gdx.scenes.scene2d.Group
          extended by com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
              extended by com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
All Implemented Interfaces:
Cullable, Layout

public class HorizontalGroup
extends WidgetGroup

A group that lays out its children side by side in a single row. This can be easier than using Table when actors need to be inserted in the middle of the group.

The preferred width is the sum of the children's preferred widths, plus spacing if set. The preferred height is the largest preferred height of any child. The min size is the preferred size and the max size is 0 as HorizontalGroup can be stretched to cover any area.

This UI widget does not support Layoutable actors that return 0 as their preferred width. A fine example is Label class with text wrapping turned on.

Author:
Nathan Sweet

Constructor Summary
HorizontalGroup()
           
 
Method Summary
 HorizontalGroup align(int align)
          Sets the alignment of widgets within the horizontal group.
 HorizontalGroup bottom()
          Sets Align.bottom and clears Align.top for the alignment of widgets within the horizontal group.
 HorizontalGroup center()
          Sets the alignment of widgets within the horizontal group to Align.center.
 HorizontalGroup fill()
           
 HorizontalGroup fill(float fill)
           
 int getAlign()
           
 float getFill()
           
 float getPadBottom()
           
 float getPadLeft()
           
 float getPadRight()
           
 float getPadTop()
           
 float getPrefHeight()
           
 float getPrefWidth()
           
 boolean getReverse()
           
 float getSpace()
           
 void invalidate()
          Invalidates this actor's layout, causing Layout.layout() to happen the next time Layout.validate() is called.
 void layout()
          Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls Layout.invalidate() any each child whose width or height has changed, and calls Layout.validate() on each child.
 HorizontalGroup pad(float pad)
          Sets the padTop, padLeft, padBottom, and padRight to the specified value.
 HorizontalGroup pad(float top, float left, float bottom, float right)
           
 HorizontalGroup padBottom(float padBottom)
           
 HorizontalGroup padLeft(float padLeft)
           
 HorizontalGroup padRight(float padRight)
           
 HorizontalGroup padTop(float padTop)
           
 HorizontalGroup reverse()
          The children will be ordered from right to left rather than the default left to right.
 HorizontalGroup reverse(boolean reverse)
          If true, the children will be ordered from right to left rather than the default left to right.
 void setRound(boolean round)
          If true (the default), positions and sizes are rounded to integers.
 HorizontalGroup space(float spacing)
          Sets the space between children.
 HorizontalGroup top()
          Sets Align.top and clears Align.bottom for the alignment of widgets within the horizontal group.
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
draw, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, clear, clearChildren, findActor, getChildren, hasChildren, hit, isTransform, localToDescendantCoordinates, print, removeActor, setCullingArea, setTransform, swapActor, swapActor
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getY, getZIndex, hasParent, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HorizontalGroup

public HorizontalGroup()
Method Detail

invalidate

public void invalidate()
Description copied from interface: Layout
Invalidates this actor's layout, causing Layout.layout() to happen the next time Layout.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 interface Layout
Overrides:
invalidate in class WidgetGroup

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, calls Layout.invalidate() any each child whose width or height has changed, and calls Layout.validate() on each child. This method should almost never be called directly, instead Layout.validate() should be used.

Specified by:
layout in interface Layout
Overrides:
layout in class WidgetGroup

getPrefWidth

public float getPrefWidth()
Specified by:
getPrefWidth in interface Layout
Overrides:
getPrefWidth in class WidgetGroup

getPrefHeight

public float getPrefHeight()
Specified by:
getPrefHeight in interface Layout
Overrides:
getPrefHeight in class WidgetGroup

setRound

public void setRound(boolean round)
If true (the default), positions and sizes are rounded to integers.


reverse

public HorizontalGroup reverse()
The children will be ordered from right to left rather than the default left to right.


reverse

public HorizontalGroup reverse(boolean reverse)
If true, the children will be ordered from right to left rather than the default left to right.


getReverse

public boolean getReverse()

space

public HorizontalGroup space(float spacing)
Sets the space between children.


getSpace

public float getSpace()

pad

public HorizontalGroup pad(float pad)
Sets the padTop, padLeft, padBottom, and padRight to the specified value.


pad

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

padTop

public HorizontalGroup padTop(float padTop)

padLeft

public HorizontalGroup padLeft(float padLeft)

padBottom

public HorizontalGroup padBottom(float padBottom)

padRight

public HorizontalGroup padRight(float padRight)

getPadTop

public float getPadTop()

getPadLeft

public float getPadLeft()

getPadBottom

public float getPadBottom()

getPadRight

public float getPadRight()

align

public HorizontalGroup align(int align)
Sets the alignment of widgets within the horizontal group. Set to Align.center, Align.top, Align.bottom, Align.left, Align.right, or any combination of those.


center

public HorizontalGroup center()
Sets the alignment of widgets within the horizontal group to Align.center. This clears any other alignment.


top

public HorizontalGroup top()
Sets Align.top and clears Align.bottom for the alignment of widgets within the horizontal group.


bottom

public HorizontalGroup bottom()
Sets Align.bottom and clears Align.top for the alignment of widgets within the horizontal group.


getAlign

public int getAlign()

fill

public HorizontalGroup fill()

fill

public HorizontalGroup fill(float fill)
Parameters:
fill - 0 will use pref width.

getFill

public float getFill()


Copyright © 2014. All Rights Reserved.