Tweak menubar export
This commit is contained in:
3 files changed
+10
-8
No files matched your search
@@ -15,6 +15,7 @@ mod events;
|
|||||||
mod file_upload;
|
mod file_upload;
|
||||||
mod hooks;
|
mod hooks;
|
||||||
mod ipc;
|
mod ipc;
|
||||||
|
mod menubar;
|
||||||
mod protocol;
|
mod protocol;
|
||||||
mod query;
|
mod query;
|
||||||
mod shortcut;
|
mod shortcut;
|
||||||
@@ -28,10 +29,6 @@ mod collect_assets;
|
|||||||
#[cfg(any(target_os = "ios", target_os = "android"))]
|
#[cfg(any(target_os = "ios", target_os = "android"))]
|
||||||
mod mobile_shortcut;
|
mod mobile_shortcut;
|
||||||
|
|
||||||
// menu bar is only supported on desktop platforms
|
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
|
||||||
mod menubar;
|
|
||||||
|
|
||||||
// The main entrypoint for this crate
|
// The main entrypoint for this crate
|
||||||
pub use launch::*;
|
pub use launch::*;
|
||||||
mod launch;
|
mod launch;
|
||||||
@@ -50,6 +47,5 @@ pub use desktop_context::{
|
|||||||
window, DesktopContext, DesktopService, WryEventHandler, WryEventHandlerId,
|
window, DesktopContext, DesktopService, WryEventHandler, WryEventHandlerId,
|
||||||
};
|
};
|
||||||
pub use hooks::{use_asset_handler, use_global_shortcut, use_window, use_wry_event_handler};
|
pub use hooks::{use_asset_handler, use_global_shortcut, use_window, use_wry_event_handler};
|
||||||
pub use menubar::build_default_menu_bar;
|
|
||||||
pub use shortcut::{ShortcutHandle, ShortcutId, ShortcutRegistryError};
|
pub use shortcut::{ShortcutHandle, ShortcutId, ShortcutRegistryError};
|
||||||
pub use wry::RequestAsyncResponder;
|
pub use wry::RequestAsyncResponder;
|
||||||
@@ -1,12 +1,17 @@
|
|||||||
use muda::{Menu, PredefinedMenuItem, Submenu};
|
|
||||||
use tao::window::Window;
|
use tao::window::Window;
|
||||||
|
|
||||||
pub fn build_menu(window: &Window, default_menu_bar: bool) {
|
pub fn build_menu(window: &Window, default_menu_bar: bool) {
|
||||||
if default_menu_bar {
|
if default_menu_bar {
|
||||||
build_menu_bar(build_default_menu_bar(), window)
|
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
||||||
|
impl_::build_menu_bar(impl_::build_default_menu_bar(), window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
||||||
|
mod impl_ {
|
||||||
|
use super::*;
|
||||||
|
use muda::{Menu, PredefinedMenuItem, Submenu};
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn build_menu_bar(menu: Menu, window: &Window) {
|
pub fn build_menu_bar(menu: Menu, window: &Window) {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
@@ -67,3 +72,4 @@ pub fn build_default_menu_bar() -> Menu {
|
|||||||
|
|
||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use wry::application::event_loop::EventLoopWindowTarget;
|
use tao::event_loop::EventLoopWindowTarget;
|
||||||
|
|
||||||
use dioxus_html::input_data::keyboard_types::Modifiers;
|
use dioxus_html::input_data::keyboard_types::Modifiers;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user