add default menu bar in dioxus-desktop to resolve #1691

fixup naming and expose disable_default_menu_bar with builder function
This commit is contained in:
Pascal committed 2023-12-06 23:00:01 +01:00
1 parent 8530f53692
commit e4d60c8dfc
2 files changed
+70 -2

No files matched your search

+8
View File
@@ -36,6 +36,7 @@ pub struct Config {
pub(crate) root_name: String,
pub(crate) background_color: Option<(u8, u8, u8, u8)>,
pub(crate) last_window_close_behaviour: WindowCloseBehaviour,
pub(crate) disable_default_menu_bar: bool,
}
type DropHandler = Box<dyn Fn(&Window, FileDropEvent) -> bool>;
@@ -65,9 +66,16 @@ impl Config {
root_name: "main".to_string(),
background_color: None,
last_window_close_behaviour: WindowCloseBehaviour::LastWindowExitsApp,
disable_default_menu_bar: false,
}
}
/// Set whether the default menu bar should be disabled.
pub fn with_disable_default_menu_bar(mut self, disable: bool) -> Self {
self.disable_default_menu_bar = disable;
self
}
/// set the directory from which assets will be searched in release mode
pub fn with_resource_directory(mut self, path: impl Into<PathBuf>) -> Self {
self.resource_dir = Some(path.into());