From a88f197f8e2ab347531ba5a4aad3113518259ec6 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 6 Nov 2013 14:59:45 +0200 Subject: [PATCH] Consider the expander area's with when autosizing TrainDialog --- source/engineer/traindialog.cpp | 14 ++++++++++++++ source/engineer/traindialog.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/source/engineer/traindialog.cpp b/source/engineer/traindialog.cpp index 4d1d492..350fbf0 100644 --- a/source/engineer/traindialog.cpp +++ b/source/engineer/traindialog.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #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") diff --git a/source/engineer/traindialog.h b/source/engineer/traindialog.h index e862487..545c3b0 100644 --- a/source/engineer/traindialog.h +++ b/source/engineer/traindialog.h @@ -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); -- 2.45.2