pub enum Selector {
Segmented,
Toggle,
Tabs,
}Expand description
A control that picks between things.
Three, because three distinct behaviours are in play and collapsing any two loses something. A segmented control picks a value; a tab picks a pane; a toggle picks nothing and simply holds itself on or off.
Variants§
Segmented
Exactly one of N, and the options abut.
Toggle
Independent on or off, on its own.
Tabs
Navigation between panes. The folder semantic.
Implementations§
Source§impl Selector
impl Selector
Sourcepub const fn chosen(self) -> Depth
pub const fn chosen(self) -> Depth
How the chosen option sits.
Held in for a segmented control and a toggle, which is the same shape pressing produces and the whole economy of the idiom: one appearance, two reasons to wear it. A tab is the exception, because the selected folder tab comes forward to join the pane it opens.
Sourcepub const fn unchosen(self) -> Depth
pub const fn unchosen(self) -> Depth
How the options that were not picked sit.
Describing only Selector::chosen left the unchosen option falling
through to Depth::Flat, which says it is level with the strip it
sits in, and no renderer emitted anything for it. That is wrong in both
directions and goingson proved it: its unchosen tabs are recessed by
hand, and being recessed is why the chosen one reads as coming
forward. Against a flat strip, a raised chosen tab is a bevel drawn on
the strip’s own colour, which is a much weaker folder effect than the
contrast the idiom is named after.
Each member is the inverse of its chosen state, which is the whole content of “picked” once colour is deferred:
- Tabs recede, so the chosen one comes forward.
- A segment and a toggle stand up, so the chosen one is held in.
Sourcepub const fn abutting(self) -> bool
pub const fn abutting(self) -> bool
Whether the options touch.
The gap is the entire difference between a segmented control and a row
of buttons that happen to sit near each other, which is what audiofiles’
segmented_control says in its own comment and why it zeroes the
spacing by hand.
Sourcepub const fn joins_its_pane(self) -> bool
pub const fn joins_its_pane(self) -> bool
Whether the chosen option joins the surface it opens.
True for Tabs alone, and it is the half of the folder
semantic chosen cannot carry. A depth says how a
thing sits relative to what is behind it; this says that the chosen
option and its pane are one surface, so the run between them is not
drawn at all.
Kept as its own question rather than folded into the depth because the
pairing rule holds: fill and bevel travel together off one Depth,
and a renderer composes that depth’s fill with
Bevel::RaisedOpen when this is true. A
segment or a toggle picks a value and opens nothing, so there is
nothing for either of them to join.