Package gaiasky.util
Class GuiUtils
java.lang.Object
gaiasky.util.GuiUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addNoConnectionExit
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) static void
addNoConnectionWindow
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) static void
addNoConnectionWindow
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable ok) static void
addNotificationWindow
(String title, String message, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable ok) static void
addNoVRConnectionExit
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) static void
addNoVRDataExit
(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) static void
ensureScrollVisible
(com.badlogic.gdx.scenes.scene2d.Actor actor) If the given actor has a scroll pane ancestor, this method makes sure that the actor is visible by moving the scroll position if required.static com.badlogic.gdx.utils.Array
<com.badlogic.gdx.scenes.scene2d.Actor> getInputWidgets
(com.badlogic.gdx.scenes.scene2d.Actor actor, com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> list) Get all the input widgets in the given container actor by traversing it recursively.static com.badlogic.gdx.utils.Array
<com.badlogic.gdx.scenes.scene2d.Actor> getInputWidgets
(com.badlogic.gdx.utils.Array<? extends com.badlogic.gdx.scenes.scene2d.Actor> actors, com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> list) Get all input widgets recursively.static com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
getScrollPaneAncestor
(com.badlogic.gdx.scenes.scene2d.Actor actor) Gets the first scroll pane ancestor of the given actor, if any.static com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
getScrollPaneIn
(com.badlogic.gdx.scenes.scene2d.Actor actor) Gets the first scroll pane contained in the given actor by traversing it recursively, if it exists.static void
getScrollPanes
(com.badlogic.gdx.scenes.scene2d.Group group, com.badlogic.gdx.utils.Array<OwnScrollPane> list) Recursively get all scroll panes in the given group.static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
getTooltipHorizontalGroup
(com.badlogic.gdx.scenes.scene2d.Actor actor, String tooltipText, float space, com.badlogic.gdx.scenes.scene2d.ui.Skin skin) static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
getTooltipHorizontalGroup
(com.badlogic.gdx.scenes.scene2d.Actor actor, String tooltipText, com.badlogic.gdx.scenes.scene2d.ui.Skin skin) static boolean
hasChangeListener
(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the actor currently has a change listener attached.static boolean
isDescendentOf
(com.badlogic.gdx.scenes.scene2d.Actor object, com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup parent) Returns true if the given object is a descendant of the given group.static boolean
isInputWidget
(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the given actor is an input widget.static boolean
isNotDisabled
(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the actor is not disabled.static boolean
isTooltipWidget
(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the given actor is a tooltip widget.static void
selectBoxMoveSelection
(boolean up, boolean jump, com.badlogic.gdx.scenes.scene2d.ui.SelectBox<?> selectBox) Moves the selection of the given select box up or down.static void
sliderMove
(boolean up, float percent, com.badlogic.gdx.scenes.scene2d.ui.Slider slider) Moves the slider up or down by the given percentage.static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
tooltipHg
(com.badlogic.gdx.scenes.scene2d.Actor actor, String key, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
-
Constructor Details
-
GuiUtils
public GuiUtils()
-
-
Method Details
-
addNotificationWindow
-
addNoConnectionWindow
public static void addNoConnectionWindow(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) -
addNoConnectionWindow
public static void addNoConnectionWindow(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage, Runnable ok) -
addNoConnectionExit
public static void addNoConnectionExit(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) -
addNoVRConnectionExit
public static void addNoVRConnectionExit(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) -
addNoVRDataExit
public static void addNoVRDataExit(com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.Stage stage) -
getTooltipHorizontalGroup
public static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup getTooltipHorizontalGroup(com.badlogic.gdx.scenes.scene2d.Actor actor, String tooltipText, com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
getTooltipHorizontalGroup
public static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup getTooltipHorizontalGroup(com.badlogic.gdx.scenes.scene2d.Actor actor, String tooltipText, float space, com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
tooltipHg
public static com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup tooltipHg(com.badlogic.gdx.scenes.scene2d.Actor actor, String key, com.badlogic.gdx.scenes.scene2d.ui.Skin skin) -
sliderMove
public static void sliderMove(boolean up, float percent, com.badlogic.gdx.scenes.scene2d.ui.Slider slider) Moves the slider up or down by the given percentage.- Parameters:
up
- Whether to move it up.percent
- The percentage in [0,1].slider
- The slider to move.
-
selectBoxMoveSelection
public static void selectBoxMoveSelection(boolean up, boolean jump, com.badlogic.gdx.scenes.scene2d.ui.SelectBox<?> selectBox) Moves the selection of the given select box up or down.- Parameters:
up
- Whether to move up (true) or down (false).jump
- If true, the selection is moved all the way up or down.selectBox
- The select box.
-
getScrollPaneIn
public static com.badlogic.gdx.scenes.scene2d.ui.ScrollPane getScrollPaneIn(com.badlogic.gdx.scenes.scene2d.Actor actor) Gets the first scroll pane contained in the given actor by traversing it recursively, if it exists.- Parameters:
actor
- The container actor.- Returns:
- The first scroll pane found, or null if none is found.
-
getScrollPaneAncestor
public static com.badlogic.gdx.scenes.scene2d.ui.ScrollPane getScrollPaneAncestor(com.badlogic.gdx.scenes.scene2d.Actor actor) Gets the first scroll pane ancestor of the given actor, if any.- Parameters:
actor
- The actor.- Returns:
- The first scroll pane ancestor. Null if it does not exist.
-
ensureScrollVisible
public static void ensureScrollVisible(com.badlogic.gdx.scenes.scene2d.Actor actor) If the given actor has a scroll pane ancestor, this method makes sure that the actor is visible by moving the scroll position if required.- Parameters:
actor
- The actor.
-
getScrollPanes
public static void getScrollPanes(com.badlogic.gdx.scenes.scene2d.Group group, com.badlogic.gdx.utils.Array<OwnScrollPane> list) Recursively get all scroll panes in the given group.- Parameters:
group
- The group to test.list
- The output list where to put the scroll panes.
-
getInputWidgets
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> getInputWidgets(com.badlogic.gdx.utils.Array<? extends com.badlogic.gdx.scenes.scene2d.Actor> actors, com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> list) Get all input widgets recursively.- Parameters:
actors
- The list of actors.list
- The output list.- Returns:
- The output list with all the input widgets.
-
getInputWidgets
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> getInputWidgets(com.badlogic.gdx.scenes.scene2d.Actor actor, com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Actor> list) Get all the input widgets in the given container actor by traversing it recursively.- Parameters:
actor
- The actor.list
- The list with all the input widgets in the actor.- Returns:
- The input list.
-
isInputWidget
public static boolean isInputWidget(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the given actor is an input widget.- Parameters:
actor
- The actor.- Returns:
- True if the actor is an input widget.
-
isTooltipWidget
public static boolean isTooltipWidget(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the given actor is a tooltip widget.- Parameters:
actor
- The actor.- Returns:
- True if the actor is a tooltip widget.
-
isNotDisabled
public static boolean isNotDisabled(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the actor is not disabled.- Parameters:
actor
- The actor.- Returns:
- True if the actor is not disabled.
-
hasChangeListener
public static boolean hasChangeListener(com.badlogic.gdx.scenes.scene2d.Actor actor) Check if the actor currently has a change listener attached.- Parameters:
actor
- The actor.- Returns:
- True if the actor has a change listener.
-
isDescendentOf
public static boolean isDescendentOf(com.badlogic.gdx.scenes.scene2d.Actor object, com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup parent) Returns true if the given object is a descendant of the given group.- Parameters:
object
- The object.parent
- The group.- Returns:
- True if the object is in the group.
-