Skip to main content

Module nav_row

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:

PartFaceLook
checkNavRowFace::checkeda crate::widget::CheckboxFace; the whole row toggles it
icon, swatch or avatarNavRowFace::icon, NavRowFace::swatch, NavRowFace::avatara ui::icons glyph, the content colour the row stands for, or the person it stands for
badgeNavRowFace::badgea short classifying code on a quiet pill, in a column shared by its section
labelNavRowFace::newBody; Body.strong() while selected
secondaryNavRowFace::secondaryone Caption line under the label, in secondary ink
levelNavRowFace::levela usage bar under the text, on the progress bar’s track and fill
presenceNavRowFace::presencethe people on it, as marks in their colour
status labelNavRowFace::status_labela quiet tinted badge (“Active”)
metaNavRowFace::metaa tertiary Caption figure (a size)
countNavRowFace::countquiet tabular figures, or the live badge
statusNavRowFace::statusa 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§

NavRowFace
Everything a navigation row shows. Build with NavRowFace::new and paint with paint_nav_row.
NavRowLayout
Where each part of a navigation row lands. Painting and hit-testing both read it.
NavSectionFace
A section header in a navigation list.
NavSectionLayout
Where each part of a section header lands.

Enums§

NavCount
How many items a navigation row stands for, beside its label.
NavRowStyle
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, or Body.strong() while the row is selected. Measure elision with label_measure_style so 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 codes on 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 s2 padding, never shorter than nav_row_height.
nav_rail_item_height
Height of the rail tile for label in a rail width wide: one caption line more than nav_rail_row_height when 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 face inside its row (see NavRowLayout).
nav_section_height
Height of a section header. Every section after the first is separated from the rows above it by s3 of space, not by a line.
nav_section_layout
Lay out a section header (see NavSectionLayout).
paint_nav_row
Paint one navigation row. theme is the theme of the ground the row stands on; its surfaces.content is 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.