summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rail_gui.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 04700a237..6d2e2bb5b 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1050,7 +1050,6 @@ public:
}
}
- SetDParam(0, GetStationClassName(_railstation.station_class));
this->DrawWidgets();
/* 'Accepts' and 'Supplies' texts. */
@@ -1066,6 +1065,21 @@ public:
}
}
+ virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
+ {
+ if (widget != BRSW_NEWST_DROPDOWN) return;
+
+ Dimension d = {0, 0};
+ for (uint i = 0; i < GetNumStationClasses(); i++) {
+ if (i == STAT_CLASS_WAYP) continue;
+ SetDParam(0, GetStationClassName((StationClassID)i));
+ d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
+ }
+ d.width += padding.width;
+ d.height += padding.height;
+ *size = maxdim(*size, d);
+ }
+
virtual void DrawWidget(const Rect &r, int widget) const
{
DrawPixelInfo tmp_dpi;
@@ -1114,6 +1128,11 @@ public:
}
break;
}
+
+ case BRSW_NEWST_DROPDOWN:
+ SetDParam(0, GetStationClassName(_railstation.station_class));
+ DrawString(r.left + WD_DROPDOWNTEXT_LEFT, r.right - WD_DROPDOWNTEXT_RIGHT, r.top + WD_DROPDOWNTEXT_TOP, STR_BLACK_STRING, TC_BLACK);
+ break;
}
}
@@ -1353,7 +1372,7 @@ static const NWidgetPart _nested_newstation_builder_widgets[] = {
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRSW_BACKGROUND),
/* begin newstations gui additions. */
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
- NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetPadding(0, 7, 0, 7), SetDataTip(STR_BLACK_STRING, STR_SELECT_STATION_CLASS_TIP),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetPadding(0, 7, 0, 7), SetDataTip(STR_EMPTY, STR_SELECT_STATION_CLASS_TIP),
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7),
NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetDataTip(0x501, STR_SELECT_STATION_TYPE_TIP),