pub struct MenuBarData {
pub menus: Vec<MenuData>,
}Expand description
A menu bar as data, for Services::set_menu: the app’s menus, or a
window’s. Hidden items and menus are left out.
Fields§
Implementations§
Source§impl MenuBarData
impl MenuBarData
Sourcepub fn merged(&self, window: &MenuBarData) -> MenuBarData
pub fn merged(&self, window: &MenuBarData) -> MenuBarData
The menus of a window that has menus of its own: the app’s, then the window’s. A window menu titled like an app menu joins it, after a separator.
Sourcepub fn for_window(&self, own: Option<&MenuBarData>, modal: bool) -> MenuBarData
pub fn for_window(&self, own: Option<&MenuBarData>, modal: bool) -> MenuBarData
What a window shows on platforms that put menus in each window
(GTK, WinUI, Kirigami): the app’s with its own (merged).
A modal window is a dialog, and dialogs there have no app menus, so
it shows only its own.
Sourcepub fn take_role(&mut self, role: MenuRole) -> Option<MenuItemData>
pub fn take_role(&mut self, role: MenuRole) -> Option<MenuItemData>
Takes out the first item with this role, for a platform that puts it somewhere of its own. Separators it leaves at an edge or doubled go too, and so does a menu it leaves empty.
Sourcepub fn items(&self) -> Vec<&MenuItemData>
pub fn items(&self) -> Vec<&MenuItemData>
Every item, submenus’ included, in order.
Sourcepub fn same_structure(&self, other: &MenuBarData) -> bool
pub fn same_structure(&self, other: &MenuBarData) -> bool
The same menus, submenus, items, titles, shortcuts and roles: only enabled and checked states differ, which platforms can update without rebuilding (and closing) an open menu.