diff options
author | 2022-11-03 14:53:05 -0300 | |
---|---|---|
committer | 2023-01-09 11:28:07 -0800 | |
commit | 5e4e410b18eb744cf70ae1f18b9ef08611f59150 (patch) | |
tree | b9fb0e27d59c2e0177296f3eb642fa3337c1ddec /examples/multi_window | |
parent | ac20f35c6245bbafffd4d047764fb04e66dcfe75 (diff) | |
download | iced-5e4e410b18eb744cf70ae1f18b9ef08611f59150.tar.gz iced-5e4e410b18eb744cf70ae1f18b9ef08611f59150.tar.bz2 iced-5e4e410b18eb744cf70ae1f18b9ef08611f59150.zip |
remove `windows` method (use commands instead)
Diffstat (limited to 'examples/multi_window')
-rw-r--r-- | examples/multi_window/src/main.rs | 13 |
1 files changed, 4 insertions, 9 deletions
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) } |