Expand description
Toolbar contributions (docs/toolbars.md). The model (day_spec::ToolbarItem) is
toolkit-neutral and carries only ids for its commands; the closures live here, keyed by
id, the same shape as crate::menu and the same id space, so one closure can
back both a toolbar button and its menu-bar twin.
Any piece can declare items. Where it sits decides which chrome carries them (the window’s own, or one navigation page’s), and its scope decides how long they stay: a contribution is withdrawn when the piece that registered it is disposed, so a command leaves with the content it acts on. Several pieces may contribute to one chrome; this module merges them in registration order and hands the result to the toolkit as one model.
Structs§
- Document
Window - A resident document’s mutable presentation window. Contributions inherit this context so moving the document also moves its commands without rebuilding them.
Enums§
- Chrome
- Which chrome a contribution lands on.
Functions§
- chrome_
changed - The pieces layer, after a change to what is on screen (a push, a pop, a tab switch), so a one-bar-per-window toolkit is handed the showing pages’ items. No-op where every page has a bar of its own.
- current_
chrome - The chrome a contribution registered right now belongs to: the innermost navigation page being built, else the window being built, else the primary window.
- current_
page_ column - Which column the page being built is;
day_spec::ToolbarColumn::Windowat the window root. - current_
page_ gate - The predicate for the page being built, if it has one.
- current_
page_ window - The window the page being built belongs to, else the one being built.
- 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.actionis the slot id the toolkit holds (the toolbar slot model); a raw closure id works too. - focus_
toolbar_ search - Focus the active window’s search control, revealing a collapsed desktop search item. Returns false when the active window has no toolbar search contribution.
- patch_
chrome patch_toolbaragainst an explicit chrome. Also updates the retained model, so a later full replace does not resurrect the stale value.- patch_
toolbar - Apply a targeted item update wherever the item lives: the path a bound signal writes through, so a search field keeps its focus and its insertion point.
- register_
contribution - Add one piece’s items to
chromeand return the token that owns them. The caller withdraws them withunregister_contribution, normally from its own scope cleanup. - register_
contribution_ gated register_contributionfor a page, with the predicate that says whether that page is on screen. The caller also re-reads it inside an effect, which is what re-composes the bar when a pane collapses or the destination changes.- 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.
- relabel_
contribution - Give a contribution’s items new labels and tooltips, one
(label, tooltip)per item in order, keeping everything else as it now stands (actions, a search field’s typed text): a language change relabeling a fixed toolbar (docs/toolbars.md). - reset_
toolbars - Reset every chrome’s toolbar state (tests; pairs with
uninstall_tree). - synthesize_
toolbar_ value - Synthetic input to a bar item (dayscript’s
toolbar:step): paint the widget the way an app write would, then dispatch the value as the native control would. Both halves are needed, as for a text field (crate::synthesize_text): a real keystroke reaches Day with the field already showing it, so the dispatch alone records the text without touching the widget, and a synthesized one left the field empty while the app acted on the query. - toggle_
sidebar - Show/hide the sidebar pane of the navigation host
host: the behavior behind the sidebar affordance a nav host contributes for itself (day_spec::SIDEBAR_TOGGLE_ID).falsewhen the toolkit has no pane to toggle there. The item’s action makes this call, and dayscript’stoolbar:step presses the item like any other, so a walkthrough drives the same path a click does (docs/toolbars.md). - toolbar_
model - Every live item, across every chrome. dayscript’s
toolbar:step walks it to resolve an item’s dispatch id, and an app has one bar per window at a time, so a duplicate id across two chromes would be an app bug rather than an ambiguity to resolve here. - unregister_
contribution - Withdraw a contribution. Its items leave the chrome, and the closures only it owned go with them.
- update_
contribution - Replace one contribution’s items in place, keeping its position among its neighbors.
- window_
being_ built - The window being built, else the primary root. Shared with the ambient environment lookup, which scopes
the same way for the same reason: an app’s one
size_class()call inside a sharedbuild_shellmust mean “this window”. - with_
page - Run
fwithpageas the navigation page contributions inside it belong to. The pieces layer wraps each destination, sidebar and content-list build in this. - with_
page_ gated with_pagewith the predicate that says whether this page is on screen (a collapsed content-list pane, a destination that is not the one showing, a page covered by a push). The window’s one bar carries only the chromes that predicate admits (docs/toolbars.md).- with_
page_ in with_page_gatednaming the window explicitly. Callers that build pages lazily (every navigation host) pass the window they were built in.