Mercurial > hg > openttd
changeset 15519:bc849d959f97 draft
(svn r20173) -Codechange: Make the normal vehiclelist fit the longest action dropdown text.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 17 Jul 2010 15:03:07 +0000 |
parents | 7f9f5cfa1510 |
children | 108708b7faf1 |
files | src/vehicle_gui.cpp |
diffstat | 1 files changed, 24 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1087,23 +1087,33 @@ 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(); + } } }