diff options
author | frosch <frosch@openttd.org> | 2010-07-17 15:03:07 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-07-17 15:03:07 +0000 |
commit | be7a5588fab477479d2d9da35d75bd16b048042a (patch) | |
tree | 7c6eca94192396f2d3ea564fd3c6989b16b6dbd5 | |
parent | f06560ad45f5f81e6d5f165dae4c3553989b06f5 (diff) | |
download | openttd-be7a5588fab477479d2d9da35d75bd16b048042a.tar.xz |
(svn r20173) -Codechange: Make the normal vehiclelist fit the longest action dropdown text.
-rw-r--r-- | src/vehicle_gui.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index a01d75dba..3d1e20c71 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1087,23 +1087,33 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != VLW_WIDGET_LIST) return; - - resize->width = 0; - resize->height = GetVehicleListHeight(this->vehicle_type, 1); + switch (widget) { + case VLW_WIDGET_LIST: + resize->width = 0; + resize->height = GetVehicleListHeight(this->vehicle_type, 1); - switch (this->vehicle_type) { - case VEH_TRAIN: - resize->width = 1; - /* Fallthrough */ - case VEH_ROAD: - size->height = 6 * resize->height; + switch (this->vehicle_type) { + case VEH_TRAIN: + resize->width = 1; + /* Fallthrough */ + case VEH_ROAD: + size->height = 6 * resize->height; + break; + case VEH_SHIP: + case VEH_AIRCRAFT: + size->height = 4 * resize->height; + break; + default: NOT_REACHED(); + } break; - case VEH_SHIP: - case VEH_AIRCRAFT: - size->height = 4 * resize->height; + + case VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN: { + Dimension d = this->GetActionDropdownSize((this->window_number & VLW_MASK) == VLW_STANDARD, false); + d.height += padding.height; + d.width += padding.width; + *size = maxdim(*size, d); break; - default: NOT_REACHED(); + } } } |