libgdx API

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

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.Table
                  extended by com.badlogic.gdx.scenes.scene2d.ui.Window
All Implemented Interfaces:
Cullable, Layout
Direct Known Subclasses:
Dialog

public class Window
extends Table

A table that can be dragged and act as a modal window. The top padding is used as the window's title height.

The preferred size of a window is the preferred size of the title text and the children as layed out by the table. After adding children to the window, it can be convenient to call WidgetGroup.pack() to size the window to the size of the children.

Author:
Nathan Sweet

Nested Class Summary
static class Window.WindowStyle
          The style for a window, see Window.
 
Constructor Summary
Window(java.lang.String title, Skin skin)
           
Window(java.lang.String title, Skin skin, java.lang.String styleName)
           
Window(java.lang.String title, Window.WindowStyle style)
           
 
Method Summary
 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.
protected  void drawBackground(SpriteBatch batch, float parentAlpha)
          Called to draw the background, before clipping is applied (if enabled).
 float getPrefWidth()
           
 Window.WindowStyle getStyle()
          Returns the window's style.
 java.lang.String getTitle()
           
 Actor hit(float x, float y, boolean touchable)
          Returns the deepest actor that contains the specified point and is touchable and visible, or null if no actor was hit.
 boolean isDragging()
           
 void setKeepWithinStage(boolean keepWithinStage)
           
 void setModal(boolean isModal)
           
 void setMovable(boolean isMovable)
           
 void setStyle(Window.WindowStyle style)
           
 void setTitle(java.lang.String title)
           
 void setTitleAlignment(int titleAlignment)
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table
add, add, add, add, add, add, align, bottom, center, clear, columnDefaults, debug, debug, debugCell, debugTable, debugWidget, defaults, drawDebug, getAlign, getBackground, getCell, getCells, getDebug, getMinHeight, getMinWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getPrefHeight, getRow, invalidate, layout, left, pad, pad, padBottom, padLeft, padRight, padTop, reset, right, row, setBackground, setBackground, setClip, setRound, setSkin, stack, top
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, computeTransform, drawChildren, findActor, getChildren, isTransform, localToDescendantCoordinates, removeActor, 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

Window

public Window(java.lang.String title,
              Skin skin)

Window

public Window(java.lang.String title,
              Skin skin,
              java.lang.String styleName)

Window

public Window(java.lang.String title,
              Window.WindowStyle style)
Method Detail

setStyle

public void setStyle(Window.WindowStyle style)

getStyle

public Window.WindowStyle getStyle()
Returns the window's style. Modifying the returned style may not have an effect until setStyle(WindowStyle) is called.


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 Table
parentAlpha - Should be multipied with the actor's alpha, allowing a parent's alpha to affect all children.

drawBackground

protected void drawBackground(SpriteBatch batch,
                              float parentAlpha)
Description copied from class: Table
Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable.

Overrides:
drawBackground in class Table

hit

public Actor hit(float x,
                 float y,
                 boolean touchable)
Description copied from class: Actor
Returns the deepest actor that contains the specified point and is touchable and visible, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the bottom left of the actor and width,height is the upper right).

This method is used to delegate touchDown events. If this method returns null, touchDown will not occur.

The default implementation returns this actor if the point is within this actor's bounds.

Overrides:
hit in class Table
touchable - If true, the hit detection will respect the touchability.
See Also:
Touchable

setTitle

public void setTitle(java.lang.String title)

getTitle

public java.lang.String getTitle()

setTitleAlignment

public void setTitleAlignment(int titleAlignment)
Parameters:
titleAlignment - Align

setMovable

public void setMovable(boolean isMovable)

setModal

public void setModal(boolean isModal)

setKeepWithinStage

public void setKeepWithinStage(boolean keepWithinStage)

isDragging

public boolean isDragging()

getPrefWidth

public float getPrefWidth()
Specified by:
getPrefWidth in interface Layout
Overrides:
getPrefWidth in class Table

libgdx API

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