summaryrefslogtreecommitdiffstats
path: root/examples/custom_widget
diff options
context:
space:
mode:
authorLibravatar Gigas002 <24297712+Gigas002@users.noreply.github.com>2024-03-19 22:09:36 +0900
committerLibravatar GitHub <noreply@github.com>2024-03-19 22:09:36 +0900
commitf3a1c785b2743e9c48c3d28df0c6772ce579d7c8 (patch)
tree1b39799f45878d89b4f9e2f9bea8fa8a7ed07150 /examples/custom_widget
parentc9453cd55d84f0dd2ad0050208863d036c98843f (diff)
parent8ce16aba6204cb5c02a709cdf79c309f7b7e0196 (diff)
downloadiced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.gz
iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.bz2
iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.zip
Merge branch 'iced-rs:master' into viewer_content_fit
Diffstat (limited to 'examples/custom_widget')
-rw-r--r--examples/custom_widget/src/main.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs
index 305ef7dd..aa49ebd0 100644
--- a/examples/custom_widget/src/main.rs
+++ b/examples/custom_widget/src/main.rs
@@ -83,10 +83,10 @@ mod circle {
use circle::circle;
use iced::widget::{column, container, slider, text};
-use iced::{Alignment, Element, Length, Sandbox, Settings};
+use iced::{Alignment, Element, Length};
pub fn main() -> iced::Result {
- Example::run(Settings::default())
+ iced::run("Custom Widget - Iced", Example::update, Example::view)
}
struct Example {
@@ -98,17 +98,11 @@ enum Message {
RadiusChanged(f32),
}
-impl Sandbox for Example {
- type Message = Message;
-
+impl Example {
fn new() -> Self {
Example { radius: 50.0 }
}
- fn title(&self) -> String {
- String::from("Custom widget - Iced")
- }
-
fn update(&mut self, message: Message) {
match message {
Message::RadiusChanged(radius) => {
@@ -136,3 +130,9 @@ impl Sandbox for Example {
.into()
}
}
+
+impl Default for Example {
+ fn default() -> Self {
+ Self::new()
+ }
+}