From 5e4e410b18eb744cf70ae1f18b9ef08611f59150 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 3 Nov 2022 14:53:05 -0300 Subject: remove `windows` method (use commands instead) --- examples/multi_window/src/main.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'examples/multi_window/src') diff --git a/examples/multi_window/src/main.rs b/examples/multi_window/src/main.rs index 0dda1804..2771d728 100644 --- a/examples/multi_window/src/main.rs +++ b/examples/multi_window/src/main.rs @@ -131,6 +131,7 @@ impl Application for Example { } WindowMessage::CloseWindow => { let _ = self.windows.remove(&id); + return window::close(id); } WindowMessage::Resized(pane_grid::ResizeEvent { split, ratio }) => { let window = self.windows.get_mut(&id).unwrap(); @@ -173,8 +174,9 @@ impl Application for Example { title: format!("New window ({})", self.windows.len()), }; - self.windows - .insert(window::Id::new(self.windows.len()), window); + let window_id = window::Id::new(self.windows.len()); + self.windows.insert(window_id, window); + return window::spawn(window_id, Default::default()); } } WindowMessage::Dragged(pane_grid::DragEvent::Dropped { @@ -243,13 +245,6 @@ impl Application for Example { }) } - fn windows(&self) -> Vec<(window::Id, iced::window::Settings)> { - self.windows - .iter() - .map(|(&id, _window)| (id, iced::window::Settings::default())) - .collect() - } - fn close_requested(&self, window: window::Id) -> Self::Message { Message::Window(window, WindowMessage::CloseWindow) } -- cgit