summaryrefslogtreecommitdiffstats
path: root/examples/tour.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-21 18:00:27 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-21 18:00:27 +0100
commitba56a561b254c9a5f3d23cb54d23dc311759ab4c (patch)
tree3d262b1e892d83f7493a99737a267204a191e317 /examples/tour.rs
parent428509c84a142a653be3ec4bbff0c23c466c44fa (diff)
downloadiced-ba56a561b254c9a5f3d23cb54d23dc311759ab4c.tar.gz
iced-ba56a561b254c9a5f3d23cb54d23dc311759ab4c.tar.bz2
iced-ba56a561b254c9a5f3d23cb54d23dc311759ab4c.zip
Implement `iced::Sandbox` trait for simple apps
Diffstat (limited to 'examples/tour.rs')
-rw-r--r--examples/tour.rs31
1 files changed, 13 insertions, 18 deletions
diff --git a/examples/tour.rs b/examples/tour.rs
index 8a805088..0169c8e1 100644
--- a/examples/tour.rs
+++ b/examples/tour.rs
@@ -1,7 +1,7 @@
use iced::{
- button, scrollable, slider, text_input, Application, Background, Button,
- Checkbox, Color, Column, Command, Container, Element, HorizontalAlignment,
- Image, Length, Radio, Row, Scrollable, Slider, Text, TextInput,
+ button, scrollable, slider, text_input, Background, Button, Checkbox,
+ Color, Column, Container, Element, HorizontalAlignment, Image, Length,
+ Radio, Row, Sandbox, Scrollable, Slider, Text, TextInput,
};
pub fn main() {
@@ -18,27 +18,24 @@ pub struct Tour {
debug: bool,
}
-impl Application for Tour {
+impl Sandbox for Tour {
type Message = Message;
- fn new() -> (Tour, Command<Message>) {
- (
- Tour {
- steps: Steps::new(),
- scroll: scrollable::State::new(),
- back_button: button::State::new(),
- next_button: button::State::new(),
- debug: true,
- },
- Command::none(),
- )
+ fn new() -> Tour {
+ Tour {
+ steps: Steps::new(),
+ scroll: scrollable::State::new(),
+ back_button: button::State::new(),
+ next_button: button::State::new(),
+ debug: true,
+ }
}
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();
@@ -50,8 +47,6 @@ impl Application for Tour {
self.steps.update(step_msg, &mut self.debug);
}
}
-
- Command::none()
}
fn view(&mut self) -> Element<Message> {