Introduce Program::run_with to control the initial state
This commit is contained in:
parent
92f8dddc2c
commit
943b6c9657
2 changed files with 60 additions and 37 deletions
|
|
@ -21,19 +21,13 @@ pub fn main() -> iced::Result {
|
|||
.run()
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Tour {
|
||||
steps: Steps,
|
||||
debug: bool,
|
||||
}
|
||||
|
||||
impl Tour {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
steps: Steps::new(),
|
||||
debug: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
format!("{} - Iced", self.steps.title())
|
||||
}
|
||||
|
|
@ -90,12 +84,6 @@ impl Tour {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Tour {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Message {
|
||||
BackPressed,
|
||||
|
|
@ -177,6 +165,12 @@ impl Steps {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Steps {
|
||||
fn default() -> Self {
|
||||
Steps::new()
|
||||
}
|
||||
}
|
||||
|
||||
enum Step {
|
||||
Welcome,
|
||||
Slider {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue