summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-07-17 14:47:54 +0000
committerfrosch <frosch@openttd.org>2010-07-17 14:47:54 +0000
commitce480fb4b5adce00719a45f374108833c31748f9 (patch)
tree00852b3355785c1a313d86e4f506abae10c32347 /src/vehicle_gui.cpp
parentc79d4f46a35fe1029f1017f243fbf367bb363e45 (diff)
downloadopenttd-ce480fb4b5adce00719a45f374108833c31748f9.tar.xz
(svn r20170) -Codechange: Add BaseVehicleListWindow::GetActionDropdownSize().
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 3cfbfc911..f53019578 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -126,6 +126,27 @@ void BaseVehicleListWindow::BuildVehicleList(Owner owner, uint16 index, uint16 w
}
/**
+ * Compute the size for the Action dropdown.
+ * @param show_group If true include group-related stuff.
+ * @return Required size.
+ */
+Dimension BaseVehicleListWindow::GetActionDropdownSize(bool show_group)
+{
+ Dimension d = {0, 0};
+
+ d = maxdim(d, GetStringBoundingBox(STR_VEHICLE_LIST_REPLACE_VEHICLES));
+ d = maxdim(d, GetStringBoundingBox(STR_VEHICLE_LIST_SEND_FOR_SERVICING));
+ d = maxdim(d, GetStringBoundingBox(STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT));
+
+ if (show_group) {
+ d = maxdim(d, GetStringBoundingBox(STR_GROUP_ADD_SHARED_VEHICLE));
+ d = maxdim(d, GetStringBoundingBox(STR_GROUP_REMOVE_ALL_VEHICLES));
+ }
+
+ return d;
+}
+
+/**
* Display the Action dropdown window.
* @param show_group If true include group-related stuff.
* @return Itemlist for dropdown