diff options
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) } |