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

public Class SplitPane

extends WidgetGroup
implements Styleable<SplitPane.SplitPaneStyle>
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.scenes.scene2d.ui.Styleable
Imports
com.badlogic.gdx.graphics.Color, com.badlogic.gdx.graphics.g2d.Batch, com.badlogic.gdx.math.Rectangle, .Vector2, com.badlogic.gdx.scenes.scene2d.Actor, .InputEvent, .InputListener, .Stage, com.badlogic.gdx.scenes.scene2d.utils.Drawable, .Layout, .ScissorStack, com.badlogic.gdx.utils.GdxRuntimeException, .Null

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 side of the SplitPane.

Minimum and maximum split amounts can be set to limit the motion of the resizing handle. The handle position is also prevented from shrinking the children below their minimum sizes. If these limits over-constrain the handle, it will be locked and placed at an averaged location, resulting in cropped children. The minimum child size can be ignored (allowing dynamic cropping) by wrapping the child in a Container with a minimum size of 0 and fill() set, or by overriding clampSplitAmount().

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

Authors
mzechner, Nathan Sweet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SplitPane.SplitPaneStyle

The style for a splitpane, see SplitPane.

Field Summary

Modifier and TypeField and Description
pack-priv boolean
private Actor
private final Rectangle
pack-priv final Rectangle
pack-priv Vector2
pack-priv Vector2
pack-priv float
pack-priv float
private Actor
private final Rectangle
pack-priv float
pack-priv SplitPane.SplitPaneStyle
private final Rectangle
pack-priv boolean

Constructor Summary

AccessConstructor and Description
public
SplitPane(Actor
May be null.
firstWidget
,
Actor
May be null.
secondWidget
,
boolean vertical, Skin skin)

public
SplitPane(Actor
May be null.
firstWidget
,
Actor
May be null.
secondWidget
,
boolean vertical, Skin skin, String styleName)

public
SplitPane(Actor
May be null.
firstWidget
,
Actor
May be null.
secondWidget
,
boolean vertical, SplitPane.SplitPaneStyle style)

Method Summary

Modifier and TypeMethod and Description
public void
addActor(Actor actor)

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

Adds an actor as a child of this group, removing it from its previous parent.

public void
addActorAt(int index, Actor actor)

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

Adds an actor as a child of this group at a specific index, removing it from its previous parent.

public void
addActorBefore(Actor actorBefore, Actor actor)

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

Adds an actor as a child of this group immediately before another child actor, removing it from its previous parent.

private void
private void
protected void
clampSplitAmount()

Called during layout to clamp the splitAmount within the set limits.

public void
draw(Batch batch, float parentAlpha)

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.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 float
public SplitPane.SplitPaneStyle
getStyle()

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.getStyle.

Returns the split pane's style.

private void
public boolean
public boolean
public void
layout()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.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
removeActor(Actor actor)

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

Removes an actor from this group and unfocuses it.

public boolean
removeActor(Actor actor, boolean unfocus)

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

Removes an actor from this group.

public Actor
removeActorAt(int index, boolean unfocus)

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

Removes an actor from this group.

public void
setFirstWidget(Actor
May be null.
widget
)

public void
setMaxSplitAmount(float maxAmount)

public void
setMinSplitAmount(float minAmount)

public void
setSecondWidget(Actor
May be null.
widget
)

public void
setSplitAmount(float
The split amount between the min and max amount. This parameter is clamped during layout. See clampSplitAmount().
splitAmount
)

public void
setStyle(SplitPane.SplitPaneStyle style)

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.setStyle.

Set the current style of the actor

public void
setVertical(boolean vertical)

Inherited from com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup:
childrenChangedgetMaxHeightgetMaxWidthhitinvalidateinvalidateHierarchyneedsLayoutpacksetFillParentsetLayoutEnabledsizeChangedvalidate

Field Detail

cursorOverHandleback to summary
pack-priv boolean cursorOverHandle
firstWidgetback to summary
private Actor firstWidget
Annotations
@Null
firstWidgetBoundsback to summary
private final Rectangle firstWidgetBounds
handleBoundsback to summary
pack-priv final Rectangle handleBounds
handlePositionback to summary
pack-priv Vector2 handlePosition
lastPointback to summary
pack-priv Vector2 lastPoint
maxAmountback to summary
pack-priv float maxAmount
minAmountback to summary
pack-priv float minAmount
secondWidgetback to summary
private Actor secondWidget
Annotations
@Null
secondWidgetBoundsback to summary
private final Rectangle secondWidgetBounds
splitAmountback to summary
pack-priv float splitAmount
styleback to summary
pack-priv SplitPane.SplitPaneStyle style
tempScissorsback to summary
private final Rectangle tempScissors
verticalback to summary
pack-priv boolean vertical

