Expand description
Window toolbars (docs/toolbars.md). The MODEL (day_spec::ToolbarItem) is toolkit-neutral
and carries only ids for its commands; the real closures live here, keyed by id — the same
shape as crate::menu, and deliberately the same id space, so one closure can back both a
toolbar button and its menu-bar twin.
A toolbar belongs to a WINDOW, not to the app: each window root keeps its own model, and the
primary window is just the root every install falls back to. During a secondary window’s
content build [with_window] names that window, so an app’s one toolbar(...) call inside a
shared build_shell gives every window its own bar without the app tracking any of it.
Functions§
- dispatch_
toolbar_ value - Run the value callback registered for
action(no-op if none). Called by the event pump onEvent::ToolbarChanged, inside a reactive batch so multiple signal writes coalesce. - patch_
toolbar - Apply a targeted item update to the current window’s toolbar — the path a bound signal writes through, so a search field keeps its focus and its insertion point.
- patch_
window_ toolbar patch_toolbaragainst an explicit window root. Also updates the retained model, so a later full replace does not resurrect the stale value.- primary_
toolbar_ model - The primary window’s toolbar model.
- register_
toolbar_ value - Register a value callback for a search or toggle item and return its dispatch id (nonzero). The id comes from the menu action counter, so toolbar and menu ids never collide.
- reset_
toolbars - Reset every window’s toolbar state (tests — pairs with
uninstall_tree). - set_
toolbar - Install the toolbar on the window currently being built (the primary window outside a window
build). Replaces any previous toolbar on that window; an empty
itemsremoves it. - set_
window_ toolbar set_toolbaragainst an explicit window root.- toolbar_
model - The window’s toolbar as last installed — dayscript’s
toolbar:step walks it to resolve an item’s dispatch id.