mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
* refactor(core): remove `Params` and replace with strings * add tauri-utils to changelog * update default runtime macro to accept type and feature * remove accidental default feature addition * remove changefile todo items that have no futher action * fix clippy warning * update changefile * finish change file * fix splashscreen example * fix markdown typo [skip ci] * remove final uses of `Params` * add license header to new runtime module in tauri-macros * update plugin guide to use runtime instead of params
39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
use tauri::{CustomMenuItem, Menu, MenuItem, Submenu};
|
|
|
|
pub fn get_menu() -> Menu {
|
|
#[allow(unused_mut)]
|
|
let mut disable_item =
|
|
CustomMenuItem::new("disable-menu", "Disable menu").accelerator("CmdOrControl+D");
|
|
#[allow(unused_mut)]
|
|
let mut test_item = CustomMenuItem::new("test", "Test").accelerator("CmdOrControl+T");
|
|
#[cfg(target_os = "macos")]
|
|
{
|
|
disable_item = disable_item.native_image(tauri::NativeImage::MenuOnState);
|
|
test_item = test_item.native_image(tauri::NativeImage::Add);
|
|
}
|
|
|
|
// create a submenu
|
|
let my_sub_menu = Menu::new().add_item(disable_item);
|
|
|
|
let my_app_menu = Menu::new()
|
|
.add_native_item(MenuItem::Copy)
|
|
.add_submenu(Submenu::new("Sub menu", my_sub_menu));
|
|
|
|
let test_menu = Menu::new()
|
|
.add_item(CustomMenuItem::new(
|
|
"selected/disabled",
|
|
"Selected and disabled",
|
|
))
|
|
.add_native_item(MenuItem::Separator)
|
|
.add_item(test_item);
|
|
|
|
// add all our childs to the menu (order is how they'll appear)
|
|
Menu::new()
|
|
.add_submenu(Submenu::new("My app", my_app_menu))
|
|
.add_submenu(Submenu::new("Other menu", test_menu))
|
|
}
|