]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/traindialog.cpp
Consider the expander area's with when autosizing TrainDialog
[r2c2.git] / source / engineer / traindialog.cpp
index 4d1d492099cf69a760eeeaff71a4aa10c4616840..350fbf063f81f6fcf76761001eb35f7fc63b7afc 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/core/maputils.h>
 #include <msp/core/raii.h>
+#include <msp/gltk/part.h>
 #include <msp/gltk/stack.h>
 #include <msp/strings/format.h>
 #include "libr2c2/aicontrol.h"
@@ -69,6 +70,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")