Skip to main content

Module window

Module window 

Source
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.

§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].

Structs§

Window
A floating panel with a draggable/resizable title bar and a single content child.