]> git.tdb.fi Git - r2c2.git/blob - source/remote/trainpanel.h
Add a new remote control program with GLtk-based UI
[r2c2.git] / source / remote / trainpanel.h
1 #ifndef TRAINPANEL_H_
2 #define TRAINPANEL_H_
3
4 #include <msp/gltk/indicator.h>
5 #include <msp/gltk/panel.h>
6 #include <msp/gltk/slider.h>
7 #include <msp/gltk/toggle.h>
8 #include "network/train.h"
9
10 class TrainPanel: public Msp::GLtk::Panel, public sigc::trackable
11 {
12 private:
13         R2C2::NetTrain &train;
14         Msp::GLtk::Indicator *ind_forward;
15         Msp::GLtk::Indicator *ind_reverse;
16         Msp::GLtk::Slider *sld_speed;
17         Msp::GLtk::Label *lbl_speed;
18         Msp::GLtk::Label *lbl_status;
19         std::map<unsigned, Msp::GLtk::Toggle *> tgl_functions;
20         bool updating;
21
22 public:
23         TrainPanel(R2C2::NetTrain &);
24
25 private:
26         void update_reverse(bool);
27         void update_speed(float);
28         void ui_speed_changed(float);
29         void function_changed(unsigned, bool);
30         void ui_function_toggled(bool, unsigned);
31         void status_changed(const std::string &);
32 };
33
34 #endif