]> git.tdb.fi Git - r2c2.git/blob - source/engineer/trainpanel.h
Foundations of using physics simulation for trains
[r2c2.git] / source / engineer / trainpanel.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRAINPANEL_H_
9 #define TRAINPANEL_H_
10
11 #include <sigc++/trackable.h>
12 #include <msp/gltk/hslider.h>
13 #include <msp/gltk/label.h>
14 #include <msp/gltk/panel.h>
15 #include <msp/gltk/toggle.h>
16 #include "libmarklin/route.h"
17 #include "libmarklin/train.h"
18
19 class Engineer;
20
21 class TrainPanel: public Msp::GLtk::Panel, public sigc::trackable
22 {
23 private:
24         Engineer &engineer;
25         Marklin::Train &train;
26         Msp::GLtk::Label *lbl_addr;
27         Msp::GLtk::Label *lbl_name;
28         Msp::GLtk::HSlider *sld_speed;
29         Msp::GLtk::Label *lbl_speed;
30         Msp::GLtk::Label *lbl_route;
31         Msp::GLtk::Label *lbl_status;
32         Msp::GLtk::Toggle *tgl_forward;
33         std::map<unsigned, Msp::GLtk::Toggle *> tgl_funcs;
34         sigc::connection pick_conn;
35
36 public:
37         TrainPanel(Engineer &, const Msp::GLtk::Resources &, Marklin::Train &);
38 private:
39         void speed_slider_changed(double);
40         void train_control_changed(const std::string &, float);
41         void train_function_changed(unsigned, bool);
42         void train_route_changed(const Marklin::Route *);
43         void train_status_changed(const std::string &);
44         void place_clicked();
45         void edit_clicked();
46         void route_clicked();
47         void goto_clicked();
48         void forward_toggled(bool);
49         void func_toggled(bool, unsigned);
50         void place(Marklin::Track *, unsigned);
51         void go_to(Marklin::Track *, unsigned);
52 };
53
54 #endif