|
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.tablelayout.Table
com.badlogic.gdx.scenes.scene2d.ui.Window
public class Window
A container acting as a dialog or window.
Table
that can be moved around by touching and dragging its titlebar.It can house
multiple Actor
instances in a table-layout. The difference to a pure Container is that the Window will automatically
set the padding of the layout to respect the width and height of the border patches of its background NinePatch. See
Table
for more information on how Actor instances are laid out when using this class.
A Window can also be set to be modal via a call to setModal(boolean)
, in which case all touch input will go to that
window no matter where the user touched the screen.
Table
documentation on how the width and height will be manipulated if the Window is contained in another
Container, a not so common use case. Additionally you can set the (preferred) width and height via a call to
TableLayout#size(int, int)
.
Table
displaying a background NinePatch
and its child Actors, clipped to the
Window's area, taking into account the padding as described in the functionality section. Additionally the window will render a
title string in its top border patches. The style is defined via an instance of Window.WindowStyle
, which can be either done
programmatically or via a Skin
.
A Pane's style definition in a skin XML file should look like this:
<window name="name"
titleFont="fontName"
titleFontColor="fontColor"
background="backgroundPatch"/>
name
attribute defines the name of the style which you can later use with
Skin#newWindow(String, Stage, String, int, int, String)
.titleFont
attribute references a BitmapFont
by name, to be used to render the title string.titleFontColor
attribute references a Color
by name, to be used to render the title string.background
attribute references a NinePatch
by name, to be used as the Window's background.
Nested Class Summary | |
---|---|
static class |
Window.WindowStyle
Defines the style of a window, see Window |
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, 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 | |
---|---|
Window(java.lang.String title,
Stage stage,
Skin skin)
|
|
Window(java.lang.String title,
Stage stage,
Window.WindowStyle style)
|
|
Window(java.lang.String name,
java.lang.String title,
Stage stage,
Window.WindowStyle style,
int prefWidth,
int prefHeight)
Creates a new Window. |
Method Summary | |
---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
Draws the Actor. |
java.lang.String |
getTitle()
|
Actor |
hit(float x,
float y)
|
boolean |
isModal()
|
boolean |
isMovable()
|
void |
setModal(boolean isModal)
Sets whether this Window is modal or not. |
void |
setMovable(boolean isMovable)
Sets whether this Window is movable by touch or not. |
void |
setStyle(Window.WindowStyle style)
Sets the style of this widget. |
void |
setTitle(java.lang.String title)
Sets the title of the Window |
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.ui.tablelayout.Table |
---|
add, align, align, bottom, center, clear, columnDefaults, debug, debug, debug, defaults, drawDebug, getAlign, getAllCells, getAllCells, getCell, getCell, getCells, getDebug, getHeight, getMinHeight, getMinWidth, getPadBottom, getPadLeft, getPadRight, getPadTop, getPrefHeight, getPrefWidth, getTableLayout, height, height, invalidate, invalidateHierarchy, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, parse, reset, right, row, setActor, size, size, stack, top, width, width |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, 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 Window(java.lang.String title, Stage stage, Skin skin)
public Window(java.lang.String title, Stage stage, Window.WindowStyle style)
public Window(java.lang.String name, java.lang.String title, Stage stage, Window.WindowStyle style, int prefWidth, int prefHeight)
name
- the namestage
- the Stage
, used for clippingtitle
- the titleprefWidth
- the (preferred) widthprefHeight
- the (preferred) heightstyle
- the Window.WindowStyle
Method Detail |
---|
public void setStyle(Window.WindowStyle style)
Table.invalidateHierarchy()
internally.
style
- 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 Table
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 setTitle(java.lang.String title)
title
- the titlepublic java.lang.String getTitle()
public void setMovable(boolean isMovable)
isMovable
- whether the window is movable or notpublic boolean isMovable()
public void setModal(boolean isModal)
isModal
- whether the window is modal or notpublic boolean isModal()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |