agg_gui/widgets/popup/mod.rs
1//! A thin popup abstraction layered on top of the menu system.
2//!
3//! The framework already ships a full popup implementation inside
4//! [`super::menu`]: `PopupMenu`/`PopupMenuState` handle overlay painting, hit
5//! testing, keyboard navigation, submenu cascades, and dismiss-on-outside. What
6//! that system deliberately does *not* offer is arbitrary anchor placement —
7//! its popups always open left-aligned and extend straight up or down from a
8//! bar or a click point.
9//!
10//! This module fills exactly that gap, and nothing more:
11//!
12//! - [`RectAlign`] / [`Align2`] / [`Align`] — parent/child anchor placement math
13//! (egui's `RectAlign`), with named presets and a pixel gap. Pure functions,
14//! unit-tested against production code.
15//! - [`Popup`] — a content-agnostic controller owning open-state, anchor,
16//! placement, gap, and [`PopupCloseBehavior`]. A host widget supplies the
17//! content and painting.
18//!
19//! For nested-menu content, reuse [`PopupMenu`](super::menu::PopupMenu) rather
20//! than growing this module — its submenu mechanism is the intended way to nest.
21
22pub mod align;
23pub mod behavior;
24
25pub use align::{clamp_rect, Align, Align2, RectAlign};
26pub use behavior::{Popup, PopupClickOutcome, PopupCloseBehavior};