1 #include <msp/gltk/button.h>
2 #include <msp/gltk/label.h>
3 #include <msp/gltk/mixedrows.h>
4 #include "zoneproperties.h"
10 ZoneProperties::ZoneProperties(Zone &z):
13 GLtk::MixedRows *rows = new GLtk::MixedRows;
16 GLtk::Label *lbl1, *lbl2;
18 add(*(lbl1 = new GLtk::Label("Zone properties")));
19 layout->set_expand(*lbl1, true, false);
20 lbl1->set_style("title");
23 add(*(lbl1 = new GLtk::Label("Group")));
24 add(*(ent_group = new GLtk::Entry(zone.get_group())));
25 ent_group->set_edit_size(30, 1);
28 add(*(lbl2 = new GLtk::Label("Qualifier")));
29 rows->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2);
31 add(*(drp_qualifier = new GLtk::Dropdown));
32 const char *qualifiers[] = { "track", "platform", "siding", 0 };
33 for(unsigned i=0; qualifiers[i]; ++i)
35 drp_qualifier->append(qualifiers[i]);
36 if(zone.get_qualifier()==qualifiers[i])
37 drp_qualifier->set_selected_index(i);
41 add(*(lbl1 = new GLtk::Label("Number")));
42 rows->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2);
43 add(*(ent_number = new GLtk::Entry(lexical_cast<string>(zone.get_number()))));
44 ent_number->set_edit_size(4, 1);
49 rows->split_columns();
50 add_button(*(btn = new GLtk::Button("Cncl")), 0);
51 btn->set_style("red");
53 add_button(*(btn = new GLtk::Button("OK")), 1);
54 btn->set_style("green");
57 void ZoneProperties::on_response(int code)
62 if(drp_qualifier->get_selected_index()>=0)
63 qualifier = drp_qualifier->get_selected();
64 unsigned number = lexical_cast<unsigned>(ent_number->get_text());
65 zone.set_name(ent_group->get_text(), qualifier, number);