libgdx API

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

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.tablelayout.Table
                  extended by com.badlogic.gdx.scenes.scene2d.ui.Button
                      extended by com.badlogic.gdx.scenes.scene2d.ui.ImageButton
All Implemented Interfaces:
Cullable, Layout

public class ImageButton
extends Button

A button with a child Image to display an image. This is useful when the button must be larger than the image and the image centered on the button. If the image is the size of the button, a Button without any children can be used, where the Button.ButtonStyle.up, Button.ButtonStyle.down, and Button.ButtonStyle.checked nine patches define the image.

Author:
Nathan Sweet

Nested Class Summary
static class ImageButton.ImageButtonStyle
          The style for an image button, see ImageButton.
 
Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
Button.ButtonStyle
 
Field Summary
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Table
clip, isPressed
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Group
batchTransform, children, cullingArea, debug, debugTexture, groups, immutableChildren, immutableGroups, lastTouchedChild, localTransform, namesToActors, oldBatchTransform, point, transform, worldTransform
 
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
ImageButton(ImageButton.ImageButtonStyle style)
           
ImageButton(ImageButton.ImageButtonStyle style, java.lang.String name)
           
ImageButton(NinePatch patch)
           
ImageButton(NinePatch patchUp, NinePatch patchDown)
           
ImageButton(NinePatch patchUp, NinePatch patchDown, NinePatch patchChecked)
           
ImageButton(Skin skin)
           
ImageButton(TextureRegion region)
           
ImageButton(TextureRegion regionUp, TextureRegion regionDown)
           
ImageButton(TextureRegion regionUp, TextureRegion regionDown, TextureRegion regionChecked)
           
 
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.
 Image getImage()
           
 Cell getImageCell()
           
 ImageButton.ImageButtonStyle getStyle()
          Returns the button's style.
 void setStyle(Button.ButtonStyle style)
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, isChecked, setChecked, setClickListener
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Table
add, add, add, align, align, bottom, center, clear, click, columnDefaults, debug, debug, debug, defaults, drawBackground, drawDebug, getAlign, getAllCells, getAllCells, getBackgroundPatch, getCell, getCell, getCells, getClickListener, getDebug, getHeight, getPadBottom, getPadLeft, getPadRight, getPadTop, getRow, getTableLayout, getWidget, getWidgets, getWidgets, height, height, invalidate, layout, left, newTable, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, parse, parse, register, reset, right, row, setAssetManager, setBackground, setClip, setSkin, setWidget, size, size, stack, top, touchDown, touchUp, width, width
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, validate
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, disableDebugging, drawChild, drawChildren, enableDebugging, findActor, getActors, getGroups, hit, isDescendant, removeActor, removeActorRecursive, resetTransform, setCullingArea, sortChildren, swapActor, swapActor, toChildCoordinates, toLocalCoordinates, touchMoved, updateTransform
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchDragged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageButton

public ImageButton(Skin skin)

ImageButton

public ImageButton(ImageButton.ImageButtonStyle style)

ImageButton

public ImageButton(ImageButton.ImageButtonStyle style,
                   java.lang.String name)

ImageButton

public ImageButton(TextureRegion region)

ImageButton

public ImageButton(TextureRegion regionUp,
                   TextureRegion regionDown)

ImageButton

public ImageButton(TextureRegion regionUp,
                   TextureRegion regionDown,
                   TextureRegion regionChecked)

ImageButton

public ImageButton(NinePatch patch)

ImageButton

public ImageButton(NinePatch patchUp,
                   NinePatch patchDown)

ImageButton

public ImageButton(NinePatch patchUp,
                   NinePatch patchDown,
                   NinePatch patchChecked)
Method Detail

setStyle

public void setStyle(Button.ButtonStyle style)
Overrides:
setStyle in class Button

getStyle

public ImageButton.ImageButtonStyle getStyle()
Description copied from class: Button
Returns the button's style. Modifying the returned style may not have an effect until Button.setStyle(ButtonStyle) is called.

Overrides:
getStyle in class Button

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 Button
Parameters:
batch - the spritebatch to render with
parentAlpha - the parent's alpha value.

getImage

public Image getImage()

getImageCell

public Cell getImageCell()

libgdx API

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