Class Tabs

java.lang.Object
me.hackware.api.gui.studio.Tabs

public final class Tabs extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Row height and horizontal label padding, from the shared tab constants.
    static final int
    Horizontal pill inset from the (touching) tab box — makes the pills look spaced.
    static final int
     
    static final int
    Hover-pill / ripple height (both bars).
    static final int
    Hover-pill / ripple corner radius in logical units.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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 before Tab.draw(net.minecraft.client.gui.GuiGraphics, net.minecraft.client.gui.Font, java.lang.String, int, int, int, boolean, float)), inset into a pill.
    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 a rowH-tall row at top, nudged down by yOffset (e.g.
    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.
    static int
    radiusPx(double res)
    RADIUS converted to physical pixels for the given res (physical-per-logical).
    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 the tabX,tabY,tabW,rowH box).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HEIGHT

      public static final int HEIGHT
      Row 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_X
      Horizontal pill inset from the (touching) tab box — makes the pills look spaced.
      See Also:
    • PILL_HEIGHT

      public static final int PILL_HEIGHT
      Hover-pill / ripple height (both bars). Fixed and independent of HEIGHT so 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 RADIUS
      Hover-pill / ripple corner radius in logical units. Scaled to physical pixels by the GUI res at draw time (see radiusPx(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)
      RADIUS converted 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 a rowH-tall row at top, nudged down by yOffset (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 the tabX,tabY,tabW,rowH box).
    • 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 before Tab.draw(net.minecraft.client.gui.GuiGraphics, net.minecraft.client.gui.Font, java.lang.String, int, int, int, boolean, float)), inset into a pill.
      • barHovered drives visibility: the pill fades in while the pointer is anywhere over the bar and fades out once the whole bar loses focus.
      • tabHovered drives 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.