Struct tauri_runtime::menu::Menu
source · 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>
Implementations
sourceimpl Menu
impl Menu
sourcepub fn os_default(app_name: &str) -> Self
pub fn os_default(app_name: &str) -> Self
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: IntoIterator<Item = MenuEntry>>(items: I) -> Self
pub fn with_items<I: IntoIterator<Item = MenuEntry>>(items: I) -> Self
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) -> Self
pub fn add_item(self, item: CustomMenuItem) -> Self
Adds the custom menu item to the menu.
sourcepub fn add_native_item(self, item: MenuItem) -> Self
pub fn add_native_item(self, item: MenuItem) -> Self
Adds a native item to the menu.
Adds an entry with submenu.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Menu
impl Send for Menu
impl Sync for Menu
impl Unpin for Menu
impl UnwindSafe for Menu
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more