]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/departuresdialog.h
Add a dialog and necessary support code to display departures
[r2c2.git] / source / engineer / departuresdialog.h
diff --git a/source/engineer/departuresdialog.h b/source/engineer/departuresdialog.h
new file mode 100644 (file)
index 0000000..9dc99b8
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef DEPARTURESDIALOG_H_
+#define DEPARTURESDIALOG_H_
+
+#include <msp/gltk/dialog.h>
+#include <msp/gltk/dropdown.h>
+#include <msp/gltk/label.h>
+#include "libr2c2/departures.h"
+
+class DeparturesDialog: public Msp::GLtk::Dialog
+{
+private:
+       struct Row
+       {
+               const R2C2::Departures::Departure *departure;
+               Msp::GLtk::Label *lbl_time;
+               Msp::GLtk::Label *lbl_train;
+
+               Row();
+
+               void set_departure(const R2C2::Departures::Departure *);
+       };
+
+       const R2C2::Layout &layout;
+       Msp::GLtk::Dropdown *drp_groups;
+       Msp::GLtk::Label *lbl_title;
+       Msp::GLtk::BasicListData<std::string> groups;
+       Msp::GLtk::Panel *pnl_departures;
+       R2C2::Departures *departures;
+       std::vector<Row> rows;
+
+public:
+       DeparturesDialog(const R2C2::Layout &, const std::string & = std::string());
+
+private:
+       void group_selected(unsigned);
+       void departure_added(const R2C2::Departures::Departure &);
+       void departure_removed(const R2C2::Departures::Departure &);
+       void update_rows();
+};
+
+#endif