public class VerticalUiNavigation extends java.lang.Object implements UiNavigation
UiNavigation
implementation that treats all UiElement
s as
stacked verticallyConstructor and Description |
---|
VerticalUiNavigation() |
Modifier and Type | Method and Description |
---|---|
void |
add(Actionable actionable)
Adds a
Actionable to end of the navigation |
Actionable |
getCursor()
Returns the
Actionable highlighted by the cursor |
void |
layout(ScreenSize screenSize)
Re-orders elements based on screen size if necessary
|
Actionable |
navigate(int keycode)
Update (if required) navigation from key input
|
void |
onHoverBegin(Hoverable source)
Called when the mouse begins hovering a
Hoverable |
void |
onHoverEnd(Hoverable source)
Called when the mouse finishes hovering a
Hoverable |
void |
remove(Actionable actionable)
Removes a
Actionable from the navigation and shifts any following
Actionable s by 1 place |
void |
removeAll()
Removes all
Actionable instances from the navigation |
Actionable |
resetCursor()
Resets the selection back to the first
Actionable |
Actionable |
resetCursor(boolean triggerHoverEvent)
Resets the selection back to the first
Actionable |
void |
set(int index,
Actionable actionable)
Replace an
Actionable at a specific index |
public void add(Actionable actionable)
UiNavigation
Actionable
to end of the navigationadd
in interface UiNavigation
actionable
- The Actionable
to addpublic void remove(Actionable actionable)
UiNavigation
Actionable
from the navigation and shifts any following
Actionable
s by 1 placeremove
in interface UiNavigation
actionable
- The Actionable
to removepublic void removeAll()
UiNavigation
Actionable
instances from the navigationremoveAll
in interface UiNavigation
public void set(int index, Actionable actionable)
UiNavigation
Actionable
at a specific indexset
in interface UiNavigation
index
- The index to replaceactionable
- The new Actionable
public Actionable navigate(int keycode)
UiNavigation
navigate
in interface UiNavigation
keycode
- The key that was pressedActionable
public Actionable resetCursor()
UiNavigation
Actionable
resetCursor
in interface UiNavigation
Actionable
public Actionable resetCursor(boolean triggerHoverEvent)
UiNavigation
Actionable
resetCursor
in interface UiNavigation
triggerHoverEvent
- True if a hover event should be triggered. Typically used when a gamepad is being used for navigation.Actionable
public Actionable getCursor()
UiNavigation
Actionable
highlighted by the cursorgetCursor
in interface UiNavigation
Actionable
public void layout(ScreenSize screenSize)
UiNavigation
layout
in interface UiNavigation
screenSize
- The current ScreenSize
public void onHoverBegin(Hoverable source)
HoverListener
Hoverable
onHoverBegin
in interface HoverListener
source
- The Hoverable
that the mouse began hoveringpublic void onHoverEnd(Hoverable source)
HoverListener
Hoverable
onHoverEnd
in interface HoverListener
source
- The Hoverable
that the mouse finished hovering