summaryrefslogtreecommitdiffstats
path: root/examples/tour
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-28 22:50:40 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-05-28 22:50:40 +0200
commit6de0a2c37129b735dac3c6aec461f18a0c1bcbc8 (patch)
treee7826e0a890a1a45fc4c7566afd9a6a8bfad822f /examples/tour
parent7f9813d4b3cf60563db602414f6e49abdd634ab2 (diff)
downloadiced-6de0a2c37129b735dac3c6aec461f18a0c1bcbc8.tar.gz
iced-6de0a2c37129b735dac3c6aec461f18a0c1bcbc8.tar.bz2
iced-6de0a2c37129b735dac3c6aec461f18a0c1bcbc8.zip
Use `Sandbox` in `tour` example
Diffstat (limited to 'examples/tour')
-rw-r--r--examples/tour/src/main.rs36
1 files changed, 14 insertions, 22 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index c0bd2efe..ffadb14f 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -1,8 +1,7 @@
use iced::{
- 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,
+ button, scrollable, slider, text_input, Button, Checkbox, Color, Column,
+ Container, Element, HorizontalAlignment, Image, Length, Radio, Row,
+ Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput,
};
pub fn main() {
@@ -19,29 +18,24 @@ pub struct Tour {
debug: bool,
}
-impl Application for Tour {
- type Executor = executor::Null;
+impl Sandbox for Tour {
type Message = Message;
- 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 new() -> Tour {
+ Tour {
+ steps: Steps::new(),
+ scroll: scrollable::State::new(),
+ back_button: button::State::new(),
+ next_button: button::State::new(),
+ debug: false,
+ }
}
fn title(&self) -> String {
format!("{} - Iced", self.steps.title())
}
- fn update(&mut self, event: Message) -> Command<Message> {
+ fn update(&mut self, event: Message) {
match event {
Message::BackPressed => {
self.steps.go_back();
@@ -53,8 +47,6 @@ impl Application for Tour {
self.steps.update(step_msg, &mut self.debug);
}
}
-
- Command::none()
}
fn view(&mut self) -> Element<Message> {