#[non_exhaustive]pub enum Showing {
All,
One,
AtMostOne,
}Expand description
How many of a region’s children are visible at once.
4dcd241b. Three findings turned out to be one sentence the vocabulary
could not say: this region holds several children and shows some of them,
and the reader can change which. Region::TabGroup existed with nothing
saying which tab was open, a carousel had nothing saying which frame was up,
and a disclosure had nothing saying whether its one child was showing at all.
Because the fact lived nowhere, a renderer had two moves: hardcode a widget name, or draw every child. That is what put per-widget code in renderers, and it was the missing member rather than the widget tier that put it there.
§What is here and what is not
The kind, and only the kind. Which child is currently up is the current
answer, and a layer that defers every address does not hold the current
answer either — the split Selector already makes, where this crate says
what kind of chooser a thing is and the router says which option is picked.
So a holder of regions carries the index and the per-child label beside this.
§What a renderer does with it
Derives its chrome, once, for every widget rather than per name:
- Children carrying labels get a strip of the labels, the current one marked.
- Children carrying none get previous, position, next.
AtMostOneover one child gets a summary line that opens.
The name on Region::Widget survives as app vocabulary, for a renderer
that wants to do something special with one, which is what it should have
been from the start.
Degradation runs the way it already did: a renderer ignoring this draws every child, which is more content rather than less.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
All
Every child, in order. What every region did before this existed.
One
Exactly one. A carousel, a tab group.
AtMostOne
One, or none. A disclosure, which is closed until it is opened.
Implementations§
Source§impl Showing
impl Showing
Sourcepub const fn selective(self) -> bool
pub const fn selective(self) -> bool
Whether the reader can change which child is up.
The question every renderer’s region arm asks before deriving any
chrome, and a method rather than a matches! at each renderer for
Region::name’s reason: three renderers writing the same comparison is
how they come to disagree about a member added later.
Sourcepub const fn dismissible(self) -> bool
pub const fn dismissible(self) -> bool
Whether showing nothing is a legal state.
True only for AtMostOne. A renderer needs this to
know whether its control closes as well as moves: a carousel’s row moves
between frames and never reaches empty, and a disclosure’s summary line
is the same control wearing its closed state.