]> git.tdb.fi Git - r2c2.git/blob - source/engineer/trainpanel.h
Add graphics for toggle widget
[r2c2.git] / source / engineer / trainpanel.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRAINPANEL_H_
9 #define TRAINPANEL_H_
10
11 #include <msp/gltk/hslider.h>
12 #include <msp/gltk/label.h>
13 #include <msp/gltk/panel.h>
14 #include <msp/gltk/toggle.h>
15 #include "libmarklin/train.h"
16
17 class Engineer;
18
19 class TrainPanel: public Msp::GLtk::Panel
20 {
21 private:
22         Engineer &engineer;
23         Marklin::Train &train;
24         Msp::GLtk::Label *lbl_addr;
25         Msp::GLtk::Label *lbl_name;
26         Msp::GLtk::HSlider *sld_speed;
27         Msp::GLtk::Label *lbl_speed;
28         Msp::GLtk::Label *lbl_status;
29         Msp::GLtk::Toggle *tgl_forward;
30         std::map<unsigned, Msp::GLtk::Toggle *> tgl_funcs;
31
32 public:
33         TrainPanel(Engineer &, const Msp::GLtk::Resources &, Marklin::Train &);
34 private:
35         void speed_slider_changed(double);
36         void loco_speed_changed(unsigned);
37         void loco_function_changed(unsigned, bool);
38         void train_status_changed(const std::string &);
39         void place_clicked();
40         void forward_toggled(bool);
41         void func_toggled(bool, unsigned);
42 };
43
44 #endif