Skip to main content

agg_gui/widgets/property_row/
mod.rs

1//! Reflection-driven property row vocabulary.
2//!
3//! This module owns the shared schema types that describe how a single
4//! editable property should render in a property panel — what widget
5//! to mount, its numeric range / step / decimal-precision, its label,
6//! its description, and whether it belongs to an "advanced" section.
7//!
8//! Living here (in `agg-gui`, not in any host crate) is deliberate. The
9//! schema is **widget vocabulary** — what the panel renderer can do —
10//! not a host-side concept tied to a particular value system. Host
11//! crates (atomartist, MatterCAD-rust) feed their reflected property
12//! structs into this vocabulary and the row factory mounts the right
13//! widget without per-host code.
14//!
15//! Modeled after MatterCAD's `PropertyEditor` + per-type
16//! `IPropertyEditorFactory` pair. The host walks a `#[derive(Reflect)]`
17//! struct, looks up each field's [`EditorKind`], and emits one row per
18//! field. The "is this row advanced?" decision is data-driven via
19//! [`NodeFieldAttrs::advanced`] rather than per-node show/hide code.
20//!
21//! ## Phased migration
22//!
23//! Phase 1 (this commit): vocabulary types only. atomartist-lib
24//! re-exports these from `atomartist_lib::registry` so downstream
25//! callers keep building without churn.
26//!
27//! Phase 2 (next): factory function `build_row(spec, value, callback)`
28//! mounting the actual widget per [`EditorKind`] variant.
29//!
30//! Phase 3 (then): full `PropertyPanel` widget that takes a list of
31//! field specs + a value getter/setter and renders the entire panel,
32//! including section headers, advanced gating, and tooltips.
33
34mod editor;
35mod render;
36mod value;
37
38pub use editor::{EditorKind, NodeFieldAttrs, NumberAttrs, VisibleWhen};
39pub use render::{paint_editor_only, paint_row};
40pub use value::RowValue;