|
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.SplitPane
public class SplitPane
A special container holding two children and allowing to define the space used by each.
Actor
instances (or Widget
or Table
instances for that
matter), separated by a split handle, either vertically or horizontally. Both widgets will be sized so that they take up their
respective space within the SplitPane. The handle can be moved via dragging to vary the size available to each widget.
The amount of available space for the first Actor is given between 0 and 1, 0 meaning no space, 1 meaning all the space. The
amount of space available for the second Actor is computed as 1 minus the amount available to the second Actor. One can set the
value for the first widget via setSplitAmount(float)
manually, the amount for the second Actor is derrived
automatically. The range of the split amount can be defined via setMinSplitAmount(float)
and
setMaxSplitAmount(float)
.
The SplitPane will employ scissoring (clipping) to make sure none of the two Actors can render outside of their allocated
space.
Note: do not use any of the Group.addActor(Actor)
or Group.removeActor(Actor)
methods with this class! The embedded
Actors are specified at construction time or via #set
The embedded Actors will always be resized to fill their entire space within the SplitPane
Group
displaying two Actor instances either left and right or top and bottom, depending
on whether the SplitPane is a horizontal split pane or a vertical split pane. Additionally a NinePatch
is used to
render the SplitPane handle, either a horizontal or vertical strip. In case the SplitPane is a horizontal one the NinePatch
will be stretched vertically, and its width will be the value returned by NinePatch.getTotalWidth()
. In case the
SplitPane is a vertical one it will be stretched horizontally and its height will be the value returned by
NinePatch.getTotalHeight()
.
A SplitPane's style definition in a skin XML file should look like this:
<splitpane name="styleName"
handle="handlePatch"/>
name
attribute defines the name of the style which you can later use with
Skin#newSplitPane(String, Stage, Actor, Actor, boolean, int, int, String)
.handle
attribute references a NinePatch
by name, to be used as the split pane's handle
Nested Class Summary | |
---|---|
static class |
SplitPane.SplitPaneStyle
Defines the style of a split pane, see SplitPane |
Field Summary |
---|
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
batchTransform, children, debug, debugTexture, focusedActor, groups, immutableChildren, immutableGroups, keyboardFocusedActor, lastTouchedChild, localTransform, namesToActors, oldBatchTransform, point, scrollFocusedActor, transform, worldTransform |
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, touchable, visible, width, x, y |
Constructor Summary | |
---|---|
SplitPane(Actor firstWidget,
Actor secondWidget,
boolean vertical,
Stage stage,
Skin skin)
|
|
SplitPane(Actor firstWidget,
Actor secondWidget,
boolean vertical,
Stage stage,
SplitPane.SplitPaneStyle style)
|
|
SplitPane(Actor firstWidget,
Actor secondWidget,
boolean vertical,
Stage stage,
SplitPane.SplitPaneStyle style,
java.lang.String name)
Creates a new SplitPane. |
Method Summary | |
---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
Draws the Actor. |
float |
getMaxHeight()
|
float |
getMaxWidth()
|
float |
getMinHeight()
|
float |
getMinWidth()
|
float |
getPrefHeight()
|
float |
getPrefWidth()
|
float |
getSplit()
|
Actor |
hit(float x,
float y)
|
void |
invalidate()
Invalidates the layout, forcing the next call to Layout.layout() to relayout. |
void |
layout()
Positions and sizes each child of this actor. |
void |
setMaxSplitAmount(float maxAmount)
Sets the maximum split amount |
void |
setMinSplitAmount(float minAmount)
Sets the minimum split amount |
void |
setSplitAmount(float split)
Sets the split amount |
void |
setStyle(SplitPane.SplitPaneStyle style)
Sets the style of this widget. |
void |
setWidgets(Actor firstWidget,
Actor secondWidget)
Sets the Actor instances embedded in this scroll pane. |
boolean |
touchDown(float x,
float y,
int pointer)
|
void |
touchDragged(float x,
float y,
int pointer)
|
void |
touchUp(float x,
float y,
int pointer)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, clear, disableDebugging, drawChild, drawChildren, enableDebugging, findActor, focus, getActors, getGroups, keyboardFocus, keyDown, keyTyped, keyUp, removeActor, removeActorRecursive, resetTransform, scrolled, scrollFocus, sortChildren, swapActor, swapActor, toChildCoordinates, touchMoved, unfocusAll, unfocusAll, updateTransform |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
action, clearActions, isMarkedToRemove, markToRemove, remove, toLocalCoordinates, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Stage stage, Skin skin)
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Stage stage, SplitPane.SplitPaneStyle style)
public SplitPane(Actor firstWidget, Actor secondWidget, boolean vertical, Stage stage, SplitPane.SplitPaneStyle style, java.lang.String name)
firstWidget
- the first Actor
secondWidget
- the second Actorvertical
- whether this is a vertical SplitPane or not (horizontal)stage
- the stage, used for clippingstyle
- the SplitPane.SplitPaneStyle
name
- the nameMethod Detail |
---|
public void setStyle(SplitPane.SplitPaneStyle style)
style
- public void layout()
Layout
Layout.invalidate()
is
called.
layout
in interface Layout
public void invalidate()
Layout
Layout.layout()
to relayout. If an actor is resized or otherwise changed
in a way that affects its layout, Layout.invalidate()
should be called.
invalidate
in interface Layout
public float getPrefWidth()
getPrefWidth
in interface Layout
public float getPrefHeight()
getPrefHeight
in interface Layout
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 draw(SpriteBatch batch, float parentAlpha)
Actor
FadeIn
and
other Actions to have an effect even if they are only set on the parent of the Actor.
draw
in class Group
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.public boolean touchDown(float x, float y, int pointer)
touchDown
in class Group
public void touchUp(float x, float y, int pointer)
touchUp
in class Group
public void touchDragged(float x, float y, int pointer)
touchDragged
in class Group
public Actor hit(float x, float y)
hit
in class Group
public void setSplitAmount(float split)
split
- the split amount between 0 and 1public float getSplit()
public void setMinSplitAmount(float minAmount)
minAmount
- the minimum split amountpublic void setMaxSplitAmount(float maxAmount)
maxAmount
- the maximum split amountpublic void setWidgets(Actor firstWidget, Actor secondWidget)
Actor
instances embedded in this scroll pane. Invalidates the new Actor instances if they derrive from
Widget
firstWidget
- the first Actor
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |