Module nav_row
Expand description
One navigation row and one navigation section header, painted the same everywhere.
NavList paints every row through paint_nav_row and every section
header through paint_nav_section; a painted app that cannot host a
NavList calls the same two functions with the same faces, so a sidebar
drawn by hand is pixel-for-pixel the sidebar the widget draws. The
geometry (nav_row_layout, nav_section_layout) is public so a
painted host hit-tests exactly what was painted.
A row is the list’s s2 inset from both edges; its selection is the
neutral lift of the ground it stands on (super::paint_row_selection),
with primary ink. Counts are Caption tabular figures in tertiary ink; a
NavCount::Live count (unread, needs attention) is the one filled
badge, in the person’s own colour. Section headers are sentence-case
Subheading in secondary ink.
Every part a row can show, leading to trailing:
| Part | Face | Look |
|---|---|---|
| check | NavRowFace::checked | a crate::widget::CheckboxFace; the whole row toggles it |
| icon, swatch or avatar | NavRowFace::icon, NavRowFace::swatch, NavRowFace::avatar | a ui::icons glyph, the content colour the row stands for, or the person it stands for |
| badge | NavRowFace::badge | a short classifying code on a quiet pill, in a column shared by its section |
| label | NavRowFace::new | Body; Body.strong() while selected |
| secondary | NavRowFace::secondary | one Caption line under the label, in secondary ink |
| level | NavRowFace::level | a usage bar under the text, on the progress bar’s track and fill |
| presence | NavRowFace::presence | the people on it, as marks in their colour |
| status label | NavRowFace::status_label | a quiet tinted badge (“Active”) |
| meta | NavRowFace::meta | a tertiary Caption figure (a size) |
| count | NavRowFace::count | quiet tabular figures, or the live badge |
| status | NavRowFace::status | a dot at the trailing edge |
Hover and focus swap the trailing parts for the row’s actions.
Draw with the theme of the ground the rows stand on
(theme.in_region(Region::Sidebar) in a sidebar, theme.on_ground(..)
elsewhere): the painter reads that ground from surfaces.content.
Structs§
- NavRow
Face - Everything a navigation row shows. Build with
NavRowFace::newand paint withpaint_nav_row. - NavRow
Layout - Where each part of a navigation row lands. Painting and hit-testing both read it.
- NavSection
Face - A section header in a navigation list.
- NavSection
Layout - Where each part of a section header lands.
Enums§
- NavCount
- How many items a navigation row stands for, beside its label.
- NavRow
Style - A row laid out as a list row or as a tile in an icon-over-label rail.
Functions§
- label_
measure_ style - The heavier of a row’s two weights: elision is measured with it, so a label that fits selected also fits unselected.
- label_
style - The style a row’s label is set in:
Body, orBody.strong()while the row is selected. Measure elision withlabel_measure_styleso the label does not jump when the weight changes. - nav_
badge_ column - The width of the badge column a section’s rows share: the widest of
codeson its pill. - nav_
item_ height - Height of a list row that carries a secondary line and/or a usage bar
under its label: the stacked text inside the row’s
s2padding, never shorter thannav_row_height. - nav_
rail_ item_ height - Height of the rail tile for
labelin a railwidthwide: one caption line more thannav_rail_row_heightwhen the caption wraps. - nav_
rail_ row_ height - Height of one rail tile: the icon over a caption line inside the row padding.
- nav_
row_ description - The spoken form of a row’s extra parts, for its accessible description: the secondary line, the meta, the state.
- nav_
row_ height - Height of one list row:
crate::tokens::Metrics::nav_row_height, grown with the body line at large text. - nav_
row_ layout - Lay out
faceinside its row (seeNavRowLayout). - nav_
section_ height - Height of a section header. Every section after the first is separated
from the rows above it by
s3of space, not by a line. - nav_
section_ layout - Lay out a section header (see
NavSectionLayout). - paint_
nav_ row - Paint one navigation row.
themeis the theme of the ground the row stands on; itssurfaces.contentis that ground. - paint_
nav_ section - Paint a section header: the title in
Subheading, secondary ink; a collapsible section’s chevron while the pointer or focus is on it (or while it is collapsed, so a hidden section is never mistaken for an empty one); and its trailing action. - rail_
caption_ lines - A rail caption broken into at most two lines of
max_w: at a space when there is one, inside the word (with a hyphen) when one word is too long for a line; the second line elides.