#ifndef TRAINPANEL_H_
#define TRAINPANEL_H_
+#include <sigc++/trackable.h>
+#include <msp/gltk/button.h>
#include <msp/gltk/hslider.h>
#include <msp/gltk/label.h>
#include <msp/gltk/panel.h>
-#include "libmarklin/train.h"
+#include <msp/gltk/toggle.h>
+#include "libr2c2/route.h"
+#include "libr2c2/train.h"
+#include "libr2c2/trainstatus.h"
class Engineer;
-class TrainPanel: public Msp::GLtk::Panel
+class TrainPanel: public Msp::GLtk::Panel, public sigc::trackable
{
-public:
- TrainPanel(Engineer &, const Msp::GLtk::Resources &, Marklin::Train &);
private:
Engineer &engineer;
- Marklin::Train &train;
+ R2C2::Train &train;
+ R2C2::TrainStatus status;
+ Msp::GLtk::Panel *pnl_basic;
+ Msp::GLtk::Panel *pnl_extra;
+ Msp::GLtk::Button *btn_expand;
+ Msp::GLtk::Label *lbl_addr;
Msp::GLtk::Label *lbl_name;
Msp::GLtk::HSlider *sld_speed;
- Marklin::Locomotive *loco;
Msp::GLtk::Label *lbl_speed;
+ Msp::GLtk::Label *lbl_route;
+ Msp::GLtk::Label *lbl_status;
+ Msp::GLtk::Toggle *tgl_forward;
+ std::map<unsigned, Msp::GLtk::Toggle *> tgl_funcs;
+ sigc::connection pick_conn;
+ bool expanded;
+
+public:
+ TrainPanel(Engineer &, R2C2::Train &);
+ void expand(bool = true);
+private:
+ void ai_event(const R2C2::TrainAI::Message &);
+ void train_function_changed(unsigned, bool);
+ void train_route_changed(const R2C2::Route *);
+ void train_status_changed(const std::string &);
+ void place_clicked();
+ void take_clicked();
+ void edit_clicked();
+ void route_clicked();
+ void goto_clicked();
+ void timetable_clicked();
+ void view_clicked();
+ void expand_clicked();
void speed_slider_changed(double);
- void loco_speed_changed(unsigned);
+ void forward_toggled(bool);
+ void func_toggled(bool, unsigned);
+ void place(R2C2::Track *, unsigned);
+ void go_to(R2C2::Track *, unsigned);
};
#endif