libgdx API

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

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.SplitPane
All Implemented Interfaces:
Cullable, Layout

public class SplitPane
extends WidgetGroup

A container that contains two widgets and is divided either horizontally or vertically. The user may resize the widgets. The child widgets are always sized to fill their half of the splitpane.

The preferred size of a splitpane is that of the child widgets and the size of the SplitPane.SplitPaneStyle.handle. The widgets are sized depending on the splitpane's size and the split position.

Author:
mzechner, Nathan Sweet

Nested Class Summary
static class SplitPane.SplitPaneStyle
          The style for a splitpane, see SplitPane.
 
Constructor Summary
SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Skin skin)
           
SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Skin skin, java.lang.String styleName)
           
SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, SplitPane.SplitPaneStyle style)
           
 
Method Summary
 void addActor(Actor actor)
          Adds an actor as a child of this group.
 void addActorAt(int index, Actor actor)
          Adds an actor as a child of this group, at a specific index.
 void addActorBefore(Actor actorBefore, Actor actor)
          Adds an actor as a child of this group, immediately before another child actor.
 void draw(SpriteBatch batch, float parentAlpha)
          If this method is overridden, the super method or WidgetGroup.validate() should be called to ensure the widget group is laid out.
 float getMinHeight()
           
 float getMinWidth()
           
 float getPrefHeight()
           
 float getPrefWidth()
           
 float getSplit()
           
 SplitPane.SplitPaneStyle getStyle()
          Returns the split pane's style.
 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.
 boolean removeActor(Actor actor)
          Removes an actor from this group.
 void setFirstWidget(Actor widget)
           
 void setMaxSplitAmount(float maxAmount)
           
 void setMinSplitAmount(float minAmount)
           
 void setSecondWidget(Actor widget)
           
 void setSplitAmount(float split)
           
 void setStyle(SplitPane.SplitPaneStyle style)
           
 void setVertical(boolean vertical)
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, getMaxHeight, getMaxWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActorAfter, applyTransform, clear, computeTransform, drawChildren, findActor, getChildren, hit, isTransform, localToDescendantCoordinates, resetTransform, setCullingArea, setStage, setTransform, swapActor, swapActor
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, clearActions, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getWidth, getX, getY, getZIndex, hasParent, isAscendantOf, isDescendantOf, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotate, scale, scale, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplitPane

public SplitPane(Actor firstWidget,
                 Actor secondWidget,
                 boolean vertical,
                 Skin skin)
Parameters:
firstWidget - May be null.
secondWidget - May be null.

SplitPane

public SplitPane(Actor firstWidget,
                 Actor secondWidget,
                 boolean vertical,
                 Skin skin,
                 java.lang.String styleName)
Parameters:
firstWidget - May be null.
secondWidget - May be null.

SplitPane

public SplitPane(Actor firstWidget,
                 Actor secondWidget,
                 boolean vertical,
                 SplitPane.SplitPaneStyle style)
Parameters:
firstWidget - May be null.
secondWidget - May be null.
Method Detail

setStyle

public void setStyle(SplitPane.SplitPaneStyle style)

getStyle

public SplitPane.SplitPaneStyle getStyle()
Returns the split pane's style. Modifying the returned style may not have an effect until setStyle(SplitPaneStyle) is called.


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

getMinWidth

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

getMinHeight

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

setVertical

public void setVertical(boolean vertical)

draw

public void draw(SpriteBatch batch,
                 float parentAlpha)
Description copied from class: WidgetGroup
If this method is overridden, the super method or WidgetGroup.validate() should be called to ensure the widget group is laid out.

Overrides:
draw in class WidgetGroup
parentAlpha - Should be multipied with the actor's alpha, allowing a parent's alpha to affect all children.

setSplitAmount

public void setSplitAmount(float split)
Parameters:
split - The split amount between the min and max amount.

getSplit

public float getSplit()

setMinSplitAmount

public void setMinSplitAmount(float minAmount)

setMaxSplitAmount

public void setMaxSplitAmount(float maxAmount)

setFirstWidget

public void setFirstWidget(Actor widget)
Parameters:
widget - May be null.

setSecondWidget

public void setSecondWidget(Actor widget)
Parameters:
widget - May be null.

addActor

public void addActor(Actor actor)
Description copied from class: Group
Adds an actor as a child of this group. The actor is first removed from its parent group, if any.

Overrides:
addActor in class Group
See Also:
Actor.remove()

addActorAt

public void addActorAt(int index,
                       Actor actor)
Description copied from class: Group
Adds an actor as a child of this group, at a specific index. The actor is first removed from its parent group, if any.

Overrides:
addActorAt in class Group
Parameters:
index - May be greater than the number of children.

addActorBefore

public void addActorBefore(Actor actorBefore,
                           Actor actor)
Description copied from class: Group
Adds an actor as a child of this group, immediately before another child actor. The actor is first removed from its parent group, if any.

Overrides:
addActorBefore in class Group

removeActor

public boolean removeActor(Actor actor)
Description copied from class: Group
Removes an actor from this group. If the actor will not be used again and has actions, they should be cleared so the actions will be returned to their pool, if any. This is not done automatically.

Overrides:
removeActor in class Group

libgdx API

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