Class Collapsible
java.lang.Object
dev.myriadclient.api.ui.widget.Widget
dev.myriadclient.api.ui.widget.Collapsible
A titled section whose body can be folded away: click the header (or Enter, or h/l with the keyboard selection on
it) to fold or unfold it, with an animation. Folded, the body takes no room and gets no input.
VBox body = new VBox(2, 0);
body.add(new Label("Inside"));
content.add(new Collapsible("Advanced", body).indent(10).hint(() -> "1"));
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCollapsible(String title, Widget body) A section that starts unfolded and remembers its state itself (until the widgets are rebuilt).Collapsible(Supplier<String> title, Widget body, Supplier<Boolean> expanded, Consumer<Boolean> setExpanded) A section whose folded state lives elsewhere (a setting group's, say):expandedis read every frame andsetExpandedcalled when the player folds or unfolds it. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Enter/Space on the selected widget.booleanadjust(int direction) h/l or Left/Right on the selected widget: -1 or +1.voidcollectNavigable(List<Widget> out) Adds the navigable widgets currently on screen, in visual order.Dim text at the right of the header (e.g.indent(float indent) Indents the body byindentUI units and draws a guide line down its left edge, so nested sections read as a tree.booleanWhether the keyboard selection (j/k, arrows) can land on this widget.protected floatCompute height forwidthand position children.booleanmouseClicked(float mx, float my, int button) A mouse press at (mouseX,mouseY);buttonis a GLFW button (InputConstants.MOUSE_BUTTON_*).booleanmouseScrolled(float mx, float my, float amount) The wheel,amountnotches (positive turning up), while over the widget.floatNavigation only reaches the header's own row.voidDraws the widget within its box (Widget.x,Widget.y,Widget.width,Widget.height), with the mouse in the same coordinates (far off screen while the pointer is outside the panel or a scroll view's viewport).Methods inherited from class Widget
activateSecondary, attachChild, badgeLine, blur, charTyped, focus, height, isFocused, isHovered, isVisible, keyPressed, layout, minWidth, mouseDragged, mouseReleased, offerTooltip, onBlur, press, theme, tooltip, visible, width, x, y
-
Constructor Details
-
Collapsible
-
Collapsible
-
-
Method Details
-
indent
Indents the body byindentUI units and draws a guide line down its left edge, so nested sections read as a tree. Returns this section. -
hint
Dim text at the right of the header (e.g. how many settings the section holds), asked every frame; null or empty shows none. It gives way to the title in a narrow window. Returns this section. -
measure
-
render
Description copied from class:WidgetDraws the widget within its box (Widget.x,Widget.y,Widget.width,Widget.height), with the mouse in the same coordinates (far off screen while the pointer is outside the panel or a scroll view's viewport). Called every frame afterWidget.layout(Canvas, float, float, float), only while visible. -
mouseClicked
public boolean mouseClicked(float mx, float my, int button) Description copied from class:WidgetA mouse press at (mouseX,mouseY);buttonis a GLFW button (InputConstants.MOUSE_BUTTON_*). Presses go to every visible widget in turn until one returns true, so checkWidget.isHovered(float, float)first. Returning true makes this widget receive the drags and the release.- Overrides:
mouseClickedin classWidget
-
activate
-
adjust
-
mouseScrolled
public boolean mouseScrolled(float mx, float my, float amount) Description copied from class:WidgetThe wheel,amountnotches (positive turning up), while over the widget. Return true to use it; otherwise the enclosing scroll view scrolls.- Overrides:
mouseScrolledin classWidget
-