Expand description
Window — a floating, draggable, resizable panel with a title bar.
§Usage
Create a Window and place it as the last child of a [Stack] so it
paints on top of everything and receives hit-test priority.
let win = Window::new("Inspector", font, Box::new(my_content));
Stack::new()
.add(Box::new(main_ui))
.add(Box::new(win))§Features
- Drag — click-drag the title bar to move the window.
- Resize — drag any of the 8 edges/corners to resize; min size 120×80.
- Collapse — click the chevron on the left of the title bar to collapse to title-bar-only height (click again to expand).
- Maximize — double-click the title bar (or click the maximize button) to toggle between maximised and restored size.
- Close — click the × button; syncs with an optional shared
visible_cell.
§⚠ Backbuffer caching gotcha — read before adding a custom Window
Window retains its painted pixels in a GL FBO (or CPU bitmap) and only
re-rasterises on widget setter mutations (Label::set_text, hover changes,
etc.). Custom paint code that reads from an Rc<RefCell<…>> model the
framework can’t observe — telemetry graphs, sensor streams, simulation
views — will blit stale pixels forever unless you tell the window to
invalidate. Two ways:
.with_live_content(true)— Window self-invalidates every frame (auto-skipped when collapsed or hidden). Use for streaming data.Window::invalidate_backbuffer— manual flag from the data-arrival path. Use when invalidation is sparse and you want frame-skip when nothing changed.
See Window::new for the full discussion.
§Coordinate notes (Y-up)
bounds stores the window’s position in its parent’s coordinate space.
The title bar is at the top of the window, i.e. local Y ∈
[height − TITLE_H .. height]. The content area fills local Y ∈ [0 .. height − TITLE_H].
Re-exports§
pub use chrome::paint_chevron;pub use chrome::paint_chrome_body;pub use chrome::paint_chrome_border;pub use chrome::paint_chrome_shadow;pub use chrome::paint_chrome_title_bar;pub use chrome::ChromeStyle;
Modules§
- chrome
- Reusable paint helpers for window-style chrome — shadow halo, rounded body fill, title-bar fill, collapse chevron, outer border.
Structs§
- Window
- A floating panel with a draggable/resizable title bar and a single content child.