- btn->set_geometry(geom.width-45, 5, 40, 25);
+ btn->set_style("red");
+ btn->set_geometry(GLtk::Geometry(geom.w-80, 10, 30, 25));
+ btn->signal_clicked.connect(sigc::mem_fun(this, &TrainProperties::cancel_clicked));
+}
+
+void TrainProperties::ok_clicked()
+{
+ if(!train)
+ {
+ const map<unsigned, LocoType *> &locos = engineer.get_catalogue().get_locomotives();
+ map<unsigned, LocoType *>::const_iterator i = locos.begin();
+ advance(i, drp_type->get_selected_index());
+ train = engineer.add_train(*i->second, lexical_cast<unsigned>(ent_addr->get_text()));
+ }
+
+ train->set_name(ent_name->get_text());
+ signal_ok.emit();
+}
+
+void TrainProperties::cancel_clicked()
+{
+ signal_cancel.emit();