summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-17 13:46:52 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-17 13:46:52 +0100
commit846d76cd3f3f2faae5efbb3fda2a2bcb3b064481 (patch)
tree44c407d10ffc60856a83019a5794544723ade037 /examples
parent9152904af1630a6d373b2fd7c284835bf0a3ca95 (diff)
downloadiced-846d76cd3f3f2faae5efbb3fda2a2bcb3b064481.tar.gz
iced-846d76cd3f3f2faae5efbb3fda2a2bcb3b064481.tar.bz2
iced-846d76cd3f3f2faae5efbb3fda2a2bcb3b064481.zip
Remove `Sandbox` trait :tada:
Diffstat (limited to 'examples')
-rw-r--r--examples/arc/src/main.rs2
-rw-r--r--examples/bezier_tool/src/main.rs2
-rw-r--r--examples/clock/src/main.rs2
-rw-r--r--examples/color_palette/src/main.rs2
-rw-r--r--examples/events/src/main.rs2
-rw-r--r--examples/gradient/src/main.rs31
-rw-r--r--examples/loading_spinners/src/main.rs2
-rw-r--r--examples/multitouch/src/main.rs2
-rw-r--r--examples/sierpinski_triangle/src/main.rs2
-rw-r--r--examples/vectorial_text/src/main.rs2
10 files changed, 22 insertions, 27 deletions
diff --git a/examples/arc/src/main.rs b/examples/arc/src/main.rs
index cd62ac17..b1e8402a 100644
--- a/examples/arc/src/main.rs
+++ b/examples/arc/src/main.rs
@@ -10,7 +10,7 @@ pub fn main() -> iced::Result {
iced::application("Arc - Iced", Arc::update, Arc::view)
.subscription(Arc::subscription)
.theme(|_| Theme::Dark)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs
index 1d9f7ddb..d822c69b 100644
--- a/examples/bezier_tool/src/main.rs
+++ b/examples/bezier_tool/src/main.rs
@@ -4,7 +4,7 @@ use iced::{Alignment, Element, Length};
pub fn main() -> iced::Result {
iced::application("Bezier Tool - Iced", Example::update, Example::view)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs
index 953ecf6f..ebb22cef 100644
--- a/examples/clock/src/main.rs
+++ b/examples/clock/src/main.rs
@@ -11,7 +11,7 @@ pub fn main() -> iced::Result {
iced::application("Clock - Iced", Clock::update, Clock::view)
.subscription(Clock::subscription)
.theme(Clock::theme)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/color_palette/src/main.rs b/examples/color_palette/src/main.rs
index b997563f..2cded2db 100644
--- a/examples/color_palette/src/main.rs
+++ b/examples/color_palette/src/main.rs
@@ -20,7 +20,7 @@ pub fn main() -> iced::Result {
)
.theme(ColorPalette::theme)
.default_font(Font::MONOSPACE)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs
index 6eb11cb8..e18fe299 100644
--- a/examples/events/src/main.rs
+++ b/examples/events/src/main.rs
@@ -7,7 +7,7 @@ use iced::{Alignment, Command, Element, Length, Subscription};
pub fn main() -> iced::Result {
iced::application("Events - Iced", Events::update, Events::view)
.subscription(Events::subscription)
- .ignore_close_request()
+ .exit_on_close_request(false)
.run()
}
diff --git a/examples/gradient/src/main.rs b/examples/gradient/src/main.rs
index 8ed4c830..6cfe395a 100644
--- a/examples/gradient/src/main.rs
+++ b/examples/gradient/src/main.rs
@@ -1,22 +1,17 @@
use iced::application;
+use iced::gradient;
use iced::widget::{
checkbox, column, container, horizontal_space, row, slider, text,
};
-use iced::{gradient, window};
-use iced::{
- Alignment, Color, Element, Length, Radians, Sandbox, Settings, Theme,
-};
+use iced::{Alignment, Color, Element, Length, Radians, Theme};
pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
- Gradient::run(Settings {
- window: window::Settings {
- transparent: true,
- ..Default::default()
- },
- ..Default::default()
- })
+ iced::application("Gradient - Iced", Gradient::update, Gradient::view)
+ .style(Gradient::style)
+ .transparent(true)
+ .run()
}
#[derive(Debug, Clone, Copy)]
@@ -35,9 +30,7 @@ enum Message {
TransparentToggled(bool),
}
-impl Sandbox for Gradient {
- type Message = Message;
-
+impl Gradient {
fn new() -> Self {
Self {
start: Color::WHITE,
@@ -47,10 +40,6 @@ impl Sandbox for Gradient {
}
}
- fn title(&self) -> String {
- String::from("Gradient")
- }
-
fn update(&mut self, message: Message) {
match message {
Message::StartChanged(color) => self.start = color,
@@ -118,6 +107,12 @@ impl Sandbox for Gradient {
}
}
+impl Default for Gradient {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
fn color_picker(label: &str, color: Color) -> Element<'_, Color> {
row![
text(label).width(64),
diff --git a/examples/loading_spinners/src/main.rs b/examples/loading_spinners/src/main.rs
index c3308134..3261bdcd 100644
--- a/examples/loading_spinners/src/main.rs
+++ b/examples/loading_spinners/src/main.rs
@@ -16,7 +16,7 @@ pub fn main() -> iced::Result {
LoadingSpinners::update,
LoadingSpinners::view,
)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs
index 985c0ab9..69717310 100644
--- a/examples/multitouch/src/main.rs
+++ b/examples/multitouch/src/main.rs
@@ -14,7 +14,7 @@ pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
iced::application("Multitouch - Iced", Multitouch::update, Multitouch::view)
- .antialiased()
+ .antialiasing(true)
.centered()
.run()
}
diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs
index ee3039d8..c7287516 100644
--- a/examples/sierpinski_triangle/src/main.rs
+++ b/examples/sierpinski_triangle/src/main.rs
@@ -13,7 +13,7 @@ fn main() -> iced::Result {
SierpinskiEmulator::update,
SierpinskiEmulator::view,
)
- .antialiased()
+ .antialiasing(true)
.run()
}
diff --git a/examples/vectorial_text/src/main.rs b/examples/vectorial_text/src/main.rs
index 37961635..7b7814ae 100644
--- a/examples/vectorial_text/src/main.rs
+++ b/examples/vectorial_text/src/main.rs
@@ -12,7 +12,7 @@ pub fn main() -> iced::Result {
VectorialText::view,
)
.theme(|_| Theme::Dark)
- .antialiased()
+ .antialiasing(true)
.run()
}