Package arc.scene.ui
Class ImageButton
java.lang.Object
arc.scene.Element
arc.scene.Group
arc.scene.ui.layout.WidgetGroup
arc.scene.ui.layout.Table
arc.scene.ui.Button
arc.scene.ui.ImageButton
- All Implemented Interfaces:
Cullable
,Disableable
- Direct Known Subclasses:
LCanvas.JumpButton
,MobileButton
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.-
Nested Class Summary
Nested classes/interfaces inherited from class arc.scene.ui.Button
Button.ButtonStyle
Nested classes/interfaces inherited from class arc.scene.ui.layout.Table
Table.DrawRect
-
Field Summary
Fields inherited from class arc.scene.Group
children, cullingArea, transform
Fields inherited from class arc.scene.Element
color, cullable, fillParent, height, name, originX, originY, parent, parentAlpha, rotation, scaleX, scaleY, touchable, touchablility, translation, userObject, visibility, visible, width, x, y
-
Constructor Summary
ConstructorDescriptionImageButton
(TextureRegion region) ImageButton
(TextureRegion region, ImageButton.ImageButtonStyle stylen) ImageButton
(Drawable imageUp) ImageButton
(Drawable imageUp, Drawable imageDown) ImageButton
(Drawable imageUp, Drawable imageDown, Drawable imageChecked) ImageButton
(Drawable icon, ImageButton.ImageButtonStyle stylen) -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw()
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.getImage()
getStyle()
Returns the button's style.void
replaceImage
(Element element) void
resizeImage
(float size) void
setStyle
(Button.ButtonStyle style) protected void
Updates the Image with the appropriate Drawable from the style before it is drawn.Methods inherited from class arc.scene.ui.Button
act, childrenPressed, getButtonGroup, getClickListener, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, isChecked, isDisabled, isOver, isPressed, setChecked, setDisabled, setDisabled, setProgrammaticChangeEvents, toggle
Methods inherited from class arc.scene.ui.layout.Table
add, add, add, add, add, add, add, add, add, align, area, area, background, bottom, button, button, button, button, button, button, button, button, button, button, button, button, buttonCenter, buttonCenter, buttonCenter, buttonRow, center, check, check, check, clearChildren, collapser, collapser, collapser, collapser, defaults, drawBackground, field, field, field, fill, getAlign, getBackground, getCell, getCells, getClip, getColumns, getColumnWidth, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getRow, getRowHeight, getRows, hit, image, image, image, image, image, imageDraw, invalidate, label, labelWrap, labelWrap, layout, left, margin, margin, marginBottom, marginLeft, marginRight, marginTop, pane, pane, pane, pane, rect, removeChild, removeChild, reset, right, row, setBackground, setClip, setRound, slider, slider, slider, stack, table, table, table, table, table, top
Methods inherited from class arc.scene.ui.layout.WidgetGroup
childrenChanged, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
Methods inherited from class arc.scene.Group
addChild, addChildAfter, addChildAt, addChildBefore, applyTransform, clear, computeTransform, drawChildren, fill, fill, fill, find, find, findVisible, forEach, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, setCullingArea, setScene, setTransform, swapActor, swapActor, toString
Methods inherited from class arc.scene.Element
actions, addAction, addCaptureListener, addListener, change, changed, clearActions, clearListeners, clicked, clicked, clicked, clicked, clipBegin, clipBegin, clipEnd, dragged, exited, fire, fireClick, getActions, getCaptureListeners, getHeight, getListeners, getMaxHeight, getMaxWidth, getRight, getRotation, getScene, getTop, getWidth, getX, getY, getZIndex, hasActions, hasKeyboard, hasMouse, hasParent, hasScroll, hovered, isAscendantOf, isDescendantOf, isDescendantOf, isTouchable, keepInStage, keyDown, keyDown, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, released, remove, removeAction, removeCaptureListener, removeListener, requestKeyboard, requestScroll, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, scrolled, setBounds, setColor, setColor, setHeight, setOrigin, setOrigin, setPosition, setPosition, setRotation, setRotationOrigin, setScale, setScale, setSize, setSize, setTranslation, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, tapped, toBack, toFront, touchable, update, updateVisibility, visible
-
Constructor Details
-
ImageButton
public ImageButton() -
ImageButton
-
ImageButton
-
ImageButton
-
ImageButton
-
ImageButton
-
ImageButton
-
ImageButton
-
-
Method Details
-
getStyle
Description copied from class:Button
Returns the button's style. Modifying the returned style may not have an effect untilButton.setStyle(ButtonStyle)
is called. -
setStyle
-
replaceImage
-
updateImage
protected void updateImage()Updates the Image with the appropriate Drawable from the style before it is drawn. -
draw
public void draw()Description copied from class:WidgetGroup
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out. -
getImage
-
getImageCell
-
resizeImage
public void resizeImage(float size)
-