Expand description
Immediate-mode drawing helpers over a Rect.
Box borders, filled panels, gauges, tables, sparklines, and a small
constraint-based Rect splitter with
ratatui-style Fixed/Percent/Fill/Min/Max constraints and Flex
alignment (layout).
Every widget (widget) is a builder struct that draws itself into a
Grid via Widget/StatefulWidget and
retains no state of its own: state that outlives one render call (a
selection index, a scroll offset) lives in ListState instead. A
handful of things that are genuinely just functions (fill_rect,
thumb_geometry/offset_for_pos) stay free functions in draw
rather than pretending to be widgets. Three more independent layers
build on top:
Widget/StatefulWidget(widget) render into aSurface, an area-relative, single-layer view over aGrid, and let callers box or store heterogeneous widgets, e.g. aVec<Box<dyn Widget>>of panes to render each frame, with noBackendtype parameter, since drawing touches nothing but cells.Interaction(interact) for hover/click/drag/focus tracking without a retained widget tree: the sibling ofListStatefor widgets that don’t have a natural selection index of their own.BoxStyle(style) for a Lip-Gloss-style box model (padding, border, margin) rendered into a standaloneGrid.join_h/join_v(block) to compose severalGrids (e.g.BoxStyle::renderoutput) into one before drawing it.Theme(theme) for named color roles (an app picksTheme::DARK/Theme::LIGHT, or builds its own), independent of how the app decides which one is active.
This crate is itself optional: games that draw manually depend only on
retroglyph-core.
Re-exports§
pub use align::Align;pub use block::blit_into;pub use block::join_h;pub use block::join_v;pub use draw::fill_rect;pub use draw::offset_for_pos;pub use draw::thumb_geometry;pub use interact::DEFAULT_DRAG_THRESHOLD;pub use interact::Density;pub use interact::FocusRing;pub use interact::HitTester;pub use interact::Interaction;pub use interact::Pointer;pub use interact::Response;pub use interact::Sense;pub use interact::Shortcuts;pub use layout::Constraint;pub use layout::Flex;pub use layout::centered_rect;pub use layout::split_h;pub use layout::split_h_flex;pub use layout::split_h_spaced;pub use layout::split_v;pub use layout::split_v_flex;pub use layout::split_v_spaced;pub use state::ListState;pub use state::ScrollPhysics;pub use state::ScrollState;pub use state::SelectionWrap;pub use style::BoxStyle;pub use style::Sides;pub use text::truncate;pub use text::truncate_owned;pub use theme::Theme;pub use widget::Paragraph;egcpub use widget::BoxBorder;pub use widget::Button;pub use widget::Gauge;pub use widget::List;pub use widget::Log;pub use widget::Measure;pub use widget::Meter;pub use widget::Modal;pub use widget::Panel;pub use widget::PrintLine;pub use widget::ProgressBar;pub use widget::Scrollbar;pub use widget::Sparkline;pub use widget::StatBar;pub use widget::StatefulWidget;pub use widget::Table;pub use widget::Tabs;pub use widget::Text;pub use widget::Widget;
Modules§
- align
Align: horizontal alignment of a single line of text within a fixed-width area.- block
- Compose
Gridvalues before drawing them. - draw
fill_rectandthumb_geometry/offset_for_pos: the handful of things genuinely useful as standalone functions rather thanWidgets.- interact
- Pointer and keyboard focus tracking for interactive widgets, without a retained widget tree.
- layout
- Constraint-based
Rectsplitter for multi-panel UIs. - state
- Reusable widget state, kept separate from drawing.
- style
BoxStyle: a Lip-Gloss-style box model (padding, border, margin).- text
- Single-line column-clipping, unicode-width aware.
- theme
Theme: named color roles for a light/dark-aware app.- widget
Widget/StatefulWidgetstructs: one file per widget, each a builder that owns its own drawing logic.
Structs§
- Styled
Surface - A
Surfacewith aStylebound in, returned bySurface::with_style. - Surface
- The render target for every drawing call in the workspace: a mutable reference to a
Gridplus a fixedlayer, scoped to one area.