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.
This commit is contained in:
parent
d6b20d3e79
commit
c96492b956
11 changed files with 81 additions and 42 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue