|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
public abstract class WidgetGroup
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 if it wants to allow itself to be sized smaller. 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.
Field Summary |
---|
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
batchTransform, children, cullingArea, debug, debugTexture, groups, immutableChildren, immutableGroups, lastTouchedChild, localTransform, namesToActors, oldBatchTransform, point, transform, worldTransform |
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, stage, touchable, visible, width, x, y |
Constructor Summary | |
---|---|
WidgetGroup()
|
|
WidgetGroup(java.lang.String name)
|
Method Summary | |
---|---|
protected void |
childrenChanged()
Called when actors are added to or removed from the group. |
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or validate() should be called to ensure the widget group is laid
out. |
float |
getMaxHeight()
|
float |
getMaxWidth()
|
float |
getMinHeight()
|
float |
getMinWidth()
|
void |
invalidate()
Invalidates this actor's layout, causing Layout.layout() to be called the next time Layout.validate() is called. |
void |
invalidateHierarchy()
Invalidates this actor and all its parents, calling Layout.invalidate() on all involved actors. |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child and calls Layout.invalidate() and then Layout.validate() on each one. |
boolean |
needsLayout()
Returns true if the widget's layout has been invalidated . |
void |
pack()
Sizes this actor to its preferred width and height and, if its size was changed, causes the actor to be laid out by calling Layout.invalidate() and then Layout.validate() . |
void |
setFillParent(boolean fillParent)
If true, this actor will be sized to the parent in Layout.validate() . |
void |
validate()
Ensures the actor has been laid out. |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, clear, disableDebugging, drawChild, drawChildren, enableDebugging, findActor, getActors, getGroups, hit, isDescendant, removeActor, removeActorRecursive, resetTransform, setCullingArea, sortChildren, swapActor, swapActor, toChildCoordinates, toLocalCoordinates, touchDown, touchMoved, updateTransform |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchDragged, touchUp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.badlogic.gdx.scenes.scene2d.Layout |
---|
getPrefHeight, getPrefWidth |
Constructor Detail |
---|
public WidgetGroup()
public WidgetGroup(java.lang.String name)
Method Detail |
---|
public float getMinWidth()
getMinWidth
in interface Layout
public float getMinHeight()
getMinHeight
in interface Layout
public float getMaxWidth()
getMaxWidth
in interface Layout
public float getMaxHeight()
getMaxHeight
in interface Layout
public void invalidate()
Layout
Layout.layout()
to be called the next time Layout.validate()
is called. This
should be done 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).
invalidate
in interface Layout
public void validate()
Layout
Layout.layout()
if Layout.invalidate()
has called since the last time
Layout.validate()
was called, or if the actor otherwise needs to be laid out. This method is usually called in
Actor.draw(SpriteBatch, float)
before drawing is performed.
validate
in interface Layout
public boolean needsLayout()
invalidated
.
public void invalidateHierarchy()
Layout
Layout.invalidate()
on all involved actors. 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).
invalidateHierarchy
in interface Layout
protected void childrenChanged()
Group
childrenChanged
in class Group
public void pack()
Layout
Layout.invalidate()
and then Layout.validate()
.
Generally this method should not be called in a constructor because it calls Layout.layout()
, which means a subclass would
have layout() called before the subclass' constructor. Instead, in a constructor simply set the actors width and height to
Layout.getPrefWidth()
and Layout.getPrefHeight()
. This allows the actor to have a size at construction time for more
convenient use outside of a Table
.
pack
in interface Layout
public void setFillParent(boolean fillParent)
Layout
Layout.validate()
. If the parent is the stage, the actor will be sized
to the stage.
setFillParent
in interface Layout
public void layout()
Layout
Layout.invalidate()
and then Layout.validate()
on each one. Usually this should not be called directly, instead
Layout.validate()
should be used.
layout
in interface Layout
public void draw(SpriteBatch batch, float parentAlpha)
validate()
should be called to ensure the widget group is laid
out.
draw
in class Group
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |