public class TabView extends ParentUiElement implements Navigatable
UiElement
of tabs that can be switched between by the playerModifier and Type | Field and Description |
---|---|
protected org.mini2Dx.gdx.utils.Array<Tab> |
tabs |
asyncRemoveAll, children, renderNode
deferredLayout, deferredRender, deferredUpdate, effects, height, styleId, visibility, width, x, y, zIndex
Constructor and Description |
---|
TabView()
Constructor.
|
TabView(java.lang.String id)
Constructor
|
TabView(java.lang.String id,
float x,
float y,
float width,
float height)
Constructor
|
TabView(java.lang.String id,
float x,
float y,
float width,
float height,
TabButton previousTabButton,
TabButton nextTabButton)
Constructor
|
TabView(java.lang.String id,
TabButton previousTabButton,
TabButton nextTabButton)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Tab tab)
|
void |
add(Tab tab)
|
void |
clearGamePadHotkeys()
Unmaps all gamepad hotkeys
|
void |
clearHotkeys()
Unmaps all hotkeys
|
void |
clearKeyboardHotkeys()
Unmaps all keyboard hotkeys
|
boolean |
containsTab(Tab tab)
|
protected ParentRenderNode<?,?> |
createRenderNode(ParentRenderNode<?,?> parent)
Creates the
ParentRenderNode for this UiElement |
Tab |
getCurrentTab()
Returns the currently visible
Tab |
int |
getCurrentTabIndex()
Returns the index of the currently visible
Tab |
UiElement |
getElementById(java.lang.String id)
Searches the UI for a
UiElement with a given id. |
UiNavigation |
getNavigation()
Returns the
UiNavigation currently being navigated |
TabButton |
getNextTabButton() |
TabButton |
getPreviousTabButton() |
StyleRule |
getStyleRule() |
Tab |
getTab(int index)
Returns the
Tab at a specific index |
int |
getTotalTabs()
Returns the total number of tabs in this
TabView |
ActionableRenderNode |
hotkey(GamePadButton button)
Returns the corresponding
ActionableRenderNode mapped to a GamePadButton hotkey |
ActionableRenderNode |
hotkey(int keycode)
Returns the corresponding
ActionableRenderNode mapped to a keyboard hotkey |
ActionableRenderNode |
navigate(int keycode)
Triggers a navigation and returns the newly highlighted
ActionableRenderNode |
void |
nextTab()
Navigates to the next
Tab . |
void |
previousTab()
Navigates to the previous
Tab . |
Tab |
remove(int index)
|
boolean |
remove(Tab tab)
|
void |
setCurrentTab(Tab tab)
Sets the currently visible
Tab |
void |
setCurrentTabIndex(int currentTabIndex)
Sets the currently visible
Tab |
void |
setHotkey(GamePadButton button,
Actionable actionable)
Maps a
GamePadButton to a Actionable |
void |
setHotkey(int keycode,
Actionable actionable)
Maps a keyboard button to a
Actionable |
void |
setNextTabButtonLayout(java.lang.String flexLayout) |
void |
setNextTabHotkey(GamePadButton button)
Sets a
GamePadButton as the hotkey for changing to the next tab |
void |
setNextTabHotkey(int keycode)
Sets a keyboard key as the hotkey for changing to the next tab
|
void |
setPreviousTabButtonLayout(java.lang.String flexLayout) |
void |
setPreviousTabHotkey(GamePadButton button)
Sets a
GamePadButton as the hotkey for changing to the previous tab |
void |
setPreviousTabHotkey(int keycode)
Sets a keyboard key as the hotkey for changing to the previous tab
|
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setTabButtonLayout(java.lang.String flexLayout) |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithLayout(UiContainerRenderTree rootNode)
Syncs data between the
UiElement and RenderNode during UI layout |
void |
syncWithUpdate(UiContainerRenderTree rootNode)
Syncs data between the
UiElement and RenderNode during update |
void |
unsetHotkey(GamePadButton button)
Unmaps a
GamePadButton hotkey |
void |
unsetHotkey(int keycode)
Unmaps a keyboard hotkey
|
void |
unsetNextTabHotkey(GamePadButton button)
Unets a
GamePadButton as the hotkey for changing to the next tab |
void |
unsetNextTabHotkey(int keycode)
Unsets a keyboard key as the hotkey for changing to the next tab
|
void |
unsetPreviousTabHotkey(GamePadButton button)
Unets a
GamePadButton as the hotkey for changing to the previous tab |
void |
unsetPreviousTabHotkey(int keycode)
Unsets a keyboard key as the hotkey for changing to the previous tab
|
add, add, attach, detach, get, getChild, getFlexLayout, getRenderHeight, getRenderWidth, getRenderX, getRenderY, getTotalChildren, invokeBeginHover, invokeEndHover, isFlexLayout, isInitialLayoutOccurred, isInitialUpdateOccurred, isOverflowClipped, isRenderNodeDirty, remove, removeAll, removeAllAsync, setFlex, setFlexLayout, setHeightFlex, setOverflowClipped, setRenderNodeDirty, setWidthFlex, setXFlex, setXYFlex, setYFlex, shrinkToContents, shrinkToContents
addEffectListener, addHoverListener, addNodeStateListener, alignAbove, alignBelow, alignEdgeToEdge, alignLeftOf, alignRightOf, applyEffect, deferUntilLayout, deferUntilLayout, deferUntilRender, deferUntilRender, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, equals, getContentHeight, getContentWidth, getHeight, getId, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getStyleId, getVisibility, getWidth, getX, getY, getZIndex, hashCode, isDebugEnabled, isInitialised, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, notifyNodeStateListeners, removeEffectListener, removeHoverListener, removeNodeStateListener, set, setContentHeight, setContentWidth, setDebugEnabled, setHeight, setHeightToContentHeightOf, setHeightToHeightOf, setWidth, setWidthToContentWidthOf, setWidthToWidthOf, setX, setXY, setY, snapTo, snapTo, syncWithRender
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getId
protected final org.mini2Dx.gdx.utils.Array<Tab> tabs
public TabView()
TabView
public TabView(java.lang.String id)
id
- The unique ID of this TabView
public TabView(java.lang.String id, float x, float y, float width, float height)
id
- The unique ID for this element (if null an ID will be generated)x
- The x coordinate of this element relative to its parenty
- The y coordinate of this element relative to its parentwidth
- The width of this elementheight
- The height of this elementpublic TabView(java.lang.String id, TabButton previousTabButton, TabButton nextTabButton)
public TabView(java.lang.String id, float x, float y, float width, float height, TabButton previousTabButton, TabButton nextTabButton)
id
- The unique ID of this TabView
x
- The x coordinate of this element relative to its parenty
- The y coordinate of this element relative to its parentwidth
- The width of this elementheight
- The height of this elementpreviousTabButton
- The TabButton
to use for changing to the previous tabnextTabButton
- The TabButton
to use for changing to the next tabpublic void add(int index, Tab tab)
index
- The index to insert attab
- The Tab
to insertpublic boolean remove(Tab tab)
public Tab remove(int index)
remove
in class ParentUiElement
index
- The index to removeTab
that was removedpublic boolean containsTab(Tab tab)
public int getTotalTabs()
TabView
Tab
s have been addedpublic void syncWithLayout(UiContainerRenderTree rootNode)
UiElement
UiElement
and RenderNode
during UI layoutsyncWithLayout
in class UiElement
public void syncWithUpdate(UiContainerRenderTree rootNode)
UiElement
UiElement
and RenderNode
during updatesyncWithUpdate
in class ParentUiElement
protected ParentRenderNode<?,?> createRenderNode(ParentRenderNode<?,?> parent)
ParentUiElement
ParentRenderNode
for this UiElement
createRenderNode
in class ParentUiElement
parent
- The parent of this nodeParentRenderNode
public void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class ParentUiElement
visibility
- The Visibility
to setpublic void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class ParentUiElement
styleId
- The style id to setpublic void setZIndex(int zIndex)
UiElement
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)setZIndex
in class ParentUiElement
zIndex
- The Z indexpublic StyleRule getStyleRule()
getStyleRule
in class UiElement
public Tab getCurrentTab()
Tab
Tab
is visiblepublic int getCurrentTabIndex()
Tab
public void setCurrentTabIndex(int currentTabIndex)
Tab
currentTabIndex
- The index of the Tab
public void nextTab()
Tab
. If the current tab is the last tab,
this will loop back to the first tab.public void previousTab()
Tab
. If the current tab is the first
tab, this will loop to the last tab.public ActionableRenderNode navigate(int keycode)
Navigatable
ActionableRenderNode
navigate
in interface Navigatable
keycode
- The navigation Input.Keys
valueUiNavigation
is availablepublic ActionableRenderNode hotkey(int keycode)
Navigatable
ActionableRenderNode
mapped to a keyboard hotkeyhotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeypublic ActionableRenderNode hotkey(GamePadButton button)
Navigatable
ActionableRenderNode
mapped to a GamePadButton
hotkeyhotkey
in interface Navigatable
button
- The GamePadButton
that is the hotkeypublic UiNavigation getNavigation()
Navigatable
UiNavigation
currently being navigatedgetNavigation
in interface Navigatable
public void setPreviousTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void setPreviousTabHotkey(GamePadButton button)
GamePadButton
as the hotkey for changing to the previous tabbutton
- The GamePadButton
public void setNextTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void setNextTabHotkey(GamePadButton button)
GamePadButton
as the hotkey for changing to the next tabbutton
- The GamePadButton
public void unsetPreviousTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void unsetPreviousTabHotkey(GamePadButton button)
GamePadButton
as the hotkey for changing to the previous tabbutton
- The GamePadButton
public void unsetNextTabHotkey(int keycode)
keycode
- The Input.Keys
keycodepublic void unsetNextTabHotkey(GamePadButton button)
GamePadButton
as the hotkey for changing to the next tabbutton
- The GamePadButton
public void setHotkey(GamePadButton button, Actionable actionable)
Navigatable
GamePadButton
to a Actionable
setHotkey
in interface Navigatable
button
- The GamePadButton
that is the hotkeyactionable
- The Actionable
to trigger when the hotkey is pressedpublic void setHotkey(int keycode, Actionable actionable)
Navigatable
Actionable
setHotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeyactionable
- The Actionable
to trigger when the key is pressedpublic void unsetHotkey(GamePadButton button)
Navigatable
GamePadButton
hotkeyunsetHotkey
in interface Navigatable
button
- The GamePadButton
that is the hotkeypublic void unsetHotkey(int keycode)
Navigatable
unsetHotkey
in interface Navigatable
keycode
- The Input.Keys
keycode that is the hotkeypublic void clearGamePadHotkeys()
Navigatable
clearGamePadHotkeys
in interface Navigatable
public void clearKeyboardHotkeys()
Navigatable
clearKeyboardHotkeys
in interface Navigatable
public void clearHotkeys()
Navigatable
clearHotkeys
in interface Navigatable
public void setPreviousTabButtonLayout(java.lang.String flexLayout)
public void setNextTabButtonLayout(java.lang.String flexLayout)
public void setTabButtonLayout(java.lang.String flexLayout)
public TabButton getPreviousTabButton()
public TabButton getNextTabButton()
public UiElement getElementById(java.lang.String id)
UiElement
UiElement
with a given id. Warning: This
can be an expensive operation for complex UIs. It is recommended you
cache results.getElementById
in class ParentUiElement
id
- The UiElement
identifier to search forUiElement
with the given id