summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-21 13:49:42 +0000
committerterkhen <terkhen@openttd.org>2010-12-21 13:49:42 +0000
commit53120a566ce933b74bf4039e0b7e7e4cca3af28b (patch)
treebfb75ef0392bb50de79167744965c87990d54c01 /src
parent0209b1253a7cf7e8bf1a692194f8564365d2348a (diff)
downloadopenttd-53120a566ce933b74bf4039e0b7e7e4cca3af28b.tar.xz
(svn r21559) -Add: Disable the refit button until a refit option is selected.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_gui.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5625498ff..8ca29317f 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -466,6 +466,7 @@ struct RefitWindow : public Window {
RefitWindow(const WindowDesc *desc, const Vehicle *v, VehicleOrderID order) : Window()
{
+ this->sel = -1;
this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(VRW_SCROLLBAR);
@@ -479,7 +480,7 @@ struct RefitWindow : public Window {
this->owner = v->owner;
this->order = order;
- this->sel = -1;
+ this->SetWidgetDisabledState(VRW_REFITBUTTON, this->sel == -1);
}
virtual void OnInit()
@@ -505,6 +506,7 @@ struct RefitWindow : public Window {
}
}
+ this->SetWidgetDisabledState(VRW_REFITBUTTON, this->sel == -1);
/* If the selected refit option was not found, scroll the window to the initial position. */
if (this->sel == -1) this->vscroll->ScrollTowards(0);
} else {
@@ -614,6 +616,8 @@ struct RefitWindow : public Window {
switch (widget) {
case VRW_MATRIX: { // listbox
this->sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, VRW_MATRIX);
+ if (this->sel == INT_MAX) this->sel = -1;
+ this->SetWidgetDisabledState(VRW_REFITBUTTON, this->sel == -1);
this->InvalidateData(1);
if (click_count == 1) break;