diff options
author | 2020-01-16 18:34:20 +0100 | |
---|---|---|
committer | 2020-01-16 18:34:20 +0100 | |
commit | 11495b48eec8cdb6e4e3ae450983b26fe6b2eb15 (patch) | |
tree | 8574a5f51e2ab5ce7973b4f89658c5f15b53c31b /src/application.rs | |
parent | 5de404ddd9484c6e1113697d749524ac79d8c763 (diff) | |
parent | c96492b95660640eb2dd66a77c96ad32d5d5b0ae (diff) | |
download | iced-11495b48eec8cdb6e4e3ae450983b26fe6b2eb15.tar.gz iced-11495b48eec8cdb6e4e3ae450983b26fe6b2eb15.tar.bz2 iced-11495b48eec8cdb6e4e3ae450983b26fe6b2eb15.zip |
Merge pull request #161 from hecrj/feature/window-mode
Window modes
Diffstat (limited to 'src/application.rs')
-rw-r--r-- | src/application.rs | 23 |
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) } |