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 spacey: top coordinate in GUI spacewidth: width in GUI unitsheight: height in GUI unitstextRenderer: non-null font for subclass useparent: 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
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
onClick
onClick(MouseButtonEvent buttonEvent, boolean doubleClick): void#Forwards the click to this container's direct child overlay, if present; otherwise does nothing.
Parameters:
buttonEvent: native click event forwarded unchanged to the childdoubleClick: caller-supplied double-click flag forwarded unchanged; not computed here
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 opendisableButtons: 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 overlaymouseX: mouse x-coordinate in GUI spacemouseY: mouse y-coordinate in GUI spacedelta: 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, ornullto clear focus