Repository navigation
The segmented look as public Style classes; Enablement::and public (#346, PR 2) - #425
Merged
Merged
Conversation
) A tab list should look exactly like a segmented control, and the tabs widget can't reach the segmented control's look from outside the core. Style::segmented_track, segmented_cell and segmented_icon give the classes the segmented control itself builds, at a size, a Rows layout and an enablement, and the segmented control now builds its own track, cells and icon through them, so the look is defined once. Rows is public for them. Enablement::and is public, so a widget can combine its own enablement with the subtree's without spelling the rule as a match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
Under the default style (Disabled::Colors) a disabled track looks like an enabled one, so no test saw a track that ignored its enablement. This one draws both under Disabled::Faded, and checks first that the faded track really is drawn otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
#399 made the table's Rows public at owned::Rows, so the segmented control's rows enum takes the name SegmentedRows, beside SegmentedChain and SegmentedMetrics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
Owner
Author
|
Approved by the user on its tests, name SegmentedRows (2026-11-19). GitHub's required checks pass on the branch merged with current main. Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #346: PR 2 of the design note, the segmented control's look as public classes, so the tabs widget can look exactly like it.
What changes
Style::segmented_track,Style::segmented_cell,Style::segmented_iconreturn the classesBuilder::segmenteddraws its track, a cell and a cell's icon with. Each takes the eguiContextand aSize. The track and the cell also take aSegmentedRowsand anEnablement, and the cell takes whether it's the chosen one (Cell::Pressed/Cell::Released).segmentednow builds its own track, cells and icon through the same code, so the look is defined once.#[track_caller]), as before.sense_click(), as the doc says.owned::SegmentedRows(One,Wrapping) is public, for those methods: a track on one row, or one that wraps its cells. It was to beRows, but Table: rows_with, group rows and per-table stripes (part of #370/#371) #399 has since taken that name for the table's rows, so this name is for you to check.Enablement::andis public (#[must_use], with a doctest), so a widget combines its own enablement with the subtree's asown.and(b.enablement())and doesn't spell the rule as a match.Builder::control_size()andBuilder::enablement(). The new test builds its track that way.Decisions (with the eggshell session; for review)
Stylewith the rows enum public, from the options in the note.Style, not onSegmentedStyle: a cell's classes need the whole style (the text role, the transition, how disabled controls are drawn).Builder::size_ofandenablement_ofstay private, as you asked. Badge, Chip and Spinner in eggshell-ui-extras #360's getters serve instead, and I proposed no combining form beyondEnablement::and.Breaking changes
None. Everything is new public surface.
Tests
New in
tests/it/segmented_classes.rs: the library'ssegmentedand a track hand-built from the public methods, side by side through the real build, layout and draw. Every descendant's path, size and position relative to its track must match, as must the track's fill and each cell's fill and text colour.public_classes_draw_the_library_s_controlthey_follow_the_size_a_subtree_gives: undercontrol_size(SM), with a precondition that the small track is another height.they_follow_an_inert_subtreethey_fade_as_the_style_fades_disabled_controls: underDisabled::Faded, with a precondition that the faded track is drawn otherwise.a_wrapping_track_matches_tooEvery existing test passes unchanged, and no golden changed.
Reversion check: on main the suite doesn't compile, because the API is new. Each mutation of the public methods below fails tests, and the unmutated branch passes them all:
SegmentedRows: 1 fails;One mutation isn't caught, and can't be: the cell ignoring
SegmentedRows. A wrapping track ish_auto, where a cell'sh_fullresolves to auto, the same ash_auto.Checks
cargo test -p eggshell-uipasses.segmented.rswas resolved, and the rename above follows Table: rows_with, group rows and per-table stripes (part of #370/#371) #399.TODO(prose)
Style::segmented_track,segmented_cell,segmented_icon,SegmentedRowsand its variants, andEnablement::andhave one-line drafts for you to rewrite.🤖 Generated with Claude Code
https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o