struct MenuModel
Swift
struct MenuModel
A resolved menubar: every menu, submenu and item with a final MenuID,
and no closures. What a backend draws or exports, and cheap to compare.
Sources/LavaMenu/Menu.swift:146
Constructors
init(menus: [MenuNode] = [])
Creates a model.
Sources/LavaMenu/Menu.swift:151
Properties
var allItems: [MenuItemModel] { get }
Depth-first leaf items (skips separators; includes submenu leaves).
Sources/LavaMenu/Menu.swift:156
Methods
func adding(shellMenu menu: MenuNode) -> MenuModel
menu added where a menubar convention puts it, for a menu the
shell contributes to every application's bar — the panel's Window
menu.
Merged into the application's own menu of the same title when there is
one (after a separator), so a bar never shows two "Window" menus.
Otherwise just before "Help", which stays last everywhere; otherwise
at the end. Titles compare without mnemonic markers, since an imported
GTK or Qt menu spells them _Window and &Help.
Sources/LavaMenu/Menu.swift:169
func item(id: MenuID) -> MenuItemModel?
The item with id id, searched through every menu and submenu.
Sources/LavaMenu/Menu.swift:188
func item(matchingKey key: Int32, mods: Int32, primary: Int32 = KeyShortcut.platformPrimaryMod) -> MenuItemModel?
First enabled item whose shortcut matches the key event, if any.
Sources/LavaMenu/Menu.swift:196