]> git.tdb.fi Git - r2c2.git/blobdiff - source/remote/trainpanel.h
Add a new remote control program with GLtk-based UI
[r2c2.git] / source / remote / trainpanel.h
index b969af406d2becef314f48b114823882801d4f3d..02b0b06b97a5ca165774c504e7cc1a8e15a1b0eb 100644 (file)
@@ -1,53 +1,34 @@
-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2009  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #ifndef TRAINPANEL_H_
 #define TRAINPANEL_H_
 
-#include <gtkmm/checkbutton.h>
-#include <gtkmm/combobox.h>
-#include <gtkmm/expander.h>
-#include <gtkmm/label.h>
-#include <gtkmm/scale.h>
-#include "network/client.h"
+#include <msp/gltk/indicator.h>
+#include <msp/gltk/panel.h>
+#include <msp/gltk/slider.h>
+#include <msp/gltk/toggle.h>
 #include "network/train.h"
 
-class TrainPanel: public Gtk::Expander
+class TrainPanel: public Msp::GLtk::Panel, public sigc::trackable
 {
 private:
-       struct RouteRecord: public Gtk::TreeModelColumnRecord
-       {
-               Gtk::TreeModelColumn<Glib::ustring> name;
-
-               RouteRecord();
-       };
-
-       Marklin::Client &client;
-       Marklin::NetTrain &train;
-       Gtk::Scale *scl_speed;
-       Gtk::Label *lbl_status;
-       Gtk::CheckButton *chk_reverse;
-       RouteRecord route_columns;
-       Gtk::ComboBox *cmb_route;
-       std::map<unsigned, Gtk::CheckButton *> chk_funcs;
+       R2C2::NetTrain &train;
+       Msp::GLtk::Indicator *ind_forward;
+       Msp::GLtk::Indicator *ind_reverse;
+       Msp::GLtk::Slider *sld_speed;
+       Msp::GLtk::Label *lbl_speed;
+       Msp::GLtk::Label *lbl_status;
+       std::map<unsigned, Msp::GLtk::Toggle *> tgl_functions;
+       bool updating;
 
 public:
-       TrainPanel(Marklin::Client &, Marklin::NetTrain &);
+       TrainPanel(R2C2::NetTrain &);
+
 private:
-       void name_changed(const std::string &);
-       void status_changed(const std::string &);
-       void speed_changed(unsigned);
-       void reverse_changed(bool);
+       void update_reverse(bool);
+       void update_speed(float);
+       void ui_speed_changed(float);
        void function_changed(unsigned, bool);
-       void route_changed(const std::string &);
-       void ui_speed_changed();
-       void ui_reverse_changed();
-       void ui_function_changed(unsigned);
-       void ui_route_changed();
+       void ui_function_toggled(bool, unsigned);
+       void status_changed(const std::string &);
 };
 
 #endif