Package me.hackware.api.gui.studio
Class Tabs
java.lang.Object
me.hackware.api.gui.studio.Tabs
A tab strip (Vercel-style), shared so every tab bar renders identically: the top
TabBarSystem bar and in-screen sub-tab bars (e.g. the Statistics category
selector) both lay out Tabs edge-to-edge (contiguous hitboxes, no dead
gaps), draw a single rounded hover background that slides across them, and mark
the active tab with an accent underline.
The hover pill and press ripple are inset by INSET_X horizontally and a fixed
PILL_HEIGHT centred vertically, so they read as separated pills even though the
clickable tabs touch. Holds the sliding hover-pill state, so each bar owns its own Tabs
instance. The design tokens (HEIGHT, PADDING_H) live here and are
read by Tab. The host owns layout, the sliding-indicator floats and the
Ripple.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRow height and horizontal label padding, from the shared tab constants.static final intHorizontal pill inset from the (touching) tab box — makes the pills look spaced.static final intstatic final intHover-pill / ripple height (both bars).static final intHover-pill / ripple corner radius in logical units. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawHoverPill(UiContext ui, boolean barHovered, boolean tabHovered, int hovX, int hovY, int hovW, int rowH, float opacity) Animates the single rounded hover background and draws it (behind the labels — call beforeTab.draw(net.minecraft.client.gui.GuiGraphics, net.minecraft.client.gui.Font, java.lang.String, int, int, int, boolean, float)), inset into a pill.static voiddrawIndicator(net.minecraft.client.gui.GuiGraphics g, int left, int right, int top, int rowH, int yOffset, float opacity) The accent underline indicator spanning[left, right)at the bottom of arowH-tall row attop, nudged down byyOffset(e.g.static voiddrawIndicator(net.minecraft.client.gui.GuiGraphics g, int left, int right, int top, int rowH, int yOffset, float opacity, int color) As above but with an explicit indicator colour (e.g.static intradiusPx(double res) RADIUSconverted to physical pixels for the given res (physical-per-logical).static voidtriggerRipple(Ripple ripple, int tabX, int tabY, int tabW, int rowH, double res, double clickX, double clickY) Fires a press ripple clipped to the tab's pill (a compact pill centred in thetabX,tabY,tabW,rowHbox).
-
Field Details
-
HEIGHT
public static final int HEIGHTRow height and horizontal label padding, from the shared tab constants. -
PADDING_H
public static final int PADDING_H -
INSET_X
public static final int INSET_XHorizontal pill inset from the (touching) tab box — makes the pills look spaced.- See Also:
-
PILL_HEIGHT
public static final int PILL_HEIGHTHover-pill / ripple height (both bars). Fixed and independent ofHEIGHTso the main bar can grow taller without resizing the pill; the pill is centred in each bar's row, and the extra row height becomes outer margin.- See Also:
-
RADIUS
public static final int RADIUSHover-pill / ripple corner radius in logical units. Scaled to physical pixels by the GUI res at draw time (seeradiusPx(double)) so the tabs read equally round on any display / GUI scale — a fixed physical radius looks super round at low res and barely round on a high-DPI (Retina) screen.- See Also:
-
-
Constructor Details
-
Tabs
public Tabs()
-
-
Method Details
-
radiusPx
public static int radiusPx(double res) RADIUSconverted to physical pixels for the given res (physical-per-logical). -
drawIndicator
public static void drawIndicator(net.minecraft.client.gui.GuiGraphics g, int left, int right, int top, int rowH, int yOffset, float opacity) The accent underline indicator spanning[left, right)at the bottom of arowH-tall row attop, nudged down byyOffset(e.g. to sit on the bar's bottom border below any bottom padding). -
drawIndicator
public static void drawIndicator(net.minecraft.client.gui.GuiGraphics g, int left, int right, int top, int rowH, int yOffset, float opacity, int color) As above but with an explicit indicator colour (e.g. the Relations selector's friend/enemy tints). -
triggerRipple
public static void triggerRipple(Ripple ripple, int tabX, int tabY, int tabW, int rowH, double res, double clickX, double clickY) Fires a press ripple clipped to the tab's pill (a compact pill centred in thetabX,tabY,tabW,rowHbox). -
drawHoverPill
public void drawHoverPill(UiContext ui, boolean barHovered, boolean tabHovered, int hovX, int hovY, int hovW, int rowH, float opacity) Animates the single rounded hover background and draws it (behind the labels — call beforeTab.draw(net.minecraft.client.gui.GuiGraphics, net.minecraft.client.gui.Font, java.lang.String, int, int, int, boolean, float)), inset into a pill.barHovereddrives visibility: the pill fades in while the pointer is anywhere over the bar and fades out once the whole bar loses focus.tabHovereddrives the slide: while the pointer is over a specific tab (hovX,hovY,hovW) the pill glides to it; between tabs / over bar padding it holds its last spot. Re-entering after a fade pops it in at the new tab rather than sliding across from a stale one.
-