]> git.tdb.fi Git - r2c2.git/blob - source/engineer/routerpanel.h
Don't crash if a train has no router
[r2c2.git] / source / engineer / routerpanel.h
1 #ifndef ROUTERPANEL_H_
2 #define ROUTERPANEL_H_
3
4 #include <msp/gltk/dropdown.h>
5 #include <msp/gltk/label.h>
6 #include <msp/gltk/panel.h>
7 #include "libr2c2/train.h"
8 #include "3d/trackchain.h"
9
10 class Engineer;
11
12 class RouterPanel: public Msp::GLtk::Panel, public sigc::trackable
13 {
14 private:
15         Engineer &engineer;
16         R2C2::Train &train;
17         Msp::GLtk::Label *lbl_route;
18         Msp::GLtk::FunctionListData<const R2C2::Route *> routes;
19         Msp::GLtk::Dropdown *drp_routes;
20         sigc::connection pick_conn;
21         bool updating;
22
23         bool goto_pick;
24         R2C2::Block *goto_target;
25         R2C2::TrackChain3D *goto_highlight;
26
27 public:
28         RouterPanel(Engineer &, R2C2::Train &);
29
30 private:
31         void ai_event(R2C2::TrainAI &, const R2C2::TrainAI::Message &);
32         void update_route(const R2C2::Route *);
33         void route_selected(unsigned);
34         void goto_clicked();
35
36         virtual void button_press(int, int, unsigned);
37         virtual void pointer_motion(int, int);
38 };
39
40 #endif