Skip to main content

Module chrome

Module chrome 

Source
Expand description

Reusable paint helpers for window-style chrome — shadow halo, rounded body fill, title-bar fill, collapse chevron, outer border.

Why this module exists: the Window widget owns a lot of behaviour (drag, resize, maximize, close, snap, backbuffer) that other “framed” UI elements don’t want. AtomArtist’s node editor — and any other consumer that wants the same drop-shadow + rounded-corner look — can call these stateless paint functions directly without inheriting the rest of Window.

All coords are local to the framed region (origin at bottom-left, Y-up — agg-gui convention). The caller is responsible for translating the DrawCtx into the frame’s local space before invoking these helpers.

Structs§

ChromeStyle
Geometry + colour bundle for a window-style frame. Construct one per paint pass; default presets come from ChromeStyle::from_visuals (matches the live Window widget exactly).

Functions§

paint_chevron
Paint the collapse / expand chevron at (cx, cy) in the active DrawCtx space. Half-size 4 px. Iconography matches conventional UIs: ▸ when collapsed (click to expand), ▾ when expanded (click to collapse). agg-gui is Y-up, so “▾” has its apex at the LOWER y.
paint_chrome_body
Paint the rounded body fill. When collapsed is true the body occupies the full h with all four corners rounded; otherwise the title-bar strip at the top is excluded (the caller paints that separately so the top corner radius reads as one shape, no overlapping fills).
paint_chrome_border
Stroked outer border that frames body + title together.
paint_chrome_shadow
Paint the stacked-rounded-rect drop shadow that frames a window. Drawn outside-in so the denser core overlays the softer halo.
paint_chrome_title_bar
Paint the title-bar fill + 1-px bottom separator + title label. Does not paint the chevron or any buttons — those are real child widgets (crate::widgets::ChevronWidget et al.) the caller composes into the title bar’s child list. This keeps interaction (click + hover + focus) flowing through the standard parent/child event dispatch instead of manual coordinate hit-tests.