summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-03-29 09:49:11 +0000
committeralberth <alberth@openttd.org>2009-03-29 09:49:11 +0000
commit9d2738b9c4c917fef1435276f7963c05fad817de (patch)
tree46a8610446402593770a93a3a51e586061127c7b
parent7a9a5cd139e924b966599e459db2f1fbdbcdf286 (diff)
downloadopenttd-9d2738b9c4c917fef1435276f7963c05fad817de.tar.xz
(svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
-rw-r--r--src/ai/ai_gui.cpp8
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/industry_gui.cpp6
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/network/network_content_gui.cpp2
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/newgrf_gui.cpp2
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp4
-rw-r--r--src/station_gui.cpp6
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/toolbar_gui.cpp4
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/vehicle_gui.cpp8
-rw-r--r--src/window.cpp15
-rw-r--r--src/window_gui.h7
23 files changed, 39 insertions, 49 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index ac47692c1..ae98e6cb7 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -167,7 +167,7 @@ struct AIListWindow : public Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0) {
ResizeButtons(this, AIL_WIDGET_ACCEPT, AIL_WIDGET_CANCEL);
@@ -365,7 +365,7 @@ struct AISettingsWindow : public Window {
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0) {
ResizeButtons(this, AIS_WIDGET_ACCEPT, AIS_WIDGET_RESET);
@@ -588,7 +588,7 @@ struct AIConfigWindow : public Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 14;
this->widget[AIC_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
@@ -777,7 +777,7 @@ struct AIDebugWindow : public Window {
if (data == -1 || ai_debug_company == data) this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
}
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index e870dca0f..0c1b124d8 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -402,7 +402,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta) {
+ virtual void OnResize(Point delta) {
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->vscroll2.cap += delta.y / (int)this->resize.step_height;
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 40717d09e..77a791be4 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -223,7 +223,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1;
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 5ca8995bb..bf64a1089 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1099,7 +1099,7 @@ struct BuildVehicleWindow : Window {
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0 && !this->listview_mode) {
ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME);
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 670d0d154..af62b9b5a 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -1003,7 +1003,7 @@ struct DepotWindow : Window {
_cursor.vehchain = false;
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->hscroll.cap += delta.x / (int)this->resize.step_width;
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index afa69b560..4c8d1dc04 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -670,7 +670,7 @@ public:
DoCommandP(0, this->group_sel, 0, CMD_RENAME_GROUP | CMD_MSG(STR_GROUP_CAN_T_RENAME), NULL, str);
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll2.cap += delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY;
this->vscroll.cap += delta.y / (int)this->resize.step_height;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 134099d95..db772ca7b 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -352,7 +352,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
/* Adjust the number of items in the matrix depending of the rezise */
this->vscroll.cap += delta.y / (int)this->resize.step_height;
@@ -643,7 +643,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->viewport->width += delta.x;
this->viewport->height += delta.y;
@@ -1008,7 +1008,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 10;
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 3b2f76453..b46f7e76e 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1727,7 +1727,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
/* Widget 2 and 3 have to go with halve speed, make it so obiwan */
uint diff = delta.x / 2;
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index e5dd0352e..f6ab0370d 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -674,7 +674,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 5e11dc41b..36312190f 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -722,7 +722,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 7c14f2504..db2f719e5 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -684,7 +684,7 @@ struct NewGRFWindow : public Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0) {
ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN);
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index c35c23fde..8e2d1b52a 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -767,7 +767,7 @@ struct MessageHistoryWindow : Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 12;
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index b133aac9c..be09ff6b2 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1125,7 +1125,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
/* Update the scroll + matrix */
this->vscroll.cap = (this->widget[ORDER_WIDGET_ORDER_LIST].bottom - this->widget[ORDER_WIDGET_ORDER_LIST].top) / 10;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 466509d5c..184ed6f5a 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1501,7 +1501,7 @@ struct GameSettingsWindow : Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / SETTING_HEIGHT;
SetVScrollCount(this, _settings_main_page.Length());
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index c1fa1dace..e931701c6 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -136,7 +136,7 @@ struct SignListWindow : Window, SignList {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 10;
}
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 3efade6c6..2693c31a2 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1046,7 +1046,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0 && this->map_type == SMT_INDUSTRY) this->ResizeLegend();
}
@@ -1166,7 +1166,7 @@ public:
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->viewport->width += delta.x;
this->viewport->height += delta.y;
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index c85eceb50..a1a37e5c6 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -546,7 +546,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 10;
}
@@ -975,7 +975,7 @@ struct StationViewWindow : public Window {
DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_3031_CAN_T_RENAME_STATION), NULL, str);
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0) ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
this->vscroll.cap += delta.y / (int)this->resize.step_height;
@@ -1187,7 +1187,7 @@ struct SelectStationWindow : Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap = (this->widget[JSW_PANEL].bottom - this->widget[JSW_PANEL].top) / 10;
}
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index ad20c38f9..d7c7343d9 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -325,7 +325,7 @@ struct TimetableWindow : Window {
DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
/* Update the scroll + matrix */
this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 5893c6eaa..43c0b4a9e 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -1117,7 +1117,7 @@ struct MainToolbarWindow : Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
SplitToolbar(this);
@@ -1311,7 +1311,7 @@ public:
_place_proc(tile);
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
/* There are 16 buttons plus some spacings if the space allows it.
* Furthermore there are two panels of which one is non - essential
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index d11c25499..5e8030d7b 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -625,7 +625,7 @@ public:
this->SetDirty();
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / 10;
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index f0b4c8b4a..cbb6e9fe7 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -392,7 +392,7 @@ struct RefitWindow : public Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[3].data = (this->vscroll.cap << 8) + 1;
@@ -1152,7 +1152,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
@@ -1575,7 +1575,7 @@ struct VehicleDetailsWindow : Window {
DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(_name_vehicle_error[GetVehicle(this->window_number)->type]), NULL, str);
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
if (delta.x != 0) ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
if (delta.y == 0) return;
@@ -2037,7 +2037,7 @@ struct VehicleViewWindow : Window {
}
}
- virtual void OnResize(Point new_size, Point delta)
+ virtual void OnResize(Point delta)
{
this->viewport->width += delta.x;
this->viewport->height += delta.y;
diff --git a/src/window.cpp b/src/window.cpp
index f2d238ead..a35eb28f4 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -920,13 +920,10 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height)
ResizeWindow(this, enlarge_x, enlarge_y);
- Point size;
Point diff;
- size.x = this->width;
- size.y = this->height;
diff.x = enlarge_x;
diff.y = enlarge_y;
- this->OnResize(size, diff);
+ this->OnResize(diff);
}
int nx = this->left;
@@ -1600,13 +1597,10 @@ static bool HandleWindowDragging()
/* ResizeWindow sets both pre- and after-size to dirty for redrawal */
ResizeWindow(w, x, y);
- Point size;
Point diff;
- size.x = x + w->width;
- size.y = y + w->height;
diff.x = x;
diff.y = y;
- w->OnResize(size, diff);
+ w->OnResize(diff);
return false;
}
}
@@ -2478,13 +2472,10 @@ void RelocateAllWindows(int neww, int newh)
if (neww - w->width != 0) {
ResizeWindow(w, min(neww, 640) - w->width, 0);
- Point size;
Point delta;
- size.x = w->width;
- size.y = w->height;
delta.x = neww - w->width;
delta.y = 0;
- w->OnResize(size, delta);
+ w->OnResize(delta);
}
top = w->top;
diff --git a/src/window_gui.h b/src/window_gui.h
index 603280298..d35faa441 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -497,11 +497,10 @@ public:
/**
- * Called when the window got resized.
- * @param new_size the new size of the window.
- * @param delta the amount of which the window size changed.
+ * Called after the window got resized.
+ * @param delta The amount of which the window size changed.
*/
- virtual void OnResize(Point new_size, Point delta) {}
+ virtual void OnResize(Point delta) {}
/**
* A dropdown option associated to this window has been selected.