]> git.tdb.fi Git - r2c2.git/blob - source/engineer/trainpanel.h
9a38ca49d4ed91200b6ede85e980511c793352fa
[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/button.h>
13 #include <msp/gltk/hslider.h>
14 #include <msp/gltk/label.h>
15 #include <msp/gltk/panel.h>
16 #include <msp/gltk/toggle.h>
17 #include "libmarklin/route.h"
18 #include "libmarklin/train.h"
19
20 class Engineer;
21
22 class TrainPanel: public Msp::GLtk::Panel, public sigc::trackable
23 {
24 private:
25         Engineer &engineer;
26         Marklin::Train &train;
27         Msp::GLtk::Panel *pnl_basic;
28         Msp::GLtk::Panel *pnl_extra;
29         Msp::GLtk::Button *btn_expand;
30         Msp::GLtk::Label *lbl_addr;
31         Msp::GLtk::Label *lbl_name;
32         Msp::GLtk::HSlider *sld_speed;
33         Msp::GLtk::Label *lbl_speed;
34         Msp::GLtk::Label *lbl_route;
35         Msp::GLtk::Label *lbl_status;
36         Msp::GLtk::Toggle *tgl_forward;
37         std::map<unsigned, Msp::GLtk::Toggle *> tgl_funcs;
38         sigc::connection pick_conn;
39         bool expanded;
40
41 public:
42         TrainPanel(Engineer &, Marklin::Train &);
43         void expand(bool = true);
44
45 private:
46         void train_control_changed(const std::string &, float);
47         void train_function_changed(unsigned, bool);
48         void train_route_changed(const Marklin::Route *);
49         void train_status_changed(const std::string &);
50         void place_clicked();
51         void take_clicked();
52         void edit_clicked();
53         void route_clicked();
54         void goto_clicked();
55         void timetable_clicked();
56         void view_clicked();
57         void expand_clicked();
58         void speed_slider_changed(double);
59         void forward_toggled(bool);
60         void func_toggled(bool, unsigned);
61         void place(Marklin::Track *, unsigned);
62         void go_to(Marklin::Track *, unsigned);
63 };
64
65 #endif