Introduce opaque window::Id type

This commit is contained in:
Richard 2022-06-21 15:59:45 -03:00 committed by bungoboingo
parent 8fdd5ee8b6
commit ec56c0686d
6 changed files with 48 additions and 12 deletions

View file

@ -1,3 +1,4 @@
use crate::window;
use crate::{Command, Element, Executor, Settings, Subscription};
pub use iced_native::application::{Appearance, StyleSheet};
@ -45,6 +46,9 @@ pub trait Application: Sized {
/// title of your application when necessary.
fn title(&self) -> String;
/// TODO(derezzedex)
fn windows(&self) -> Vec<(window::Id, window::Settings)>;
/// Handles a __message__ and updates the state of the [`Application`].
///
/// This is where you define your __update logic__. All the __messages__,
@ -160,6 +164,16 @@ where
self.0.title()
}
fn windows(&self) -> Vec<(window::Id, iced_winit::settings::Window)> {
self.0
.windows()
.into_iter()
.map(|(id, settings)| {
(id, iced_winit::settings::Window::from(settings))
})
.collect()
}
fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
self.0.update(message)
}