diff options
author | 2023-01-05 15:26:28 -0800 | |
---|---|---|
committer | 2023-01-09 11:28:07 -0800 | |
commit | ec41918ec40bddaba81235372f1566da59fd09f2 (patch) | |
tree | fb530943ccf14dfec3820bf65f71a9572fd3d8be /examples/multi_window | |
parent | 1944e98f82b7efd5b268e04ba5ced065e55a218e (diff) | |
download | iced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.gz iced-ec41918ec40bddaba81235372f1566da59fd09f2.tar.bz2 iced-ec41918ec40bddaba81235372f1566da59fd09f2.zip |
Implemented window title update functionality for multiwindow.
Diffstat (limited to 'examples/multi_window')
-rw-r--r-- | examples/multi_window/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/multi_window/src/main.rs | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/examples/multi_window/Cargo.toml b/examples/multi_window/Cargo.toml index 6de895d7..62198595 100644 --- a/examples/multi_window/Cargo.toml +++ b/examples/multi_window/Cargo.toml @@ -10,4 +10,4 @@ publish = false iced = { path = "../..", features = ["debug", "multi_window"] } env_logger = "0.10.0" iced_native = { path = "../../native" } -iced_lazy = { path = "../../lazy" }
\ No newline at end of file +iced_lazy = { path = "../../lazy" } 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<Pane>, @@ -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<Message> { @@ -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, |