summaryrefslogtreecommitdiffstats
path: root/examples/tour/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tour/src/main.rs')
-rw-r--r--examples/tour/src/main.rs40
1 files changed, 24 insertions, 16 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index c9678b9d..c0bd2efe 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -1,7 +1,8 @@
use iced::{
- button, scrollable, slider, text_input, Button, Checkbox, Color, Column,
- Container, Element, HorizontalAlignment, Image, Length, Radio, Row,
- Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput,
+ button, executor, scrollable, slider, text_input, Application, Button,
+ Checkbox, Color, Column, Command, Container, Element, HorizontalAlignment,
+ Image, Length, Radio, Row, Scrollable, Settings, Slider, Space, Text,
+ TextInput,
};
pub fn main() {
@@ -18,24 +19,29 @@ pub struct Tour {
debug: bool,
}
-impl Sandbox for Tour {
+impl Application for Tour {
+ type Executor = executor::Null;
type Message = Message;
-
- fn new() -> Tour {
- Tour {
- steps: Steps::new(),
- scroll: scrollable::State::new(),
- back_button: button::State::new(),
- next_button: button::State::new(),
- debug: false,
- }
+ type Flags = ();
+
+ fn new(_flags: ()) -> (Tour, Command<Message>) {
+ (
+ Tour {
+ steps: Steps::new(),
+ scroll: scrollable::State::new(),
+ back_button: button::State::new(),
+ next_button: button::State::new(),
+ debug: false,
+ },
+ Command::none(),
+ )
}
fn title(&self) -> String {
format!("{} - Iced", self.steps.title())
}
- fn update(&mut self, event: Message) {
+ fn update(&mut self, event: Message) -> Command<Message> {
match event {
Message::BackPressed => {
self.steps.go_back();
@@ -47,6 +53,8 @@ impl Sandbox for Tour {
self.steps.update(step_msg, &mut self.debug);
}
}
+
+ Command::none()
}
fn view(&mut self) -> Element<Message> {
@@ -764,7 +772,7 @@ mod style {
Button::Secondary => Color::from_rgb(0.5, 0.5, 0.5),
})),
border_radius: 12,
- shadow_offset: Vector::new(1.0, 1.0),
+ shadow_offset: Vector::new(0.0, 1.0),
text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE),
..button::Style::default()
}
@@ -773,7 +781,7 @@ mod style {
fn hovered(&self) -> button::Style {
button::Style {
text_color: Color::WHITE,
- shadow_offset: Vector::new(1.0, 2.0),
+ shadow_offset: Vector::new(0.0, 2.0),
..self.active()
}
}