summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-12 16:29:09 +0000
committerrubidium <rubidium@openttd.org>2010-11-12 16:29:09 +0000
commit0fc5206a5b56e234dff0afab4b4dc99b2889cf8f (patch)
tree1e008c2fe47539bfe61f0f58320cef2cfba977fe
parent671158acd8bbe21e3cb6a0fa134e2f72d2b06870 (diff)
downloadopenttd-0fc5206a5b56e234dff0afab4b4dc99b2889cf8f.tar.xz
(svn r21151) -Fix [FS#4221]: Sort arrow wasn't accounted for in two windows causing it to be overwritten by the "sort by" string
-rw-r--r--src/build_vehicle_gui.cpp9
-rw-r--r--src/fios_gui.cpp9
2 files changed, 18 insertions, 0 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index dfb616a62..b7252206e 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -28,6 +28,7 @@
#include "widgets/dropdown_func.h"
#include "engine_gui.h"
#include "cargotype.h"
+#include "core/geometry_func.hpp"
#include "table/strings.h"
@@ -1261,6 +1262,14 @@ struct BuildVehicleWindow : Window {
case BUILD_VEHICLE_WIDGET_PANEL:
size->height = this->details_height;
break;
+
+ case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING: {
+ Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
+ d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
+ d.height += padding.height;
+ *size = maxdim(*size, d);
+ break;
+ }
}
}
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index b0b8d8657..261a2dad4 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -26,6 +26,7 @@
#include "engine_func.h"
#include "landscape_type.h"
#include "date_func.h"
+#include "core/geometry_func.hpp"
#include "table/sprites.h"
#include "table/strings.h"
@@ -475,6 +476,14 @@ public:
resize->height = FONT_HEIGHT_NORMAL;
size->height = resize->height * 10 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
break;
+ case SLWW_SORT_BYNAME:
+ case SLWW_SORT_BYDATE: {
+ Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
+ d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
+ d.height += padding.height;
+ *size = maxdim(*size, d);
+ break;
+ }
}
}