diff options
-rw-r--r-- | examples/arc/src/main.rs | 3 | ||||
-rw-r--r-- | examples/bezier_tool/src/main.rs | 3 | ||||
-rw-r--r-- | examples/checkbox/src/main.rs | 3 | ||||
-rw-r--r-- | examples/clock/src/main.rs | 3 | ||||
-rw-r--r-- | examples/color_palette/src/main.rs | 15 | ||||
-rw-r--r-- | examples/custom_shader/src/main.rs | 3 | ||||
-rw-r--r-- | examples/download_progress/src/main.rs | 3 | ||||
-rw-r--r-- | examples/layout/src/main.rs | 3 | ||||
-rw-r--r-- | examples/loading_spinners/src/main.rs | 11 | ||||
-rw-r--r-- | examples/multitouch/src/main.rs | 3 | ||||
-rw-r--r-- | examples/pane_grid/src/main.rs | 3 | ||||
-rw-r--r-- | examples/qr_code/src/main.rs | 11 | ||||
-rw-r--r-- | examples/sierpinski_triangle/src/main.rs | 11 | ||||
-rw-r--r-- | examples/solar_system/src/main.rs | 13 | ||||
-rw-r--r-- | examples/stopwatch/src/main.rs | 3 | ||||
-rw-r--r-- | examples/styling/src/main.rs | 3 | ||||
-rw-r--r-- | examples/tour/src/main.rs | 3 | ||||
-rw-r--r-- | examples/url_handler/src/main.rs | 3 | ||||
-rw-r--r-- | examples/vectorial_text/src/main.rs | 13 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/program.rs | 7 |
21 files changed, 64 insertions, 58 deletions
diff --git a/examples/arc/src/main.rs b/examples/arc/src/main.rs index be913a51..12f34838 100644 --- a/examples/arc/src/main.rs +++ b/examples/arc/src/main.rs @@ -7,8 +7,7 @@ use iced::widget::canvas::{ use iced::{Element, Length, Point, Rectangle, Renderer, Subscription, Theme}; pub fn main() -> iced::Result { - iced::sandbox(Arc::update, Arc::view) - .title("Arc - Iced") + iced::sandbox("Arc - Iced", Arc::update, Arc::view) .subscription(Arc::subscription) .theme(|_| Theme::Dark) .antialiased() diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 1bd32e19..9f21508b 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -3,8 +3,7 @@ use iced::widget::{button, column, text}; use iced::{Alignment, Element, Length}; pub fn main() -> iced::Result { - iced::sandbox(Example::update, Example::view) - .title("Bezier tool - Iced") + iced::sandbox("Bezier Tool - Iced", Example::update, Example::view) .antialiased() .run() } diff --git a/examples/checkbox/src/main.rs b/examples/checkbox/src/main.rs index ed7b7f3a..c9ee502e 100644 --- a/examples/checkbox/src/main.rs +++ b/examples/checkbox/src/main.rs @@ -4,8 +4,7 @@ use iced::{Element, Font, Length}; const ICON_FONT: Font = Font::with_name("icons"); pub fn main() -> iced::Result { - iced::sandbox(Example::update, Example::view) - .title("Checkbox - Iced") + iced::sandbox("Checkbox - Iced", Example::update, Example::view) .fonts([include_bytes!("../fonts/icons.ttf").as_slice().into()]) .run() } diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs index c307fab9..fcad5d34 100644 --- a/examples/clock/src/main.rs +++ b/examples/clock/src/main.rs @@ -6,8 +6,7 @@ use iced::{ }; pub fn main() -> iced::Result { - iced::sandbox(Clock::update, Clock::view) - .title("Clock - Iced") + iced::sandbox("Clock - Iced", Clock::update, Clock::view) .subscription(Clock::subscription) .theme(Clock::theme) .antialiased() diff --git a/examples/color_palette/src/main.rs b/examples/color_palette/src/main.rs index f220b94f..46fb3b49 100644 --- a/examples/color_palette/src/main.rs +++ b/examples/color_palette/src/main.rs @@ -13,12 +13,15 @@ use std::marker::PhantomData; use std::ops::RangeInclusive; pub fn main() -> iced::Result { - iced::sandbox(ColorPalette::update, ColorPalette::view) - .theme(ColorPalette::theme) - .title("Color Palette - Iced") - .default_font(Font::MONOSPACE) - .antialiased() - .run() + iced::sandbox( + "Color Palette - Iced", + ColorPalette::update, + ColorPalette::view, + ) + .theme(ColorPalette::theme) + .default_font(Font::MONOSPACE) + .antialiased() + .run() } #[derive(Default)] diff --git a/examples/custom_shader/src/main.rs b/examples/custom_shader/src/main.rs index 5ba9a5d4..341b77b6 100644 --- a/examples/custom_shader/src/main.rs +++ b/examples/custom_shader/src/main.rs @@ -9,9 +9,8 @@ use iced::window; use iced::{Alignment, Color, Element, Length, Subscription}; fn main() -> iced::Result { - iced::sandbox(IcedCubes::update, IcedCubes::view) + iced::sandbox("Custom Shader - Iced", IcedCubes::update, IcedCubes::view) .subscription(IcedCubes::subscription) - .title("Custom Shader - Iced") .run() } diff --git a/examples/download_progress/src/main.rs b/examples/download_progress/src/main.rs index bddf0d28..06ebb9c6 100644 --- a/examples/download_progress/src/main.rs +++ b/examples/download_progress/src/main.rs @@ -4,9 +4,8 @@ use iced::widget::{button, column, container, progress_bar, text, Column}; use iced::{Alignment, Element, Length, Subscription}; pub fn main() -> iced::Result { - iced::sandbox(Example::update, Example::view) + iced::sandbox("Download Progress - Iced", Example::update, Example::view) .subscription(Example::subscription) - .title("Download Progress - Iced") .run() } diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index fc3a1f82..371f2ae2 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -10,8 +10,7 @@ use iced::{ }; pub fn main() -> iced::Result { - iced::sandbox(Layout::update, Layout::view) - .title(Layout::title) + iced::sandbox(Layout::title, Layout::update, Layout::view) .subscription(Layout::subscription) .theme(Layout::theme) .run() diff --git a/examples/loading_spinners/src/main.rs b/examples/loading_spinners/src/main.rs index bf36dc8d..e50cd04c 100644 --- a/examples/loading_spinners/src/main.rs +++ b/examples/loading_spinners/src/main.rs @@ -11,10 +11,13 @@ use circular::Circular; use linear::Linear; pub fn main() -> iced::Result { - iced::sandbox(LoadingSpinners::update, LoadingSpinners::view) - .title("Loading Spinners - Iced") - .antialiased() - .run() + iced::sandbox( + "Loading Spinners - Iced", + LoadingSpinners::update, + LoadingSpinners::view, + ) + .antialiased() + .run() } struct LoadingSpinners { diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs index f4506f51..f3413964 100644 --- a/examples/multitouch/src/main.rs +++ b/examples/multitouch/src/main.rs @@ -13,8 +13,7 @@ use std::collections::HashMap; pub fn main() -> iced::Result { tracing_subscriber::fmt::init(); - iced::sandbox(Multitouch::update, Multitouch::view) - .title("Multitouch - Iced") + iced::sandbox("Multitouch - Iced", Multitouch::update, Multitouch::view) .antialiased() .centered() .run() diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index 005536f7..4c46f550 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -7,9 +7,8 @@ use iced::widget::{ use iced::{Color, Element, Length, Size, Subscription}; pub fn main() -> iced::Result { - iced::sandbox(Example::update, Example::view) + iced::sandbox("Pane Grid - Iced", Example::update, Example::view) .subscription(Example::subscription) - .title("Pane Grid - Iced") .run() } diff --git a/examples/qr_code/src/main.rs b/examples/qr_code/src/main.rs index a7a3a385..a980bfd7 100644 --- a/examples/qr_code/src/main.rs +++ b/examples/qr_code/src/main.rs @@ -4,10 +4,13 @@ use iced::widget::{ use iced::{Alignment, Element, Length, Theme}; pub fn main() -> iced::Result { - iced::sandbox(QRGenerator::update, QRGenerator::view) - .title("QR Code Generator - Iced") - .theme(QRGenerator::theme) - .run() + iced::sandbox( + "QR Code Generator - Iced", + QRGenerator::update, + QRGenerator::view, + ) + .theme(QRGenerator::theme) + .run() } #[derive(Default)] diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs index bb8e67da..82406e62 100644 --- a/examples/sierpinski_triangle/src/main.rs +++ b/examples/sierpinski_triangle/src/main.rs @@ -8,10 +8,13 @@ use rand::Rng; use std::fmt::Debug; fn main() -> iced::Result { - iced::sandbox(SierpinskiEmulator::update, SierpinskiEmulator::view) - .title("Sierpinski Triangle - Iced") - .antialiased() - .run() + iced::sandbox( + "Sierpinski Triangle - Iced", + SierpinskiEmulator::update, + SierpinskiEmulator::view, + ) + .antialiased() + .run() } #[derive(Debug, Default)] diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index a84e86a3..06098a7c 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -22,11 +22,14 @@ use std::time::Instant; pub fn main() -> iced::Result { tracing_subscriber::fmt::init(); - iced::sandbox(SolarSystem::update, SolarSystem::view) - .subscription(SolarSystem::subscription) - .theme(SolarSystem::theme) - .title("Solar System - Iced") - .run() + iced::sandbox( + "Solar System - Iced", + SolarSystem::update, + SolarSystem::view, + ) + .subscription(SolarSystem::subscription) + .theme(SolarSystem::theme) + .run() } #[derive(Default)] diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs index 72c12660..854cc084 100644 --- a/examples/stopwatch/src/main.rs +++ b/examples/stopwatch/src/main.rs @@ -7,10 +7,9 @@ use iced::{Alignment, Element, Length, Subscription, Theme}; use std::time::{Duration, Instant}; pub fn main() -> iced::Result { - iced::sandbox(Stopwatch::update, Stopwatch::view) + iced::sandbox("Stopwatch - Iced", Stopwatch::update, Stopwatch::view) .subscription(Stopwatch::subscription) .theme(Stopwatch::theme) - .title("Stopwatch - Iced") .run() } 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() } diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index c373502e..23c4040d 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -16,8 +16,7 @@ pub fn main() -> iced::Result { #[cfg(not(target_arch = "wasm32"))] tracing_subscriber::fmt::init(); - iced::sandbox(Tour::update, Tour::view) - .title(Tour::title) + iced::sandbox(Tour::title, Tour::update, Tour::view) .centered() .run() } diff --git a/examples/url_handler/src/main.rs b/examples/url_handler/src/main.rs index f8c18200..f16b9051 100644 --- a/examples/url_handler/src/main.rs +++ b/examples/url_handler/src/main.rs @@ -3,9 +3,8 @@ use iced::widget::{container, text}; use iced::{Element, Length, Subscription}; pub fn main() -> iced::Result { - iced::sandbox(App::update, App::view) + iced::sandbox("URL Handler - Iced", App::update, App::view) .subscription(App::subscription) - .title("URL Handler - Iced") .run() } diff --git a/examples/vectorial_text/src/main.rs b/examples/vectorial_text/src/main.rs index aa870716..84347203 100644 --- a/examples/vectorial_text/src/main.rs +++ b/examples/vectorial_text/src/main.rs @@ -6,11 +6,14 @@ use iced::widget::{ use iced::{Element, Length, Point, Rectangle, Renderer, Theme, Vector}; pub fn main() -> iced::Result { - iced::sandbox(VectorialText::update, VectorialText::view) - .theme(|_| Theme::Dark) - .title("Vectorial Text - Iced") - .antialiased() - .run() + iced::sandbox( + "Vectorial Text - Iced", + VectorialText::update, + VectorialText::view, + ) + .theme(|_| Theme::Dark) + .antialiased() + .run() } #[derive(Default)] @@ -370,7 +370,7 @@ where State: Default + 'static, Message: std::fmt::Debug + Send + 'static, { - sandbox(update, view).title(title).run() + sandbox(title, update, view).run() } #[doc(inline)] diff --git a/src/program.rs b/src/program.rs index 746f8f29..ab194a0d 100644 --- a/src/program.rs +++ b/src/program.rs @@ -15,8 +15,7 @@ //! use iced::Theme; //! //! pub fn main() -> iced::Result { -//! iced::sandbox(update, view) -//! .title("A counter") +//! iced::sandbox("A counter", update, view) //! .theme(|_| Theme::Dark) //! .centered() //! .run() @@ -54,7 +53,7 @@ use std::borrow::Cow; /// use iced::widget::{button, column, text, Column}; /// /// pub fn main() -> iced::Result { -/// iced::sandbox(update, view).title("A counter").run() +/// iced::sandbox("A counter", update, view).run() /// } /// /// #[derive(Debug, Clone)] @@ -76,6 +75,7 @@ use std::borrow::Cow; /// } /// ``` pub fn sandbox<State, Message>( + title: impl Title<State>, update: impl Fn(&mut State, Message), view: impl for<'a> self::View<'a, State, Message>, ) -> Program< @@ -138,6 +138,7 @@ where }, settings: Settings::default(), } + .title(title) } /// Creates a [`Program`] that can leverage the [`Command`] API for |