Skip to main content

Module menu

Module menu 

Source
Expand description

Menu action dispatch (§ menus). The MODEL (day_spec::MenuItem) is toolkit-neutral and carries only ids for its actions; the real closures live here, keyed by id. A backend fires Event::MenuAction(id) when a native item is chosen; the event pump routes it to dispatch_menu_action, which runs the app’s closure. Ids are process-unique and monotonic.

Enums§

MenuBarStyle
Arrange an app’s top-level menus into the platform’s standard bar, filling every standard slot the app did not claim with the backend’s stock menu.

Functions§

app_menu_installed
Whether any app menu was installed (an empty model = the backend default menu is up).
app_menu_model
The app menu as last installed (post-injection). The dayscript menu: step walks it to resolve an item’s dispatch id; backends re-read it on late preferences registration.
dispatch_menu_action
Run the closure registered for id (no-op if none). Called by the event pump on Event::MenuAction. Runs inside a reactive batch so multiple signal writes coalesce.
register_menu_action
Register an app closure for a menu item and return its dispatch id (nonzero). The day-pieces menu builder calls this while lowering a menu tree to the day_spec::MenuItem model.
set_app_menu
Set the application menu (menu bar / app-bar overflow / iPad main menu). Retains the model (post-injection — app_menu_model), injects the auto Preferences item when one is registered (docs/windows.md), drops the PREVIOUS app menu’s action closures (context menus share the map and are untouched), and forwards to the backend.
standard_menu_bar
leading are the slots before the app’s own menus and trailing the ones after — each backend passes its platform’s bar (macOS trails Window and Help; KDE trails Settings and Help; GNOME and Windows trail Help alone). stock returns the backend’s house version of a slot, or None where that platform has no such menu. Menus the app tagged with [MenuBarRole] replace the stock one IN PLACE, so an app customizes a standard menu by claiming it rather than by rebuilding the whole bar.
standard_menu_bar_for
Assemble the bar for a desktop’s conventions — standard_menu_bar with that style’s slot order and stock menus.
Day API ↩ Guides· daybrite.dev