From ec41918ec40bddaba81235372f1566da59fd09f2 Mon Sep 17 00:00:00 2001 From: bungoboingo Date: Thu, 5 Jan 2023 15:26:28 -0800 Subject: Implemented window title update functionality for multiwindow. --- examples/multi_window/src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples/multi_window/src') diff --git a/examples/multi_window/src/main.rs b/examples/multi_window/src/main.rs index 9fe6b481..b9f0514c 100644 --- a/examples/multi_window/src/main.rs +++ b/examples/multi_window/src/main.rs @@ -26,6 +26,7 @@ struct Example { _focused: window::Id, } +#[derive(Debug)] struct Window { title: String, panes: pane_grid::State, @@ -80,8 +81,11 @@ impl Application for Example { ) } - fn title(&self) -> String { - String::from("Multi windowed pane grid - Iced") + fn title(&self, window: window::Id) -> String { + self.windows + .get(&window) + .map(|w| w.title.clone()) + .unwrap_or(String::from("New Window")) } fn update(&mut self, message: Message) -> Command { @@ -262,7 +266,6 @@ impl Application for Example { &window.title, WindowMessage::TitleChanged, ), - button(text("Apply")).style(theme::Button::Primary), button(text("Close")) .on_press(WindowMessage::CloseWindow) .style(theme::Button::Destructive), @@ -389,6 +392,7 @@ impl std::fmt::Display for SelectableWindow { } } +#[derive(Debug)] struct Pane { id: usize, pub axis: pane_grid::Axis, -- cgit