Package arc.scene.ui
Class Dialog
java.lang.Object
arc.scene.Element
arc.scene.Group
arc.scene.ui.layout.WidgetGroup
arc.scene.ui.layout.Table
arc.scene.ui.Dialog
- All Implemented Interfaces:
Cullable
- Direct Known Subclasses:
BaseDialog
,DiscordDialog
,KeybindDialog
,MapEditorDialog
,PaletteDialog
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 laid 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class arc.scene.ui.layout.Table
Table.DrawRect
-
Field Summary
Modifier and TypeFieldDescriptionfinal Table
final Table
protected boolean
protected int
protected InputListener
final Label
final Table
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
act
(float delta) Updates the actor based on time.void
void
Centers the dialog in the scene.void
Adds a listener for back/escape keys to hide this dialog.void
closeOnBack
(Runnable callback) void
draw()
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.protected void
drawStageBackground
(float x, float y, float width, float height) getStyle()
Returns the window's style.void
Adds a hide() listener.void
hide()
Hides the dialog.void
Hides the dialog with the given action and then removes it from the stage.hit
(float x, float y, boolean touchable) Returns the deepest actor that contains the specified point and istouchable
andvisible
, or null if no actor was hit.boolean
boolean
boolean
isModal()
boolean
boolean
boolean
isShown()
void
Adds a scene resize listener, optionally invoking it immediately.void
Adds a scene resize listener.void
resizedShown
(Runnable run) Runs the callback when this dialog is resized or hidden.void
setCentered
(boolean center) static void
setHideAction
(Prov<Action> prov) void
setKeepWithinStage
(boolean keepWithinStage) void
setModal
(boolean isModal) void
setMovable
(boolean isMovable) void
setResizable
(boolean isResizable) void
setResizeBorder
(int resizeBorder) protected void
Called by the framework when this actor or any parent is added to a group that is in the stage.static void
setShowAction
(Prov<Action> prov) void
setStyle
(Dialog.DialogStyle style) show()
Packs
the dialog and adds it to the stage, centered with default fadeIn actionPacks
the dialog and adds it to the stage with custom action which can be null for instant showvoid
Adds a show() listener.void
toggle()
Shows this dialog if it was hidden, and vice versa.void
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, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getRow, getRowHeight, getRows, 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, 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
-
Field Details
-
ignoreTouchDown
-
edge
protected int edge -
dragging
protected boolean dragging -
cont
-
buttons
-
title
-
titleTable
-
-
Constructor Details
-
Dialog
public Dialog() -
Dialog
-
Dialog
-
-
Method Details
-
getStyle
Returns the window's style. Modifying the returned style may not have an effect untilsetStyle(DialogStyle)
is called. -
setStyle
-
act
public void act(float delta) Description copied from class:Element
Updates the actor based on time. Typically this is called each frame byScene.act(float)
.The default implementation calls
Action.act(float)
on each action and removes actions that are complete. -
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. -
drawStageBackground
protected void drawStageBackground(float x, float y, float width, float height) -
hit
Description copied from class:Element
Returns the deepest actor that contains the specified point and istouchable
andvisible
, 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, mouse, and enter/exit events. If this method returns null, those events will not occur on this Actor.
The default implementation returns this actor if the point is within this actor's bounds.
-
centerWindow
public void centerWindow()Centers the dialog in the scene. -
isMovable
public boolean isMovable() -
setMovable
public void setMovable(boolean isMovable) -
isModal
public boolean isModal() -
setModal
public void setModal(boolean isModal) -
setKeepWithinStage
public void setKeepWithinStage(boolean keepWithinStage) -
isCentered
public boolean isCentered() -
setCentered
public void setCentered(boolean center) -
isResizable
public boolean isResizable() -
setResizable
public void setResizable(boolean isResizable) -
setResizeBorder
public void setResizeBorder(int resizeBorder) -
isDragging
public boolean isDragging() -
updateScrollFocus
public void updateScrollFocus() -
setHideAction
-
setShowAction
-
setScene
Description copied from class:Element
Called by the framework when this actor or any parent is added to a group that is in the stage. -
shown
Adds a show() listener. -
resizedShown
Runs the callback when this dialog is resized or hidden. -
resized
Adds a scene resize listener. -
resized
Adds a scene resize listener, optionally invoking it immediately. -
addCloseButton
public void addCloseButton() -
closeOnBack
public void closeOnBack()Adds a listener for back/escape keys to hide this dialog. -
closeOnBack
-
isShown
public boolean isShown() -
show
Packs
the dialog and adds it to the stage with custom action which can be null for instant show -
toggle
public void toggle()Shows this dialog if it was hidden, and vice versa. -
show
-
show
Packs
the dialog and adds it to the stage, centered with default fadeIn action -
hide
Hides the dialog with the given action and then removes it from the stage. -
hide
public void hide()Hides the dialog. Called automatically when a button is clicked. The default implementation fades out the dialog over 400 milliseconds.
-