Skip to main content

Module toolbar

Module toolbar 

Source
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 on Event::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_toolbar against 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 items removes it.
set_window_toolbar
set_toolbar against 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.
Day API ↩ Guides· daybrite.dev