Module toggle_group
Expand description
ToggleGroup — the segmented control: a strip of segments of which one is chosen (or, before
the person has chosen, none). Clicking a segment chooses it and fires on_change with the new
index.
State lives on the widget unless it is bound: ToggleGroup::bind_selection keeps a
crate::LocalState and the strip in step both ways, and on_change / on_action report
the person’s choices.
The chosen segment is a lift (HIG §9.3): a thumb one surface step off the track, set concentrically inside it, with primary ink and no hue.
ToggleGroup::multiple is the multi-select form (the weekdays an alarm repeats on): every
segment its own toggle, as wide as its label, wrapping onto further rows. Page tabs
(SegmentedStyle::Tabs) start flush — each tab as wide as its label and padding, the chosen
one a selector lift (crate::chrome::paint_selector) like a window’s tabs — and a strip longer
than its room scrolls instead of eliding.
ToggleGroup::from_state binds the choice to typed view state instead of a callback;
ToggleGroup::vertical stacks icon segments into a tool rail, each label (with its
Segment::with_hint shortcut) its tooltip and its accessible name.
Structs§
- Segment
- One choice of a
ToggleGroupor aSegmentedFace. - Segment
Props - One choice of a
ToggleGroupor aViewTabs: what it says, and how it shows. - Segmented
Face - An immediate-mode segmented strip over caller-owned segment rects (the
rects must be contiguous, except a multi-select strip’s). The caller owns
the hit-test; this paints the themed look over them. Size the strip with
SegmentedFace::heightandSegmentedFace::intrinsic_width, and split it withSegmentedFace::partition_segments. - Segmented
Touch - The retained control and painted strips share one touch recognizer. Only a completed single-finger gesture chooses; cancellation, a second finger, a removed strip or an externally changed selection refuses it.
- Segmented
Touch Group - One painted segmented strip, identified independently of its position.
Keep
idstable while the strip remains mounted. - Toggle
Group - Toggle
Group Props - A small set of choices, one of which is made: an alignment, a density, a unit. The chosen
one is a thumb lifted off the track. What switches what a window shows is
ViewTabs. - View
Tabs Props - Tabs that switch what a window’s content shows: a request’s Params, Headers and Body, a container’s Logs and Stats. Assistive technology meets them as a tab list whose chosen tab is selected, not checked.
Enums§
- Segmented
Style - What a segmented strip is. The style never chooses a colour: the chosen segment is always a lift with primary ink.
- Segmented
Touch Result - The input owner applies a selection through its existing admitted action.
Constants§
- NONE_
CHOSEN - No segment chosen: what
ToggleGroup::selectedandSegmentedFace::newuse for “none” (ToggleGroup::selectionsays it asNone).
Functions§
- segment_
colors (fill, label)of one segment;fill == Nonemeans nothing is painted under it. On aSegmentedStyle::Segmentedtrack the fill is the thumb.