Skip to content

OverlayContainer ​

com.jsmacrosce.wagyourgui.overlays.OverlayContainer

A container that hosts nested overlays and delegates overlay operations through its parent.

Constructors ​

new OverlayContainer ​

new OverlayContainer(int x, int y, int width, int height, Font textRenderer, IOverlayParent parent)#
Stores the overlay geometry, font, and parent without initializing, opening or registering widgets.

Parameters:

  • x: left coordinate in GUI space
  • y: top coordinate in GUI space
  • width: width in GUI units
  • height: height in GUI units
  • textRenderer: non-null font for subclass use
  • parent: non-null parent for widget registration and overlay routing

Fields ​

savedBtnStates ​

savedBtnStates: Map<AbstractWidget, Boolean>#
Mutable, replaceable map of hosting widgets to their saved active states, populated by standard hosts when opening this overlay with button disabling enabled. Opening merges entries; initialization and closing do not clear them. Keep the map and stored Boolean values non-null for restoration. Changes affect later restoration, but do not register widgets or immediately change their active states.

scroll ​

scroll: Scrollbar#
Optional scroll control, initially null, used by standard screen hosts to forward wheel input to their direct overlay. Assigning it does not register or replace widgets.

Methods ​

close ​

close(): void#
Requests that this overlay be closed through its parent.

closeOverlay ​

closeOverlay(OverlayContainer overlay): void#
Closes the matching direct child overlay, removes its buttons, restores saved active states, and calls its onClose() hook.

Parameters:

  • overlay: the direct child overlay to close

getChildOverlay ​

getChildOverlay(): OverlayContainer#
Returns the deepest child overlay, or this container when it has no child.
Returns: the deepest child overlay, or this container if there is no child

getFirstOverlayParent ​

getFirstOverlayParent(): IOverlayParent#
Returns this container as the first overlay parent.
Returns: this overlay container

keyPressed ​

keyPressed(int keyCode, int scanCode, int modifiers): boolean#
Forwards the key press to this container's child overlay, if present; this method always returns false.

Parameters:

  • keyCode: the key code
  • scanCode: the scan code
  • modifiers: the modifier flags
Returns: false

onClick ​

onClick(double mouseX, double mouseY, int button): void#
Forwards the click to this container's direct child overlay, if present; otherwise does nothing.

Parameters:

  • mouseX: mouse x-coordinate in GUI space
  • mouseY: mouse y-coordinate in GUI space
  • button: mouse-button code forwarded unchanged

onClose ​

onClose(): void#
No-op extension hook called by standard hosts after widget removal and active-state restoration, before clearing the matching child reference. This base implementation does not close the overlay or clear its tracked widgets, saved states or child reference.

openOverlay ​

openOverlay(OverlayContainer overlay): void#
Opens the child overlay, disabling this container's buttons by default.

Parameters:

  • overlay: the child overlay to open
openOverlay(OverlayContainer overlay, boolean disableButtons): void#
Opens a child overlay at the deepest open level; optionally disables this container's buttons and saves their active states.

Parameters:

  • overlay: the child overlay to open
  • disableButtons: whether to disable this container's buttons and save their active states

removeWidget ​

removeWidget(GuiEventListener btn): void#
Removes the first matching local tracked entry, then delegates the widget to the parent even if it was not tracked locally. Duplicate local entries can remain; a parent failure does not roll back the local removal.

Parameters:

  • btn: widget or listener to remove

render ​

render(GuiGraphics drawContext, int mouseX, int mouseY, float delta): void#
Renders tracked widgets in live list order, then this container's direct child overlay if present. Does not render the background automatically or check the stored container visibility flag; each widget applies its own rendering behavior.

Parameters:

  • drawContext: graphics context passed to widgets and the child overlay
  • mouseX: mouse x-coordinate in GUI space
  • mouseY: mouse y-coordinate in GUI space
  • delta: frame value forwarded to widgets and the child overlay

renderBackground ​

renderBackground(GuiGraphics drawContext): void#
Submits a black background and gray outer and white inner one-unit border fills at the stored geometry. Does not render widgets or child overlays, or check the stored container visibility flag.

Parameters:

  • drawContext: graphics context receiving the fill operations

setFocused ​

setFocused(GuiEventListener focused): void#
Forwards the focus target unchanged to the parent; null is forwarded to clear focus.

Parameters:

  • focused: listener to focus, or null to clear focus