X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Ftraindialog.cpp;h=54dac6a84af53c2e69b9ab5896351d32d73eafe0;hb=3f50c821de14b8deab2374810bf974908e6681e8;hp=4d1d492099cf69a760eeeaff71a4aa10c4616840;hpb=b261812f040caed52bc3de783e8bcb86b222a9ed;p=r2c2.git diff --git a/source/engineer/traindialog.cpp b/source/engineer/traindialog.cpp index 4d1d492..54dac6a 100644 --- a/source/engineer/traindialog.cpp +++ b/source/engineer/traindialog.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include #include #include #include "libr2c2/aicontrol.h" @@ -69,6 +71,19 @@ TrainDialog::TrainDialog(Engineer &e, R2C2::Train &t): train.signal_ai_event.connect(sigc::mem_fun(this, &TrainDialog::ai_event)); } +void TrainDialog::autosize_special(const GLtk::Part &part, GLtk::Geometry &ageom) const +{ + GLtk::Dialog::autosize_special(part, ageom); + + if(part.get_name()=="children") + { + GLtk::Geometry egeom; + pnl_expander->autosize(egeom); + const GLtk::Sides &margin = layout->get_margin(); + ageom.w = max(ageom.w, margin.left+margin.right+egeom.w); + } +} + void TrainDialog::ai_event(TrainAI &, const TrainAI::Message &msg) { if(msg.type=="status-changed") @@ -112,11 +127,8 @@ void TrainDialog::expand_clicked() { pnl_expander->set_visible(!pnl_expander->is_visible()); btn_expand->set_style(pnl_expander->is_visible() ? "arrow_up" : "arrow_down"); - GLtk::Geometry ageom = geom; - ageom.h = 0; - layout->autosize(ageom); - ageom.y = geom.y+geom.h-ageom.h; - set_geometry(ageom); + signal_autosize_changed.emit(); + find_ancestor()->get_layout()->update(); } void TrainDialog::toggle_panel(bool show, GLtk::Panel *panel)