|
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.ui.Widget
com.badlogic.gdx.scenes.scene2d.ui.SelectBox
public class SelectBox
A select box (aka a drop-down list) allows a user to choose one of a number of values from a list. When inactive, the selected value is displayed. When activated, it shows the list of values that may be selected.
The preferred size of the select box is determined by the maximum text bounds of the items and the size of the
SelectBox.SelectBoxStyle.background
.
Nested Class Summary | |
---|---|
static class |
SelectBox.SelectBoxStyle
The style for a select box, see SelectBox . |
Field Summary |
---|
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 | |
---|---|
SelectBox(java.lang.Object[] items,
SelectBox.SelectBoxStyle style)
|
|
SelectBox(java.lang.Object[] items,
SelectBox.SelectBoxStyle style,
java.lang.String name)
|
|
SelectBox(java.lang.Object[] items,
Skin skin)
|
|
SelectBox(Skin skin)
|
Method Summary | |
---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or Widget.validate() should be called to ensure the widget is laid out. |
float |
getPrefHeight()
|
float |
getPrefWidth()
|
java.lang.String |
getSelection()
|
int |
getSelectionIndex()
|
SelectBox.SelectBoxStyle |
getStyle()
Returns the select box's style. |
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. |
void |
markToRemove(boolean remove)
Marks the Actor to be removed by its parent. |
void |
setItems(java.lang.Object[] objects)
|
void |
setSelection(int selection)
Sets the selected item via it's index |
void |
setSelection(java.lang.String item)
|
void |
setSelectionListener(SelectionListener listener)
Sets the SelectionListener . |
void |
setStyle(SelectBox.SelectBoxStyle style)
|
boolean |
touchDown(float x,
float y,
int pointer)
|
void |
touchUp(float x,
float y,
int pointer)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget |
---|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, hit, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, toScreenCoordinates, touchDragged, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
act, action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, remove, scrolled, toLocalCoordinates, toString, touchMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SelectBox(Skin skin)
public SelectBox(java.lang.Object[] items, Skin skin)
public SelectBox(java.lang.Object[] items, SelectBox.SelectBoxStyle style)
public SelectBox(java.lang.Object[] items, SelectBox.SelectBoxStyle style, java.lang.String name)
Method Detail |
---|
public void setStyle(SelectBox.SelectBoxStyle style)
public SelectBox.SelectBoxStyle getStyle()
setStyle(SelectBoxStyle)
is called.
public void setItems(java.lang.Object[] objects)
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
layout
in class Widget
public void draw(SpriteBatch batch, float parentAlpha)
Widget
Widget.validate()
should be called to ensure the widget is laid out.
draw
in class Widget
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.public boolean touchDown(float x, float y, int pointer)
touchDown
in class Widget
public void touchUp(float x, float y, int pointer)
touchUp
in class Widget
public void setSelectionListener(SelectionListener listener)
SelectionListener
.
listener
- the listener or nullpublic void setSelection(int selection)
selection
- the selection indexpublic void setSelection(java.lang.String item)
public int getSelectionIndex()
public java.lang.String getSelection()
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public void markToRemove(boolean remove)
Actor
Actor
to be removed by its parent.
The actual removal happens in the Group.act(float)
method of the parent and after the parent has called
Actor.act(float)
on this Actor
.
markToRemove
in class Actor
remove
- whether the parent is supposed to remove this Actor
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |