]> git.tdb.fi Git - r2c2.git/blob - source/designer/objectproperties.h
Rewrite goal initialization for TrainRouteMetric
[r2c2.git] / source / designer / objectproperties.h
1 #ifndef TRACKPROPERTIES_H_
2 #define TRACKPROPERTIES_H_
3
4 #include <msp/gltk/dialog.h>
5 #include <msp/gltk/entry.h>
6 #include "libr2c2/beamgate.h"
7 #include "libr2c2/signal.h"
8 #include "libr2c2/terrain.h"
9 #include "libr2c2/track.h"
10
11 class Selection;
12
13 class ObjectProperties: public Msp::GLtk::Dialog
14 {
15 private:
16         class Properties
17         {
18         protected:
19                 Properties() { }
20         public:
21                 virtual ~Properties() { }
22
23                 virtual void apply() = 0;
24         };
25
26         class TurnoutProperties: public Properties
27         {
28         private:
29                 R2C2::Track &track;
30                 Msp::GLtk::Entry *ent_address;
31
32         public:
33                 TurnoutProperties(ObjectProperties &, R2C2::Track &);
34
35                 virtual void apply();
36         };
37
38         class TrackCircuitProperties: public Properties
39         {
40         private:
41                 std::set<R2C2::Track *> tracks;
42                 Msp::GLtk::Entry *ent_address;
43
44         public:
45                 TrackCircuitProperties(ObjectProperties &, const std::set<R2C2::Track *> &);
46
47                 virtual void apply();
48         };
49
50         class SignalProperties: public Properties
51         {
52         private:
53                 R2C2::Signal &signal;
54                 Msp::GLtk::Entry *ent_address;
55
56         public:
57                 SignalProperties(ObjectProperties &, R2C2::Signal &);
58
59                 virtual void apply();
60         };
61
62         class BeamGateProperties: public Properties
63         {
64         private:
65                 R2C2::BeamGate &gate;
66                 Msp::GLtk::Entry *ent_address;
67
68         public:
69                 BeamGateProperties(ObjectProperties &, R2C2::BeamGate &);
70
71                 virtual void apply();
72         };
73
74         class TerrainProperties: public Properties
75         {
76         private:
77                 R2C2::Terrain &terrain;
78                 Msp::GLtk::Entry *ent_width;
79                 Msp::GLtk::Entry *ent_height;
80
81         public:
82                 TerrainProperties(ObjectProperties &, R2C2::Terrain &);
83
84                 virtual void apply();
85         };
86
87         Properties *properties;
88         Msp::GLtk::Widget *prev_widget;
89
90 public:
91         ObjectProperties(const Selection &);
92
93 private:
94         Msp::GLtk::Entry *add_property(const std::string &, const std::string &, unsigned = 0);
95
96         virtual void on_response(int);
97 };
98
99 #endif