TabsHandle
classclient uniquementdepuis 0.1.0com.galdurstudio.galdurui.api.window.TabsHandle
Pas encore traduit : texte d’origine en anglais.
Handle to a tab row of a GaldurWindow: its tabs and the active tab.
Returned by GaldurWindow.addTabs(). Each addTab() returns a
TabHandle, filled like a window. The first tab added starts active.
TabsHandle tabs = window.addTabs(true);TabHandle storage = tabs.addTab(Component.literal("Storage"));TabHandle autocraft = tabs.addTab(Component.literal("Autocraft"));tabs.onSelect(index -> System.out.println("Tab: " + index));autocraft.select(); // or tabs.setSelected(1)As with ListHandle, the state lives here, not in the shown widget: the active tab
survives resizes, and each tab's content (search text, list scroll...) is kept when switching
tabs.
Like any ElementHandle, the row can be disabled, hidden or given a tooltip:
- disabled, tabs can no longer be switched, and the shown content is disabled too;
- hidden, it disappears with all its content and frees its space;
- its tooltip shows only when the tab row is hovered, not on the content.
Call on the client thread.
MEMBRES · 11
Méthodes 11
addTab
Adds a tab to the right of the others and returns its handle, used to fill its content.
PARAMÈTRES
RENVOIETabHandle — the tab handle
getTabs
RENVOIEList<TabHandle> — the tabs, in order, read-only; the view follows additions
getSelected
RENVOIEint — the index of the active tab, or -1 if there is no tab yet
setSelected
Makes a tab active. When the value really changes, its content replaces the old one on the
next frame and the action given to onSelect() is called, whether the
change comes from the player or from code.
PARAMÈTRES
onSelect
Sets the action called when the active tab changes. Only one action is kept: a new call replaces the previous one. It receives the index of the new active tab.
PARAMÈTRES
setEnabled
de ElementHandleEnables or disables the element. No effect if it is already in that state.
PARAMÈTRES
false to disable itisEnabled
de ElementHandleRENVOIEboolean — true if the element is enabled (the default)
setVisible
de ElementHandleShows or hides the element. Hidden, it frees its space in the window. No effect if it is already in that state.
PARAMÈTRES
false to hide itisVisible
de ElementHandleRENVOIEboolean — true if the element is shown (the default)
setTooltip
de ElementHandleSets the text shown when the element is hovered.
PARAMÈTRES
null to remove itgetTooltip
de ElementHandleRENVOIEComponent — the tooltip text, or null if none