Expand description
A meter, a badge, a control, a figure and a form field.
The pieces below the level table works at. Not feature-gated, on
table’s footing: WidgetStyle carries the tones,
and a caller with a loaded theme reaches for WidgetStyle::from_theme.
The pieces every terminal app draws, drawn once.
Arrived in 0.16.0 out of quasi-tui, which had written all of them and was
the second consumer to do so. A meter, a badge, a control, a figure and a
form field are what a screen is made of below the level table
works at, and every one of them had been hand-rolled at least twice in this
tree before it was lifted.
§What these take, and what they leave alone
Each takes a makeover-layout description, a [WidgetStyle], and whatever
the host knows that a description never carries. That last part is the
shape worth copying: [field] takes what is currently typed in the box as a
separate argument, because [Field] deliberately does not carry a value and
is not going to. makeover-immediate reached the same seam from the other
side with its Filling, and [Held] is that seam here.
Focus is the other one. Nothing in a description says which control the user
is on, so every drawing here takes focused as an argument and the caller
is what counts. What focus looks like is this crate’s answer and not the
caller’s, which is the point of it being here: see
[WidgetStyle::focused].
§What they do not do
No layout. Each answers rows for a width, or draws into the rect it is given, top-aligned, and never below it. Nothing here measures twice and nothing here places anything relative to anything else, because the moment it did it would be a layout engine with one consumer’s flow baked into it.
Structs§
- Widget
Style - The colours and marks the drawings below use.
Enums§
- Held
- What a field currently holds, which a description never carries.
Functions§
- act
- A control as one line.
- field
- A question: its label, the box, and its standing help or what is wrong now.
- field_
height - The rows
fieldwants atwidth. - figure
- A figure: the number, then what it counts under it.
- figure_
height - The rows
figurewants atwidth. - filled_
act - A control filled with the action colour, for the one press a screen is about.
- meter
- A proportion as one line: the bar, then the reading beside it.
- token
- A badge or a chip as one span.