summaryrefslogtreecommitdiffstats
path: root/examples/tour/src/main.rs
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/tour/src/main.rs
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/tour/src/main.rs')
-rw-r--r--examples/tour/src/main.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index f5791ad7..a88c0dba 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -4,7 +4,7 @@ use iced::widget::{
scrollable, slider, text, text_input, toggler, vertical_space,
};
use iced::widget::{Button, Column, Container, Slider};
-use iced::{Color, Element, Font, Length, Pixels, Sandbox, Settings};
+use iced::{Color, Element, Font, Length, Pixels};
pub fn main() -> iced::Result {
#[cfg(target_arch = "wasm32")]
@@ -16,24 +16,18 @@ pub fn main() -> iced::Result {
#[cfg(not(target_arch = "wasm32"))]
tracing_subscriber::fmt::init();
- Tour::run(Settings::default())
+ iced::program(Tour::title, Tour::update, Tour::view)
+ .centered()
+ .run()
}
+#[derive(Default)]
pub struct Tour {
steps: Steps,
debug: bool,
}
-impl Sandbox for Tour {
- type Message = Message;
-
- fn new() -> Tour {
- Tour {
- steps: Steps::new(),
- debug: false,
- }
- }
-
+impl Tour {
fn title(&self) -> String {
format!("{} - Iced", self.steps.title())
}
@@ -171,6 +165,12 @@ impl Steps {
}
}
+impl Default for Steps {
+ fn default() -> Self {
+ Steps::new()
+ }
+}
+
enum Step {
Welcome,
Slider {