]> git.tdb.fi Git - r2c2.git/blob - source/remote/trainpanel.h
e1464e36331f4bd8923d141644a146ce3eeb7ea8
[r2c2.git] / source / remote / trainpanel.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRAINPANEL_H_
9 #define TRAINPANEL_H_
10
11 #include <gtkmm/checkbutton.h>
12 #include <gtkmm/combobox.h>
13 #include <gtkmm/expander.h>
14 #include <gtkmm/label.h>
15 #include <gtkmm/scale.h>
16 #include "network/client.h"
17 #include "network/train.h"
18
19 class Remote;
20
21 class TrainPanel: public Gtk::Expander
22 {
23 private:
24         struct RouteRecord: public Gtk::TreeModelColumnRecord
25         {
26                 Gtk::TreeModelColumn<Glib::ustring> name;
27
28                 RouteRecord();
29         };
30
31         Remote &remote;
32         Marklin::Client &client;
33         Marklin::NetTrain &train;
34         Gtk::Scale *scl_speed;
35         Gtk::Label *lbl_status;
36         Gtk::CheckButton *chk_reverse;
37         RouteRecord route_columns;
38         Gtk::ComboBox *cmb_route;
39         std::map<unsigned, Gtk::CheckButton *> chk_funcs;
40
41 public:
42         TrainPanel(Remote &, Marklin::Client &, Marklin::NetTrain &);
43 private:
44         void name_changed(const std::string &);
45         void status_changed(const std::string &);
46         void control_changed(const std::string &, float);
47         void function_changed(unsigned, bool);
48         void route_changed(const std::string &);
49         void ui_speed_changed();
50         void ui_reverse_changed();
51         void ui_function_changed(unsigned);
52         void ui_route_changed();
53 };
54
55 #endif