summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.rs15
-rw-r--r--src/lib.rs6
-rw-r--r--src/sandbox.rs2
3 files changed, 17 insertions, 6 deletions
diff --git a/src/application.rs b/src/application.rs
index bda8558c..ae85c841 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,6 +1,6 @@
use crate::window;
use crate::{
- Clipboard, Color, Command, Element, Executor, Settings, Subscription,
+ Clipboard, Color, Command, Element, Executor, Menu, Settings, Subscription,
};
/// An interactive cross-platform application.
@@ -99,7 +99,7 @@ pub trait Application: Sized {
type Executor: Executor;
/// The type of __messages__ your [`Application`] will produce.
- type Message: std::fmt::Debug + Send;
+ type Message: std::fmt::Debug + Clone + Send;
/// The data needed to initialize your [`Application`].
type Flags;
@@ -191,6 +191,13 @@ pub trait Application: Sized {
false
}
+ /// Returns the current system [`Menu`] of the [`Application`].
+ ///
+ /// By default, it returns an empty [`Menu`].
+ fn menu(&self) -> Menu<Self::Message> {
+ Menu::new()
+ }
+
/// Runs the [`Application`].
///
/// On native platforms, this method will take control of the current thread
@@ -296,6 +303,10 @@ where
fn should_exit(&self) -> bool {
self.0.should_exit()
}
+
+ fn menu(&self) -> Menu<Self::Message> {
+ self.0.menu()
+ }
}
#[cfg(target_arch = "wasm32")]
diff --git a/src/lib.rs b/src/lib.rs
index 6a029afd..8cd6aa70 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -245,7 +245,7 @@ pub use sandbox::Sandbox;
pub use settings::Settings;
pub use runtime::{
- futures, Align, Background, Clipboard, Color, Command, Font,
- HorizontalAlignment, Length, Point, Rectangle, Size, Subscription, Vector,
- VerticalAlignment,
+ futures, menu, Align, Background, Clipboard, Color, Command, Font,
+ HorizontalAlignment, Length, Menu, Point, Rectangle, Size, Subscription,
+ Vector, VerticalAlignment,
};
diff --git a/src/sandbox.rs b/src/sandbox.rs
index 10b05a92..cb3cf624 100644
--- a/src/sandbox.rs
+++ b/src/sandbox.rs
@@ -88,7 +88,7 @@ use crate::{
/// ```
pub trait Sandbox {
/// The type of __messages__ your [`Sandbox`] will produce.
- type Message: std::fmt::Debug + Send;
+ type Message: std::fmt::Debug + Clone + Send;
/// Initializes the [`Sandbox`].
///