Skip to content

OverlayLayer

Full-screen overlay root managing modal backdrops, dialogs, popups, and layer-based hit testing.

Overview

OverlayLayer is a top-level container dedicated to rendering floating visual elements above standard UI widgets.

Responsibilities: - Hosts popups, dropdowns, context menus, tooltips, and floating windows. - Manages modal scrim dimming backdrops with customizable renderers and colors. - Routes mouse and keyboard input with layer-aware hit testing and outside-click dismissal. - Integrates with WindowManager for desktop window hierarchies.

Hosting Overlays and Floating Widgets

OverlayLayer overlay = new OverlayLayer(mainContent);
overlay.addOverlay(toastWidget);
  • WindowManager: Manager controlling floating window z-order, focus stack, active states, and desktop window arrangements.
  • WindowWidget: Desktop-style floating window widget supporting title bar, dragging, resizing, collapse, modal dialogs, and docking integrations.

API

OverlayLayer()

Constructs an empty OverlayLayer.

OverlayLayer(Widget)

Constructs an OverlayLayer hosting the specified base content widget.

Parameter Type Description
content Widget Content widget hosted inside.

OverlayLayer::addOverlay(Widget)

Adds a floating widget to the top of the overlay layer.

Parameter Type Description
overlay Widget Floating overlay widget to add or remove.

Returns OverlayLayer: This widget instance for chaining..

OverlayLayer::applyQueuedMutations()

Flushes pending overlay additions and removals immediately.

OverlayLayer::clearOverlays()

Removes all floating overlays currently displayed.

Returns OverlayLayer: This widget instance for chaining..

OverlayLayer::content()

Returns the primary base content widget hosted underneath all overlays.

Returns Widget: The hosted content widget..

OverlayLayer::content(Widget)

Replaces the primary base content widget.

Parameter Type Description
content Widget Content widget hosted inside.

Returns OverlayLayer: This widget instance for chaining..

OverlayLayer::modalScrimColor()

Returns the mutable background scrim tint color displayed beneath modal dialogs.

Returns MutableColor: Mutable color applied to the modal scrim backdrop..

OverlayLayer::modalScrimRenderer()

Returns the custom modal scrim background renderer, or null if default.

Returns WidgetRender: Custom renderer used for drawing the modal scrim backdrop..

OverlayLayer::modalScrimRenderer(WidgetRender)

Sets a custom modal scrim background renderer.

Parameter Type Description
modalScrimRenderer WidgetRender Custom renderer for drawing the modal scrim dimming backdrop.

Returns OverlayLayer: This widget instance for chaining..

OverlayLayer::removeOverlay(Widget)

Removes a floating widget from the overlay layer.

Parameter Type Description
overlay Widget Floating overlay widget to add or remove.

Returns OverlayLayer: This widget instance for chaining..

OverlayLayer::windowManager()

Synonym returning the WindowManager controller.

Returns WindowManager: The window manager coordinating floating windows in this overlay layer..

OverlayLayer::windows()

Returns the WindowManager controller governing floating windows.

Returns WindowManager: The window manager coordinating floating windows in this overlay layer..