From f961fe626bd356b7d48713dd6c193828fa9a1c9d Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 7 Nov 2010 13:51:34 +0000 Subject: (svn r21108) -Add: Copy the 'editable' flag of the newgrf window to its layout widget. --- src/newgrf_gui.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 7191bbcb4..17e666dbf 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1270,6 +1270,7 @@ public: NWidgetBase *avs; ///< Widget with the available grfs list and buttons. NWidgetBase *acs; ///< Widget with the active grfs list and buttons. NWidgetBase *inf; ///< Info panel. + bool editable; ///< Editable status of the parent NewGRF window (if \c false, drop all widgets that make the window editable). NWidgetNewGRFDisplay(NWidgetBase *avs, NWidgetBase *acs, NWidgetBase *inf) : NWidgetContainer(NWID_HORIZONTAL) { @@ -1280,10 +1281,17 @@ public: this->Add(this->avs); this->Add(this->acs); this->Add(this->inf); + + this->editable = true; // Temporary setting, 'real' value is set in SetupSmallestSize(). } virtual void SetupSmallestSize(Window *w, bool init_array) { + /* Copy state flag from the window. */ + assert(dynamic_cast(w) != NULL); + NewGRFWindow *ngw = (NewGRFWindow *)w; + this->editable = ngw->editable; + this->avs->SetupSmallestSize(w, init_array); this->acs->SetupSmallestSize(w, init_array); this->inf->SetupSmallestSize(w, init_array); -- cgit v1.2.3-70-g09d2