]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/trackproperties.cpp
Add driver for my custom Arduino-based control device
[r2c2.git] / source / designer / trackproperties.cpp
index 9753849eccf3aadae3b4d937e7dbb51e2baecc64..c95ad02887f24d3bd99868aa7a6a6a83afe73253 100644 (file)
@@ -1,5 +1,7 @@
 #include <msp/gltk/button.h>
+#include <msp/gltk/column.h>
 #include <msp/gltk/label.h>
+#include <msp/gltk/row.h>
 #include "libr2c2/track.h"
 #include "libr2c2/tracktype.h"
 #include "selection.h"
@@ -12,34 +14,40 @@ using namespace R2C2;
 TrackProperties::TrackProperties(const Selection &s):
        selection(s)
 {
-       set_size(300, 110);
+       set_layout(new GLtk::Layout);
+       GLtk::Column col(*layout);
 
-       GLtk::Label *lbl;
+       GLtk::Label *lbl1, *lbl2;
 
-       add(*(lbl = new GLtk::Label("Track properties")));
-       lbl->set_geometry(GLtk::Geometry(10, geom.h-30, geom.w-20, 20));
+       add(*(lbl1 = new GLtk::Label("Track properties")));
+       lbl1->set_style("title");
 
-       add(*(lbl = new GLtk::Label("Turnout ID")));
-       lbl->set_geometry(GLtk::Geometry(10, geom.h-65, 70, 20));
-
-       add(*(ent_turnout_id = new GLtk::Entry));
-       ent_turnout_id->set_geometry(GLtk::Geometry(80, geom.h-65, 50, 20));
-
-       add(*(lbl = new GLtk::Label("Sensor ID")));
-       lbl->set_geometry(GLtk::Geometry(150, geom.h-65, 70, 20));
+       {
+               GLtk::Row row(*layout);
+               add(*(lbl1 = new GLtk::Label("Turnout ID")));
+               add(*(ent_turnout_id = new GLtk::Entry));
+               ent_turnout_id->set_edit_size(5, 1);
+       }
 
-       add(*(ent_sensor_id = new GLtk::Entry));
-       ent_sensor_id->set_geometry(GLtk::Geometry(220, geom.h-65, 50, 20));
+       {
+               GLtk::Row row(*layout);
+               add(*(lbl2 = new GLtk::Label("Sensor ID")));
+               layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2);
+               add(*(ent_sensor_id = new GLtk::Entry));
+               ent_sensor_id->set_edit_size(5, 1);
+       }
 
        GLtk::Button *btn;
 
-       add_button(*(btn = new GLtk::Button("Cncl")), 0);
-       btn->set_geometry(GLtk::Geometry(geom.w-90, 10, 40, 24));
-       btn->set_style("red");
+       {
+               GLtk::Row row(*layout);
+               row.split();
+               add_button(*(btn = new GLtk::Button("Cncl")), 0);
+               btn->set_style("red");
 
-       add_button(*(btn = new GLtk::Button("OK")), 1);
-       btn->set_geometry(GLtk::Geometry(geom.w-50, 10, 40, 24));
-       btn->set_style("green");
+               add_button(*(btn = new GLtk::Button("OK")), 1);
+               btn->set_style("green");
+       }
 
        if(selection.size()==1)
        {