]> git.tdb.fi Git - r2c2.git/commitdiff
Display protocol in the train list
authorMikko Rasa <tdb@tdb.fi>
Thu, 14 Nov 2013 17:29:52 +0000 (19:29 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 14 Nov 2013 17:29:52 +0000 (19:29 +0200)
source/engineer/trainlistdialog.cpp

index dbeb79670d812007a9a67e900a0f1b40204c0576..fccfbfb645288c15deb0117efabcadca8a9d9e1f 100644 (file)
@@ -14,6 +14,7 @@ using namespace R2C2;
 class TrainItem: public GLtk::List::Item
 {
 private:
+       GLtk::Label protocol;
        GLtk::Label address;
        GLtk::Label name;
 
@@ -95,9 +96,11 @@ void TrainListDialog::train_name_changed(Train &train)
 
 
 TrainItem::TrainItem(ValueType train):
+       protocol(train->get_protocol()),
        address(lexical_cast<string>(train->get_address())),
        name(train->get_name())
 {
+       add(protocol);
        add(address);
        add(name);
 }
@@ -107,13 +110,15 @@ void TrainItem::on_style_change()
        if(!style)
                return;
 
+       protocol.autosize();
        address.autosize();
        name.autosize();
 
        if(const GLtk::Part *part = style->get_part("children"))
        {
                const GLtk::Sides &margin = part->get_margin();
-               address.set_position(margin.left, margin.bottom);
-               name.set_position(margin.left+30, margin.bottom);
+               protocol.set_position(margin.left, margin.bottom);
+               address.set_position(margin.left+30, margin.bottom);
+               name.set_position(margin.left+60, margin.bottom);
        }
 }