1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use fltk::{
app, button, group,
prelude::{GroupExt, WidgetExt},
window,
};
pub fn show_wizard(_but: &mut button::Button) {
let mut win = window::Window::default()
.with_size(400, 300)
.with_label("Wizard");
let mut wizard = group::Wizard::default().with_size(400, 300);
let grp1 = group::Group::default().size_of(&wizard);
let mut but1 = button::Button::default()
.with_size(80, 40)
.center_of(&wizard)
.with_label("next");
grp1.end();
let grp2 = group::Group::default().size_of(&wizard);
let mut pack = group::Pack::default().with_size(160, 40).center_of(&grp2);
pack.set_type(group::PackType::Horizontal);
let mut but2 = button::Button::default()
.with_size(80, 0)
.center_of(&wizard)
.with_label("previous");
let mut but3 = button::Button::default()
.with_size(80, 0)
.center_of(&wizard)
.with_label("next");
pack.end();
grp2.end();
let grp3 = group::Group::default().size_of(&wizard);
let mut but4 = button::Button::default()
.with_size(80, 40)
.center_of(&wizard)
.with_label("previous");
grp3.end();
wizard.end();
win.end();
win.show();
but1.set_callback({
let mut wiz_c = wizard.clone();
move |_| wiz_c.next()
});
but2.set_callback({
let mut wiz_c = wizard.clone();
move |_| wiz_c.prev()
});
but3.set_callback({
let mut wiz_c = wizard.clone();
move |_| wiz_c.next()
});
but4.set_callback(move |_| wizard.prev());
}
fn main() {
let app = app::App::default().with_scheme(app::Scheme::Gtk);
let mut win = window::Window::default().with_size(400, 300);
let _but = {
let mut b = button::Button::default()
.with_size(160, 40)
.with_label("Show wizard")
.center_of(&win);
b.set_callback(show_wizard);
b
};
win.end();
win.show();
app.run().unwrap();
}