Expand description
Portable toolbar model.
Shared, backend-agnostic model for WidgetKind::Toolbar per
docs/widget-expansion-roadmap.md §14: stable ToolIds that survive
rebuilds and reorders, separators, icon/text display modes, checkable and
exclusive radio tools, dropdown tools, and the pure rules every lane must
agree on.
The rules are functions, not a second state store: Ui owns
the item list on the widget spec, applies these helpers, and forwards the
resulting list to the backend. Keeping them here means the Mock oracle and
the native toolbars cannot drift on the two behaviours that are easy to get
wrong:
- radio exclusivity — checking one member of a group unchecks the other
members, and a user toggle reports one
ToolToggledper changed tool (never a single “group” event); - programmatic vs user edits —
set_tool_stateis silent by design (no activation echo), whileclick_toolis the user path that produces the events.
The native compositions (GTK gtk::Box, Win32 TOOLBARCLASSNAME, Cocoa
NSToolbar) land later; until then every backend refuses
the kind and the toolbar setters with the typed unsupported error instead
of faking a toolbar.
Structs§
- ToolId
- Stable, application-facing identifier of one toolbar tool.
- Tool
Spec - One toolbar tool.
- Tool
Update - Partial in-place update applied by
crate::Ui::update_tool.
Enums§
- Tool
Display - How a tool presents its label and icon where the lane supports both.
- Tool
Interaction - The events a user click on a tool produces, decided by the shared rules so every lane reports the same interaction.
- Toolbar
Error - A model rule violation, surfaced by the
Uisetters asGuiError::Backendwith this message. - Toolbar
Item - One row of a toolbar.
- Toolbar
Orientation - Toolbar stacking orientation.
Functions§
- apply_
tool_ update - Applies a partial
ToolUpdateto one tool. - click_
tool - Applies a user click to the toolbar model.
- find_
tool - Finds a tool by id.
- find_
tool_ mut - Mutable lookup by id.
- set_
tool_ state - Applies a programmatic checked-state change.
- validate_
toolbar_ items - Validates a toolbar item list.