libgdx API

com.badlogic.gdx.scenes.scene2d
Interface Layout

All Known Implementing Classes:
Button, CheckBox, FlickScrollPane, Image, ImageButton, Label, List, ScrollPane, SelectBox, Slider, SplitPane, Stack, Table, TextButton, TextField, Widget, WidgetGroup, Window

public interface Layout

Provides methods for an actor to participate in layout and to provide a minimum, preferred, and maximum size.

Author:
Nathan Sweet

Method Summary
 float getMaxHeight()
           
 float getMaxWidth()
           
 float getMinHeight()
           
 float getMinWidth()
           
 float getPrefHeight()
           
 float getPrefWidth()
           
 void invalidate()
          Invalidates this actor's layout, causing layout() to be called the next time validate() is called.
 void invalidateHierarchy()
          Invalidates this actor and all its parents, calling 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 invalidate() and then validate() on each one.
 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 invalidate() and then validate().
 void setFillParent(boolean fillParent)
          If true, this actor will be sized to the parent in validate().
 void validate()
          Ensures the actor has been laid out.
 

Method Detail

layout

void layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child and calls invalidate() and then validate() on each one. Usually this should not be called directly, instead validate() should be used.


invalidate

void invalidate()
Invalidates this actor's layout, causing layout() to be called the next time 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).


invalidateHierarchy

void invalidateHierarchy()
Invalidates this actor and all its parents, calling 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).


validate

void validate()
Ensures the actor has been laid out. Calls layout() if invalidate() has 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(SpriteBatch, float) before drawing is performed.


pack

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 invalidate() and then validate().

Generally this method should not be called in a constructor because it calls 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 getPrefWidth() and getPrefHeight(). This allows the actor to have a size at construction time for more convenient use outside of a Table.


setFillParent

void setFillParent(boolean fillParent)
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.


getMinWidth

float getMinWidth()

getMinHeight

float getMinHeight()

getPrefWidth

float getPrefWidth()

getPrefHeight

float getPrefHeight()

getMaxWidth

float getMaxWidth()

getMaxHeight

float getMaxHeight()

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)