summaryrefslogtreecommitdiff
path: root/src/newgrf_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-11-07 13:51:34 +0000
committeralberth <alberth@openttd.org>2010-11-07 13:51:34 +0000
commitf961fe626bd356b7d48713dd6c193828fa9a1c9d (patch)
treee701c5d9194502572ca1983c69e3c2b23fa0211a /src/newgrf_gui.cpp
parentb26b8b5b2abbeb29bc7dffb71198405c742b1aee (diff)
downloadopenttd-f961fe626bd356b7d48713dd6c193828fa9a1c9d.tar.xz
(svn r21108) -Add: Copy the 'editable' flag of the newgrf window to its layout widget.
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r--src/newgrf_gui.cpp8
1 files changed, 8 insertions, 0 deletions
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<NewGRFWindow *>(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);