summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-16 05:54:22 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-16 05:54:22 +0100
commitc96492b95660640eb2dd66a77c96ad32d5d5b0ae (patch)
treed072f613ac78a7389456681b48650badaca8d60b /src/application.rs
parentd6b20d3e796951e6b42726fddc78fbb1b9aaa094 (diff)
downloadiced-c96492b95660640eb2dd66a77c96ad32d5d5b0ae.tar.gz
iced-c96492b95660640eb2dd66a77c96ad32d5d5b0ae.tar.bz2
iced-c96492b95660640eb2dd66a77c96ad32d5d5b0ae.zip
Expose `window::Mode` in `iced`
Although the Fullscreen API in the Web platform has some limitations, it is still useful to be able to support fullscreen on the native side.
Diffstat (limited to 'src/application.rs')
-rw-r--r--src/application.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/application.rs b/src/application.rs
index 5ea64ba8..b940cc17 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,4 +1,4 @@
-use crate::{Command, Element, Settings, Subscription};
+use crate::{window, Command, Element, Settings, Subscription};
/// An interactive cross-platform application.
///
@@ -138,6 +138,20 @@ pub trait Application: Sized {
/// [`Application`]: trait.Application.html
fn view(&mut self) -> Element<'_, Self::Message>;
+ /// Returns the current [`Application`] mode.
+ ///
+ /// The runtime will automatically transition your application if a new mode
+ /// is returned.
+ ///
+ /// Currently, the mode only has an effect in native platforms.
+ ///
+ /// By default, an application will run in windowed mode.
+ ///
+ /// [`Application`]: trait.Application.html
+ fn mode(&self) -> window::Mode {
+ window::Mode::Windowed
+ }
+
/// Runs the [`Application`].
///
/// This method will take control of the current thread and __will NOT
@@ -183,6 +197,13 @@ where
self.0.title()
}
+ fn mode(&self) -> iced_winit::Mode {
+ match self.0.mode() {
+ window::Mode::Windowed => iced_winit::Mode::Windowed,
+ window::Mode::Fullscreen => iced_winit::Mode::Fullscreen,
+ }
+ }
+
fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
self.0.update(message)
}