Expand description
A window menu.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.items: Vec<MenuEntry, Global>
Implementations§
source§impl Menu
impl Menu
sourcepub fn os_default(app_name: &str) -> Menu
pub fn os_default(app_name: &str) -> Menu
Creates a menu filled with default menu items and submenus.
Platform-specific:
-
Windows:
- File
- CloseWindow
- Quit
- Edit
- Cut
- Copy
- Paste
- Window
- Minimize
- CloseWindow
- File
-
Linux:
- File
- CloseWindow
- Quit
- Window
- Minimize
- CloseWindow
- File
-
macOS:
- App
- About
- Separator
- Services
- Separator
- Hide
- HideOthers
- ShowAll
- Separator
- Quit
- File
- CloseWindow
- Edit
- Undo
- Redo
- Separator
- Cut
- Copy
- Paste
- SelectAll
- View
- EnterFullScreen
- Window
- Minimize
- Zoom
- Separator
- CloseWindow
- App
sourcepub fn with_items<I>(items: I) -> Menuwhere
I: IntoIterator<Item = MenuEntry>,
pub fn with_items<I>(items: I) -> Menuwhere
I: IntoIterator<Item = MenuEntry>,
Creates a new window menu with the given items.
Examples
Menu::with_items([
MenuItem::SelectAll.into(),
#[cfg(target_os = "macos")]
MenuItem::Redo.into(),
CustomMenuItem::new("toggle", "Toggle visibility").into(),
Submenu::new("View", Menu::new()).into(),
]);
sourcepub fn add_item(self, item: CustomMenuItem) -> Menu
pub fn add_item(self, item: CustomMenuItem) -> Menu
Adds the custom menu item to the menu.
sourcepub fn add_native_item(self, item: MenuItem) -> Menu
pub fn add_native_item(self, item: MenuItem) -> Menu
Adds a native item to the menu.
Adds an entry with submenu.