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

public Class WidgetGroup

extends Group
implements Layout
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.scenes.scene2d.utils.Layout
Known Direct Subclasses
com.badlogic.gdx.scenes.scene2d.ui.Container, com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup, com.badlogic.gdx.scenes.scene2d.ui.ScrollPane, com.badlogic.gdx.scenes.scene2d.ui.SplitPane, com.badlogic.gdx.scenes.scene2d.ui.Stack, com.badlogic.gdx.scenes.scene2d.ui.Table, com.badlogic.gdx.scenes.scene2d.ui.Tree, com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
Imports
com.badlogic.gdx.graphics.g2d.Batch, com.badlogic.gdx.scenes.scene2d.Actor, .Group, .Stage, com.badlogic.gdx.scenes.scene2d.utils.Layout, com.badlogic.gdx.utils.SnapshotArray

A Group that participates in layout and provides a minimum, preferred, and maximum size.

The default preferred size of a widget group is 0 and this is almost always overridden by a subclass. The default minimum size returns the preferred size, so a subclass may choose to return 0 for minimum size if it wants to allow itself to be sized smaller than the preferred size. The default maximum size is 0, which means no maximum size.

See Layout for details on how a widget group should participate in layout. A widget group's mutator methods should call invalidate() or invalidateHierarchy() as needed. By default, invalidateHierarchy is called when child widgets are added and removed.

Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
public
WidgetGroup(Actor... actors)

Creates a new widget group containing the specified actors.

Method Summary

Modifier and TypeMethod and Description
protected void
childrenChanged()

Overrides com.badlogic.gdx.scenes.scene2d.Group.childrenChanged.

Called when actors are added to or removed from the group.

public void
draw(Batch batch, float parentAlpha)

Overrides com.badlogic.gdx.scenes.scene2d.Group.draw.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

public float
public float
public float
public float
public float
public float
public Actor
hit(float x, float y, boolean touchable)

Overrides com.badlogic.gdx.scenes.scene2d.Group.hit.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

public void
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
invalidateHierarchy()

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

Invalidates this actor and its ascendants, calling invalidate() on each.

public void
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.

public boolean
needsLayout()

Returns true if the widget's layout has been invalidated.

public void
pack()

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

Sizes this actor to its preferred width and height, then calls validate().

public void
setFillParent(boolean fillParent)

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

If true, this actor will be sized to the parent in validate().

public void
setLayoutEnabled(boolean enabled)

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

Enables or disables the layout for this actor and all child actors, recursively.

private void
setLayoutEnabled(Group parent, boolean enabled)

protected void
sizeChanged()

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

Called when the actor's size has been changed.

public void
validate()

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

Ensures the actor has been laid out.

Inherited from com.badlogic.gdx.scenes.scene2d.Group:
actaddActoraddActorAfteraddActorAtaddActorBeforeapplyTransformapplyTransformclearclearclearChildrenclearChildrencomputeTransformdebugAlldrawChildrendrawDebugdrawDebugChildrenfindActorgetChildgetChildrengetCullingAreahasChildrenisTransformlocalToDescendantCoordinatesremoveActorremoveActorremoveActorAtresetTransformresetTransformsetCullingAreasetDebugsetStagesetTransformswapActorswapActortoString

Field Detail

fillParentback to summary
private boolean fillParent
layoutEnabledback to summary
private boolean layoutEnabled
needsLayoutback to summary
private boolean needsLayout

Constructor Detail

WidgetGroupback to summary
public WidgetGroup()
WidgetGroupback to summary
public WidgetGroup(Actor... actors)

Creates a new widget group containing the specified actors.

Method Detail

childrenChangedback to summary
protected void childrenChanged()

Overrides com.badlogic.gdx.scenes.scene2d.Group.childrenChanged.

Doc from com.badlogic.gdx.scenes.scene2d.Group.childrenChanged.

Called when actors are added to or removed from the group.

drawback to summary
public void draw(Batch batch, float parentAlpha)

Overrides com.badlogic.gdx.scenes.scene2d.Group.draw.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

getMaxHeightback to summary
public float getMaxHeight()

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

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

Zero indicates no max height.

getMaxWidthback to summary
public float getMaxWidth()

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

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

Zero indicates no max width.

getMinHeightback to summary
public float getMinHeight()

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

getMinWidthback to summary
public float getMinWidth()

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

getPrefHeightback to summary
public float getPrefHeight()

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

getPrefWidthback to summary
public float getPrefWidth()

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

hitback to summary
public Actor hit(float x, float y, boolean touchable)

Overrides com.badlogic.gdx.scenes.scene2d.Group.hit.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

invalidateback to summary
public void 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).

invalidateHierarchyback to summary
public void invalidateHierarchy()

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

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

Invalidates this actor and its ascendants, calling invalidate() on each. This method should be called when state changes in the actor that affects the minimum, preferred, maximum, or actual size of the actor (meaning it potentially affects the parent actor's layout).

layoutback to summary
public void 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.

needsLayoutback to summary
public boolean needsLayout()

Returns true if the widget's layout has been invalidated.

packback to summary
public void pack()

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

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

Sizes this actor to its preferred width and height, then calls validate().

Generally this method should not be called in an actor's constructor because it calls layout(), which means a subclass would have layout() called before the subclass' constructor. Instead, in constructors simply set the actor's size to getPrefWidth() and getPrefHeight(). This allows the actor to have a size at construction time for more convenient use with groups that do not layout their children.

setFillParentback to summary
public void setFillParent(boolean fillParent)

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

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

If true, this actor will be sized to the parent in validate(). If the parent is the stage, the actor will be sized to the stage. This method is for convenience only when the widget's parent does not set the size of its children (such as the stage).

setLayoutEnabledback to summary
public void setLayoutEnabled(boolean enabled)

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

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

Enables or disables the layout for this actor and all child actors, recursively. When false, validate() will not cause a layout to occur. This can be useful when an actor will be manipulated externally, such as with actions. Default is true.

setLayoutEnabledback to summary
private void setLayoutEnabled(Group parent, boolean enabled)
sizeChangedback to summary
protected void sizeChanged()

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

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

Called when the actor's size has been changed.

validateback to summary
public void validate()

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

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

Ensures the actor has been laid out. Calls layout() if invalidate() has been called since the last time validate() was called, or if the actor otherwise needs to be laid out. This method is usually called in Actor#draw(Batch, float) by the actor itself before drawing is performed.