From c22269bff3085012d326a0df77bf27ad5bcb41b7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 05:33:47 +0100 Subject: Introduce `Program` API --- examples/styling/src/main.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'examples/styling/src') diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index befdfc1b..c00c8caf 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -3,10 +3,13 @@ use iced::widget::{ progress_bar, row, scrollable, slider, text, text_input, toggler, vertical_rule, vertical_space, }; -use iced::{Alignment, Element, Length, Sandbox, Settings, Theme}; +use iced::{Alignment, Element, Length, Theme}; pub fn main() -> iced::Result { - Styling::run(Settings::default()) + iced::sandbox(Styling::update, Styling::view) + .theme(Styling::theme) + .title("Styling - Iced") + .run() } #[derive(Default)] @@ -28,17 +31,7 @@ enum Message { TogglerToggled(bool), } -impl Sandbox for Styling { - type Message = Message; - - fn new() -> Self { - Styling::default() - } - - fn title(&self) -> String { - String::from("Styling - Iced") - } - +impl Styling { fn update(&mut self, message: Message) { match message { Message::ThemeChanged(theme) => { -- cgit From bb71e8481ed59f991b9bd9dc55ea7e011ba0aac6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 16:12:07 +0100 Subject: Make `sandbox` helper take a `title` as well --- examples/styling/src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/styling/src') diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index c00c8caf..110bd3b8 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -6,9 +6,8 @@ use iced::widget::{ use iced::{Alignment, Element, Length, Theme}; pub fn main() -> iced::Result { - iced::sandbox(Styling::update, Styling::view) + iced::sandbox("Styling - Iced", Styling::update, Styling::view) .theme(Styling::theme) - .title("Styling - Iced") .run() } -- cgit From 28a27f08edccd53e06ad693e63b0a62dae921da5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 19:14:13 +0100 Subject: Remove `sandbox` by making `application` more generic :tada: --- examples/styling/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/styling/src') diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 110bd3b8..ce14aacb 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -6,7 +6,7 @@ use iced::widget::{ use iced::{Alignment, Element, Length, Theme}; pub fn main() -> iced::Result { - iced::sandbox("Styling - Iced", Styling::update, Styling::view) + iced::application("Styling - Iced", Styling::update, Styling::view) .theme(Styling::theme) .run() } -- cgit From 54f44754eb216d4b2c08cd2a7c3582f1dc295205 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 17 Mar 2024 14:16:38 +0100 Subject: Move `Program` to `application` module --- examples/styling/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/styling/src') diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index ce14aacb..73268da0 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -6,7 +6,7 @@ use iced::widget::{ use iced::{Alignment, Element, Length, Theme}; pub fn main() -> iced::Result { - iced::application("Styling - Iced", Styling::update, Styling::view) + iced::program("Styling - Iced", Styling::update, Styling::view) .theme(Styling::theme) .run() } -- cgit