Expand description
Widget/StatefulWidget structs: one file per widget, each a builder
that owns its own drawing logic.
new() takes only the arguments a widget cannot mean anything without
(the content: a value, a label, a slice of samples/rows). Every other
knob (styles, offsets, titles) has a default and is set through a
chainable #[must_use] fn field(mut self, ...) -> Self method, the same
shape as Panel::title or Log::offset. See crates/ui/AGENTS.md
for the rule this is enforcing and why.
A few widgets share logic: Gauge and StatBar both delegate to a
crate-private bar module, and Sparkline/Gauge/StatBar all
use Meter for their ratio-to-color ramp. Paragraph, List,
Table, Log, and Panel additionally implement Measure, so
a caller can report a height before rendering instead of guessing a
fixed height or a full-remaining-space fill: Paragraph reports its
wrapped line count (with the egc feature enabled, via
retroglyph_core::layout::TextLayout’s grapheme-aware word-wrap,
otherwise via its own char-boundary-safe fallback); List/Table/
Log report their item/row/message count directly, since none of them
wrap; Panel reports its border-plus-padding chrome height, since it
owns no content of its own to measure.
Structs§
- Animated
Perf Overlay PerfOverlay’sAnimatedWidgetcounterpart.- BoxBorder
- A single-line box border drawn around a
Rect. - Button
- A filled, centered
label, styled by aResponsethe caller resolves viaInteraction::interact(or, throughInteractiveWidget, has resolved automatically). - Gauge
- A labeled gauge: a
label, then a bar fillingratio(0.0-1.0) of the remaining width, colored bysuper::Meter, with a trailing percentage. - List
- A scrollable, single-column list of plain-text items with a
ListState-driven highlighted item:Table’s single-column sibling, sharing its windowing and selection story. - Log
- The tail of
messagesthat fits in the area it’s rendered into, oldest at top, newest at the bottom, each line clipped toarea.width()viaPrintLine. - Meter
- A load ratio in
0.0..=1.0, mapped to a green→yellow→red color ramp. - Modal
- A bordered, filled box centered in a screen
Rect. - Panel
- A bordered panel: a filled background with a box border and, optionally, one or more titles along the top and/or bottom edge.
- Panel
Title - One title added via
Panel::add_title: its text, which edge it’s drawn on, and its alignment. - Paragraph
- Word-wrapped text in a single
Style. - Perf
Overlay - A bordered panel showing live
FrameStats. - Print
Line - A
Line, drawn on the first row of the area it’s rendered into and clipped toarea.width()columns. Only the first row is used. - Progress
Bar - A horizontal progress bar that fills
value / maxof the area it’s rendered into. - Scrollbar
- A vertical scrollbar (typically one cell wide) covering
total_lenitems in avisible_len-row viewport. - Sparkline
- A single-row sparkline of
samples, scaled to the sample max, using the eight vertical block glyphs▁▂▃▄▅▆▇█. - StatBar
- A labeled stat bar:
label, a bar fillingcurrent / maxof the remaining width colored bysuper::Meter, and a trailing"current/max"readout. - Table
- A fixed-column, scrollable table with a
ListState-driven highlighted row. - Tabs
- A horizontal strip of
titleswith the tab atselectedhighlighted. - Text
- A single line of text in one
Style, clipped (not wrapped) toarea.width()columns. Only the first row ofareais used. - Text
Input - A single-line editable text field: the stateless drawing half of
TextInputState, the same splitListhas withListState.
Enums§
- Border
Type - The box-drawing glyph set
BoxBorder,Panel, andModaldraw their corners and edges with. - Highlight
Spacing - Whether
List’shighlight_symbolmarker column reserves width even whenListState::selectedisNone. - List
Direction - Which end of a
List’s area its items render from. - Title
Position - Which border edge a
PanelTitleis drawn into.
Traits§
- Animated
Widget - Like
StatefulWidget, but for widgets whose state evolves with wall-clock time. - Interactive
Widget - A widget that renders itself styled by an already-resolved
Response, with theSenseit needs fixed by the widget rather than chosen at the call site. - Measure
- A widget that can report the height it needs for a given width, before ever being rendered.
- Stateful
Widget - Like
Widget, but for widgets that read (and may update) externally owned state (a selection index, a scroll offset) that outlives a single render call. Seecrate::ListState. - Widget
- A type that draws itself into a
Surface, without retaining any state: the minimal shape shared by every widget-like consumer.