]> git.tdb.fi Git - r2c2.git/commitdiff
Consider the expander area's with when autosizing TrainDialog
authorMikko Rasa <tdb@tdb.fi>
Wed, 6 Nov 2013 12:59:45 +0000 (14:59 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 6 Nov 2013 12:59:45 +0000 (14:59 +0200)
source/engineer/traindialog.cpp
source/engineer/traindialog.h

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")
index e862487baa3665dcb570e80ec636169a50ce9411..545c3b0dae3afc0d1380e8f570dce783c4ad12b1 100644 (file)
@@ -29,6 +29,8 @@ public:
        TrainDialog(Engineer &, R2C2::Train &);
 
 private:
+       virtual void autosize_special(const Msp::GLtk::Part &, Msp::GLtk::Geometry &) const;
+
        void ai_event(R2C2::TrainAI &, const R2C2::TrainAI::Message &);
        void update_speed_display(float);
        void ui_speed_changed(double);