]> git.tdb.fi Git - r2c2.git/blob - source/engineer/departuresdialog.h
Persist most dialogs across runs
[r2c2.git] / source / engineer / departuresdialog.h
1 #ifndef DEPARTURESDIALOG_H_
2 #define DEPARTURESDIALOG_H_
3
4 #include <msp/gltk/dropdown.h>
5 #include <msp/gltk/label.h>
6 #include "libr2c2/departures.h"
7 #include "dynamicdialog.h"
8
9 class Engineer;
10
11 class DeparturesDialog: public DynamicDialog
12 {
13 public:
14         class StateLoader: public Msp::DataFile::DerivedObjectLoader<DeparturesDialog, DynamicDialog::StateLoader>
15         {
16         public:
17                 StateLoader(DeparturesDialog &);
18
19         private:
20                 void group(const std::string &);
21         };
22
23 private:
24         struct Row
25         {
26                 const R2C2::Departures::Departure *departure;
27                 Msp::GLtk::Label *lbl_time;
28                 Msp::GLtk::Label *lbl_train;
29
30                 Row();
31
32                 void set_departure(const R2C2::Departures::Departure *);
33         };
34
35         const R2C2::Layout &layout;
36         Msp::GLtk::Dropdown *drp_groups;
37         Msp::GLtk::Label *lbl_title;
38         Msp::GLtk::BasicListData<std::string> groups;
39         Msp::GLtk::Panel *pnl_departures;
40         R2C2::Departures *departures;
41         std::vector<Row> rows;
42
43 public:
44         DeparturesDialog(Engineer &, const std::string & = std::string());
45
46         void set_group(const std::string &);
47
48 private:
49         void group_selected(unsigned);
50         void update_rows();
51
52 public:
53         virtual bool save_state(Msp::DataFile::Statement &) const;
54 };
55
56 #endif