# IContainerParent

`com.jsmacrosce.wagyourgui.containers.IContainerParent`

Parent contract for registering and removing widgets and routing overlays in WagYourGUI containers and screens.  
 ```js
const Client = Java.type("com.jsmacrosce.jsmacros.client.JsMacrosClient");  
const parent = Client.prevScreen;  
if (parent !== null) {
  const host = parent.getFirstOverlayParent();  
  Chat.log(host.getChildOverlay() !== null);  
}
 ```

## Methods

### addRenderableWidget {#com.jsmacrosce.wagyourgui.containers.IContainerParent_addRenderableWidget-T-}

```js
addRenderableWidget(T extends GuiEventListener & Renderable & NarratableEntry renderableWidget): T extends GuiEventListener & Renderable & NarratableEntry
```

Registers a widget with this parent for GUI input, rendering, and narration.  
 Multi-element containers require widgets to extend `AbstractWidget`; other implementations may have different requirements.

**Parameters:**
- `renderableWidget`: widget to register

**Type Parameters:**
- `T`: widget type supporting GUI input, rendering, and narration

**Returns:** the supplied widget reference

### getFirstOverlayParent {#com.jsmacrosce.wagyourgui.containers.IContainerParent_getFirstOverlayParent-}

```js
getFirstOverlayParent(): IOverlayParent
```

Finds the nearest overlay-capable parent in the parent chain.

**Returns:** the nearest overlay-capable parent, or this object when it is already one

### openOverlay {#com.jsmacrosce.wagyourgui.containers.IContainerParent_openOverlay-OverlayContainer-}

```js
openOverlay(OverlayContainer overlay): void
```

Opens an overlay at the deepest available overlay level, disabling that level's existing buttons by default.

**Parameters:**
- `overlay`: overlay to open

### openOverlay {#com.jsmacrosce.wagyourgui.containers.IContainerParent_openOverlay-OverlayContainer-boolean-}

```js
openOverlay(OverlayContainer overlay, boolean disableButtons): void
```

Opens and initializes an overlay at the deepest available overlay level.  
 When `disableButtons` is `true`, the hosting level saves the active states of its existing buttons and disables them; `false` leaves their states unchanged.

**Parameters:**
- `overlay`: overlay to open
- `disableButtons`: whether to save and disable existing buttons at the level hosting the new overlay

### removeWidget {#com.jsmacrosce.wagyourgui.containers.IContainerParent_removeWidget-GuiEventListener-}

```js
removeWidget(GuiEventListener button): void
```

Unregisters a widget through this parent hierarchy.

**Parameters:**
- `button`: widget to remove
