Lists, trees & tables

Lists, trees and tables

Three widgets cover the "rows of data" cases, sharing one row renderer (selection fill, hover wash, icon, label) so they look consistent and restyle together through the theme.

Selection that behaves

Item views act on synthesized intent, which is what makes selection feel right:

TreeView owns a selected set plus an anchor and reports the whole set through onSelectionChanged:

tree->onSelectionChanged = [&](const std::vector<int>& ids){ doc.setSelection(ids); };
// Shift-click = range from the anchor over the visible rows;
// Cmd/Ctrl-click = toggle one; plain click = replace.

Range-select walks the visible flattened rows between the anchor and the clicked row, so Shift-selection matches what the user sees, and a double-click on a group expands or collapses all of its descendants.

Right-click and context

A right-press selects (or, in a tree, fires onContextMenu without disturbing the selection) and opens a MenuPopup on the app's popup layer — returning unhandled for the drag, so a modal menu does not steal the capture. The whole pattern — multi-select, range, reorder, context menu — is what the Editor's Outliner is built from, driving a Prism document's selection directly.

Scrolling

Wrap a tall item view in a ScrollView and it clips and scrolls (wheel or thumb-drag), showing a gutter only on overflow. Combined with the per-region buffering, a long, scrolling list stays smooth because only the scroll view's layer repaints as it moves.