X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fzoneproperties.cpp;h=6ea4f2a330fc1a4b115a597933b01ede9813968d;hb=fcc044d4eb24820af9acf1431042e4c422366915;hp=406ebee1cbdc46bfa6f306e94e7dd150b8476d1e;hpb=4481da8b54bba32b338befd509360816b08402e5;p=r2c2.git diff --git a/source/designer/zoneproperties.cpp b/source/designer/zoneproperties.cpp index 406ebee..6ea4f2a 100644 --- a/source/designer/zoneproperties.cpp +++ b/source/designer/zoneproperties.cpp @@ -1,6 +1,7 @@ #include +#include #include -#include +#include #include "zoneproperties.h" using namespace std; @@ -10,48 +11,56 @@ using namespace R2C2; ZoneProperties::ZoneProperties(Zone &z): zone(z) { - GLtk::MixedRows *rows = new GLtk::MixedRows; - set_layout(rows); + set_layout(new GLtk::Layout); + GLtk::Column col(*layout); GLtk::Label *lbl1, *lbl2; add(*(lbl1 = new GLtk::Label("Zone properties"))); - layout->set_expand(*lbl1, true, false); lbl1->set_style("title"); - rows->start_row(); - add(*(lbl1 = new GLtk::Label("Group"))); - add(*(ent_group = new GLtk::Entry(zone.get_group()))); - ent_group->set_edit_size(30, 1); - - rows->start_row(); - add(*(lbl2 = new GLtk::Label("Qualifier"))); - rows->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); + { + GLtk::Row row(*layout); + add(*(lbl1 = new GLtk::Label("Group"))); + add(*(ent_group = new GLtk::Entry(zone.get_group()))); + ent_group->set_edit_size(30, 1); + } - add(*(drp_qualifier = new GLtk::Dropdown)); - const char *qualifiers[] = { "track", "platform", "siding", 0 }; - for(unsigned i=0; qualifiers[i]; ++i) { - drp_qualifier->append(qualifiers[i]); - if(zone.get_qualifier()==qualifiers[i]) - drp_qualifier->set_selected_index(i); + GLtk::Row row(*layout); + add(*(lbl2 = new GLtk::Label("Qualifier"))); + layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); + + add(*(drp_qualifier = new GLtk::Dropdown)); + GLtk::ListDataStore &data = dynamic_cast &>(drp_qualifier->get_data()); + const char *qualifiers[] = { "track", "platform", "siding", 0 }; + for(unsigned i=0; qualifiers[i]; ++i) + { + data.append(qualifiers[i]); + if(zone.get_qualifier()==qualifiers[i]) + drp_qualifier->set_selected_index(i); + } } - rows->start_row(); - add(*(lbl1 = new GLtk::Label("Number"))); - rows->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); - add(*(ent_number = new GLtk::Entry(lexical_cast(zone.get_number())))); - ent_number->set_edit_size(4, 1); + { + GLtk::Row row(*layout); + add(*(lbl1 = new GLtk::Label("Number"))); + layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); + add(*(ent_number = new GLtk::Entry(lexical_cast(zone.get_number())))); + ent_number->set_edit_size(4, 1); + } GLtk::Button *btn; - rows->start_row(); - rows->split_columns(); - add_button(*(btn = new GLtk::Button("Cncl")), 0); - 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_style("green"); + add_button(*(btn = new GLtk::Button("OK")), 1); + btn->set_style("green"); + } } void ZoneProperties::on_response(int code) @@ -59,8 +68,9 @@ void ZoneProperties::on_response(int code) if(code==1) { string qualifier; - if(drp_qualifier->get_selected_index()>=0) - qualifier = drp_qualifier->get_selected(); + int sel = drp_qualifier->get_selected_index(); + if(sel>=0) + qualifier = drp_qualifier->get_data().get_string(sel); unsigned number = lexical_cast(ent_number->get_text()); zone.set_name(ent_group->get_text(), qualifier, number); }