Skip to main content

app_menu

Function app_menu 

Source
pub fn app_menu<M>(menus: impl MenuContent<M>)
Expand description

Install the application menu: the native menu bar on desktop, the app-bar overflow on Android, the UIMenuBuilder main menu on iPadOS/Catalyst. Top-level entries are usually sub_menu(…)s (the menu-bar menus). Takes a list of entries or a closure that derives them.

The menu is live (docs/menus.md): every title, enabled and checked is re-read, and the menu re-lowered and reinstalled, whenever one of them changes, so menu_role labels, res::str titles and day::tr all follow a runtime language switch, and a derived closure re-runs on whatever signals it reads. Calling it again replaces the previous install and reclaims its action closures. Install once, at startup.

ⓘ
app_menu([
    sub_menu(res::str::menu_file(), vec![menu_item(res::str::new_item()).key("n").action(add)]),
    sub_menu(res::str::menu_view(), vec![menu_item(res::str::grid()).checked(grid).action(flip)]),
]);
Day API ↩ Guides· daybrite.dev