]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/objectproperties.h
Generalize TrackProperties to all object types
[r2c2.git] / source / designer / objectproperties.h
diff --git a/source/designer/objectproperties.h b/source/designer/objectproperties.h
new file mode 100644 (file)
index 0000000..9180206
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef TRACKPROPERTIES_H_
+#define TRACKPROPERTIES_H_
+
+#include <msp/gltk/dialog.h>
+#include <msp/gltk/entry.h>
+#include "libr2c2/beamgate.h"
+#include "libr2c2/signal.h"
+#include "libr2c2/track.h"
+
+class Selection;
+
+class ObjectProperties: public Msp::GLtk::Dialog
+{
+private:
+       class Properties
+       {
+       protected:
+               Properties() { }
+       public:
+               virtual ~Properties() { }
+
+               virtual void apply() = 0;
+       };
+
+       class TurnoutProperties: public Properties
+       {
+       private:
+               R2C2::Track &track;
+               Msp::GLtk::Entry *ent_address;
+
+       public:
+               TurnoutProperties(ObjectProperties &, R2C2::Track &);
+
+               virtual void apply();
+       };
+
+       class TrackCircuitProperties: public Properties
+       {
+       private:
+               std::set<R2C2::Track *> tracks;
+               Msp::GLtk::Entry *ent_address;
+
+       public:
+               TrackCircuitProperties(ObjectProperties &, const std::set<R2C2::Track *> &);
+
+               virtual void apply();
+       };
+
+       class SignalProperties: public Properties
+       {
+       private:
+               R2C2::Signal &signal;
+               Msp::GLtk::Entry *ent_address;
+
+       public:
+               SignalProperties(ObjectProperties &, R2C2::Signal &);
+
+               virtual void apply();
+       };
+
+       class BeamGateProperties: public Properties
+       {
+       private:
+               R2C2::BeamGate &gate;
+               Msp::GLtk::Entry *ent_address;
+
+       public:
+               BeamGateProperties(ObjectProperties &, R2C2::BeamGate &);
+
+               virtual void apply();
+       };
+
+       Properties *properties;
+       Msp::GLtk::Widget *prev_widget;
+
+public:
+       ObjectProperties(const Selection &);
+
+private:
+       Msp::GLtk::Entry *add_property(const std::string &, const std::string &, unsigned = 0);
+
+       virtual void on_response(int);
+};
+
+#endif