-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathWizard.cpp
62 lines (55 loc) · 1.88 KB
/
Wizard.cpp
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
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Wizard.H>
#include <FL/Fl_Window.H>
namespace Examples {
class Main_Window : public Fl_Window {
public:
Main_Window() : Fl_Window {200, 100, 390, 315, "Wizard example"} {
box1.align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
box2.align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
box3.align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
box4.align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
previous_button.deactivate();
previous_button.callback([](Fl_Widget* sender, void* data) {
auto window = reinterpret_cast<Main_Window*>(data);
window->wizard.prev();
window->update_buttons();
}, this);
next_button.callback([](Fl_Widget* sender, void* data) {
auto window = reinterpret_cast<Main_Window*>(data);
window->wizard.next();
window->update_buttons();
}, this);
}
private:
void update_buttons() {
if (wizard.value() != &page1) previous_button.activate();
else previous_button.deactivate();
if (wizard.value() != &page4) next_button.activate();
else next_button.deactivate();
}
Fl_Wizard wizard {10, 10, 370, 250};
Fl_Group page1 {10, 10, 370, 250};
Fl_Box box1 {20, 20, 150, 25, "Page 1"};
Fl_End end_page1;
Fl_Group page2 {10, 10, 370, 250};
Fl_Box box2 {20, 20, 150, 25, "Page 2"};
Fl_End end_page2;
Fl_Group page3 {10, 10, 370, 250};
Fl_Box box3 {20, 20, 150, 25, "Page 3"};
Fl_End end_page3;
Fl_Group page4 {10, 10, 370, 250};
Fl_Box box4 {20, 20, 150, 25, "Page 4"};
Fl_End end_page4;
Fl_End end_wizard;
Fl_Button previous_button {10, 270, 75, 25, "<"};
Fl_Button next_button {100, 270, 75, 25, ">"};
};
}
auto main(int argc, char *argv[]) -> int {
auto window = Examples::Main_Window {};
window.show(argc, argv);
return Fl::run();
}