Module tree_view
Expand description
TreeView — hierarchical list. One row per visible node, indented by
depth; branch nodes carry an expand/collapse glyph. Selection and focus
are tracked separately so arrow-key navigation can move the focus ring
without committing a selection until the user explicitly chooses.
Expand/select/focus state lives on the widget; on_select is how the
caller persists a choice into its own (e.g. CRDT-backed) storage.
Structs§
- Tree
Heading Action - An icon button at the trailing edge of the heading band (a sidebar’s “new item”).
- Tree
Load Request - Tree
Node - Tree
RowAction - A compact action shown at the trailing edge of the hovered row (a “new
child” plus, a “more” ellipsis). Assistive technology sees every row’s
actions as buttons named
"{accessible_name} {row label}". - Tree
RowDecoration - Per-row presentation painted by the tree itself: a leading icon, a label
tone, trailing secondary text (a count, a type) and an accessible
description. Unlike
TreeView::with_row_delegatenothing is mounted, so decorations are recomputed every frame at no retained cost; disclosure, selection, hover, the current row, focus and semantics stay owned by the tree. - Tree
RowInfo - What a
TreeView::with_row_decorationcallback is told about the row it decorates. - Tree
Slot - Stable address of one logical child slot in a paged model. Slots remain present while their data transitions from loading to ready or error.
- Tree
View
Enums§
- Tree
Child State - State returned for a logical child slot. A model can publish its total child count before all child ids are resident, allowing the tree to retain correct scrollbar geometry while requesting only visible pages.
- Tree
Click Activation - How a pointer press activates a row (see
TreeView::on_activate). KeyboardEnterand the accessibilityActivateverb activate the focused row in either mode. - Tree
Load Reason - Tree
Model Change - A granular notification from an external tree model. Structural and slot identity changes reconcile the expanded-order index once per batch; label changes preserve geometry and query fresh data on the next frame.
- Tree
Move - A structural move of one row — what a drag does, as a single step for the
keyboard (
Alt+ arrows, orTab/Shift+TabwithTreeView::tab_indents) and for assistive technology, which sees one button per move on every row. - Tree
RowIcon - A leading glyph for a decorated row. Colours are resolved by the caller
from the
Themehanded to the decoration callback, so they track the active theme. - Tree
RowKey - Stable identity of either a resident model node or an unresolved child slot. Selection remains node-only, while focus and viewport anchoring can safely include placeholders.
- Tree
RowTone - The label colour role of a decorated row.
- Tree
Slot State - Non-resident row state passed to
TreeView::with_slot_delegate.
Traits§
- Tree
Model - Source-agnostic hierarchy queried by stable id. Implementations may be
backed by a database, an async cache, a CRDT, or the owned
TreeNodeadapter. The view asks only for expanded children and visible labels. IDs must be unique, parent/child queries must be inverse, and the reachable hierarchy must be acyclic.