Constructor Detail

SplitPaneback to summary
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Skin skin)
Parameters
firstWidget:Actor

May be null.

secondWidget:Actor

May be null.

SplitPaneback to summary
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Skin skin, String styleName)
Parameters
firstWidget:Actor

May be null.

secondWidget:Actor

May be null.

SplitPaneback to summary
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, SplitPane.SplitPaneStyle style)
Parameters
firstWidget:Actor

May be null.

secondWidget:Actor

May be null.

Method Detail

addActorback to summary
public void addActor(Actor actor)

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

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

Adds an actor as a child of this group, removing it from its previous parent. If the actor is already a child of this group, no changes are made.

addActorAtback to summary
public void addActorAt(int index, Actor actor)

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

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

Adds an actor as a child of this group at a specific index, removing it from its previous parent. If the actor is already a child of this group, no changes are made.

addActorBeforeback to summary
public void addActorBefore(Actor actorBefore, Actor actor)

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

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

Adds an actor as a child of this group immediately before another child actor, removing it from its previous parent. If the actor is already a child of this group, no changes are made.

calculateHorizBoundsAndPositionsback to summary
private void calculateHorizBoundsAndPositions()
calculateVertBoundsAndPositionsback to summary
private void calculateVertBoundsAndPositions()
clampSplitAmountback to summary
protected void clampSplitAmount()

Called during layout to clamp the splitAmount within the set limits. By default it imposes the limits of the min amount, max amount, and min sizes of the children. This method is internally called in response to layout, so it should not call invalidate().

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

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw.

Doc from com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw.

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

getMaxSplitAmountback to summary
public float getMaxSplitAmount()
getMinHeightback to summary
public float getMinHeight()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getMinHeight.

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

getMinSplitAmountback to summary
public float getMinSplitAmount()
getMinWidthback to summary
public float getMinWidth()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getMinWidth.

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

getPrefHeightback to summary
public float getPrefHeight()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getPrefHeight.

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

getPrefWidthback to summary
public float getPrefWidth()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.getPrefWidth.

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

getSplitAmountback to summary
public float getSplitAmount()
getStyleback to summary
public SplitPane.SplitPaneStyle getStyle()

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.getStyle.

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

initializeback to summary
private void initialize()
isCursorOverHandleback to summary
public boolean isCursorOverHandle()
isVerticalback to summary
public boolean isVertical()
layoutback to summary
public void layout()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.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.

removeActorback to summary
public boolean removeActor(Actor actor)

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

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

Removes an actor from this group and unfocuses it. Calls removeActor(Actor, boolean) with true.

removeActorback to summary
public boolean removeActor(Actor actor, boolean unfocus)

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

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

Removes an actor from this group. Calls removeActorAt(int, boolean) with the actor's child index.

removeActorAtback to summary
public Actor removeActorAt(int index, boolean unfocus)

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

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

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.

setFirstWidgetback to summary
public void setFirstWidget(Actor widget)
Parameters
widget:Actor

May be null.

setMaxSplitAmountback to summary
public void setMaxSplitAmount(float maxAmount)
setMinSplitAmountback to summary
public void setMinSplitAmount(float minAmount)
setSecondWidgetback to summary
public void setSecondWidget(Actor widget)
Parameters
widget:Actor

May be null.

setSplitAmountback to summary
public void setSplitAmount(float splitAmount)
Parameters
splitAmount:float

The split amount between the min and max amount. This parameter is clamped during layout. See clampSplitAmount().

setStyleback to summary
public void setStyle(SplitPane.SplitPaneStyle style)

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.setStyle.

Doc from com.badlogic.gdx.scenes.scene2d.ui.Styleable.setStyle.

Set the current style of the actor

setVerticalback to summary
public void setVertical(boolean vertical)
com.badlogic.gdx.scenes.scene2d.ui back to summary

public Class SplitPane.SplitPaneStyle

extends Object
Class Inheritance

The style for a splitpane, see SplitPane.
Authors
mzechner, Nathan Sweet

Field Summary

Modifier and TypeField and Description
public Drawable

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handleback to summary
public Drawable handle

Constructor Detail

SplitPaneStyleback to summary
public SplitPaneStyle()
SplitPaneStyleback to summary
public SplitPaneStyle(Drawable handle)
SplitPaneStyleback to summary
public SplitPaneStyle(SplitPane.SplitPaneStyle style)