mirror of https://github.com/OpenTTD/OpenTTD
(svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone.
parent
c3992ab7b6
commit
ca0521f89f
|
@ -203,7 +203,7 @@ struct AIListWindow : public Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->current_y / this->line_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->current_y / this->line_height);
|
||||||
this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
@ -399,7 +399,7 @@ struct AISettingsWindow : public Window {
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->current_y / this->line_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->current_y / this->line_height);
|
||||||
this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
@ -876,7 +876,7 @@ struct AIDebugWindow : public Window {
|
||||||
if (data == -1 || ai_debug_company == data) this->SetDirty();
|
if (data == -1 || ai_debug_company == data) this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AID_WIDGET_LOG_PANEL)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AID_WIDGET_LOG_PANEL)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,7 +455,7 @@ public:
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_LEFT_MATRIX)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_LEFT_MATRIX)->current_y / this->resize.step_height);
|
||||||
this->vscroll2.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_RIGHT_MATRIX)->current_y / this->resize.step_height);
|
this->vscroll2.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_RIGHT_MATRIX)->current_y / this->resize.step_height);
|
||||||
|
|
|
@ -282,7 +282,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->current_y / this->resize.step_height);
|
||||||
this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ struct BuildVehicleWindow : Window {
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (!this->listview_mode) ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME);
|
if (!this->listview_mode) ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME);
|
||||||
|
|
||||||
|
|
|
@ -907,7 +907,7 @@ struct DepotWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_y / (int)this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_y / (int)this->resize.step_height);
|
||||||
this->hscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_x / (int)this->resize.step_width);
|
this->hscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_x / (int)this->resize.step_width);
|
||||||
|
|
|
@ -612,7 +612,7 @@ public:
|
||||||
this->group_rename = INVALID_GROUP;
|
this->group_rename = INVALID_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll2.SetCapacity((this->widget[GRP_WIDGET_LIST_GROUP].bottom - this->widget[GRP_WIDGET_LIST_GROUP].top + 1) / PLY_WND_PRC__SIZE_OF_ROW_TINY);
|
this->vscroll2.SetCapacity((this->widget[GRP_WIDGET_LIST_GROUP].bottom - this->widget[GRP_WIDGET_LIST_GROUP].top + 1) / PLY_WND_PRC__SIZE_OF_ROW_TINY);
|
||||||
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
|
|
@ -387,7 +387,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
/* Adjust the number of items in the matrix depending of the rezise */
|
/* Adjust the number of items in the matrix depending of the rezise */
|
||||||
this->vscroll.SetCapacity((this->widget[DPIW_MATRIX_WIDGET].bottom - this->widget[DPIW_MATRIX_WIDGET].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[DPIW_MATRIX_WIDGET].bottom - this->widget[DPIW_MATRIX_WIDGET].top + 1) / this->resize.step_height);
|
||||||
|
@ -706,7 +706,7 @@ public:
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->viewport != NULL) {
|
if (this->viewport != NULL) {
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(IVW_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(IVW_VIEWPORT);
|
||||||
|
@ -1091,7 +1091,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,7 @@ struct MainWindow : Window
|
||||||
ZoomInOrOutToCursorWindow(wheel < 0, this);
|
ZoomInOrOutToCursorWindow(wheel < 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->viewport != NULL) {
|
if (this->viewport != NULL) {
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(MW_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(MW_VIEWPORT);
|
||||||
|
|
|
@ -2045,7 +2045,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLWW_DRIVES_DIRECTORIES_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLWW_DRIVES_DIRECTORIES_LIST)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -734,7 +734,7 @@ public:
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(NCLWW_MATRIX)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(NCLWW_MATRIX)->current_y / this->resize.step_height);
|
||||||
this->GetWidget<NWidgetCore>(NCLWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->GetWidget<NWidgetCore>(NCLWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
|
|
@ -712,7 +712,7 @@ public:
|
||||||
if (!StrEmpty(str)) NetworkAddServer(str);
|
if (!StrEmpty(str)) NetworkAddServer(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->widget[NGWW_MATRIX].bottom - this->widget[NGWW_MATRIX].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[NGWW_MATRIX].bottom - this->widget[NGWW_MATRIX].top + 1) / this->resize.step_height);
|
||||||
this->widget[NGWW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->widget[NGWW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
|
|
@ -279,7 +279,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ struct NewGRFWindow : public Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->current_y / this->resize.step_height);
|
||||||
this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
|
|
@ -991,7 +991,7 @@ struct MessageHistoryWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->current_y / this->line_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->current_y / this->line_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
/* Update the scroll bar */
|
/* Update the scroll bar */
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y / this->resize.step_height);
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ struct GameSettingsWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->widget[SETTINGSEL_OPTIONSPANEL].bottom - this->widget[SETTINGSEL_OPTIONSPANEL].top - 8) / SETTING_HEIGHT);
|
this->vscroll.SetCapacity((this->widget[SETTINGSEL_OPTIONSPANEL].bottom - this->widget[SETTINGSEL_OPTIONSPANEL].top - 8) / SETTING_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ struct SignListWindow : Window, SignList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1133,7 +1133,7 @@ public:
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->map_type == SMT_INDUSTRY) this->ResizeLegend();
|
if (this->map_type == SMT_INDUSTRY) this->ResizeLegend();
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,7 @@ public:
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->widget[SLW_LIST].bottom - this->widget[SLW_LIST].top + 1) / 10);
|
this->vscroll.SetCapacity((this->widget[SLW_LIST].bottom - this->widget[SLW_LIST].top + 1) / 10);
|
||||||
}
|
}
|
||||||
|
@ -1049,7 +1049,7 @@ struct StationViewWindow : public Window {
|
||||||
DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_ERROR_CAN_T_RENAME_STATION), NULL, str);
|
DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_ERROR_CAN_T_RENAME_STATION), NULL, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
|
ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
|
||||||
this->vscroll.SetCapacity((this->widget[SVW_WAITING].bottom - this->widget[SVW_WAITING].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[SVW_WAITING].bottom - this->widget[SVW_WAITING].top + 1) / this->resize.step_height);
|
||||||
|
@ -1294,7 +1294,7 @@ struct SelectStationWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(JSW_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(JSW_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ struct SubsidyListWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ struct TimetableWindow : Window {
|
||||||
DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
|
DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
/* Update the scroll bar */
|
/* Update the scroll bar */
|
||||||
this->vscroll.SetCapacity((this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top + 1) / this->resize.step_height);
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ struct MainToolbarWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
|
if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
|
||||||
SplitToolbar(this);
|
SplitToolbar(this);
|
||||||
|
@ -1322,7 +1322,7 @@ public:
|
||||||
_place_proc(tile);
|
_place_proc(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
/* There are 16 buttons plus some spacings if the space allows it.
|
/* There are 16 buttons plus some spacings if the space allows it.
|
||||||
* Furthermore there are two panels of which one is non - essential
|
* Furthermore there are two panels of which one is non - essential
|
||||||
|
|
|
@ -466,7 +466,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->viewport != NULL) {
|
if (this->viewport != NULL) {
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(TVW_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(TVW_VIEWPORT);
|
||||||
|
@ -801,7 +801,7 @@ public:
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,7 +387,7 @@ struct RefitWindow : public Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->widget[VRW_MATRIX].bottom - this->widget[VRW_MATRIX].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[VRW_MATRIX].bottom - this->widget[VRW_MATRIX].top + 1) / this->resize.step_height);
|
||||||
this->widget[VRW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->widget[VRW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
@ -1103,7 +1103,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
this->vscroll.SetCapacity((this->widget[VLW_WIDGET_LIST].bottom - this->widget[VLW_WIDGET_LIST].top + 1) / this->resize.step_height);
|
this->vscroll.SetCapacity((this->widget[VLW_WIDGET_LIST].bottom - this->widget[VLW_WIDGET_LIST].top + 1) / this->resize.step_height);
|
||||||
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
|
@ -1496,7 +1496,7 @@ struct VehicleDetailsWindow : Window {
|
||||||
DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), NULL, str);
|
DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), NULL, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
|
ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
|
||||||
|
|
||||||
|
@ -1920,7 +1920,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->viewport != NULL) {
|
if (this->viewport != NULL) {
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(VVW_WIDGET_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(VVW_WIDGET_VIEWPORT);
|
||||||
|
|
|
@ -133,7 +133,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnResize(Point delta)
|
virtual void OnResize()
|
||||||
{
|
{
|
||||||
if (this->viewport != NULL) {
|
if (this->viewport != NULL) {
|
||||||
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT);
|
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT);
|
||||||
|
|
|
@ -640,10 +640,7 @@ void Window::ReInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeWindow(this, dx, dy); // Sets post-resize dirty blocks.
|
ResizeWindow(this, dx, dy); // Sets post-resize dirty blocks.
|
||||||
Point diff;
|
this->OnResize(); // Calls NWidgetViewport::UpdateViewportCoordinates()
|
||||||
diff.x = dx;
|
|
||||||
diff.y = dy;
|
|
||||||
this->OnResize(diff); // Calls NWidgetViewport::UpdateViewportCoordinates()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find the Window whose parent pointer points to this window
|
/** Find the Window whose parent pointer points to this window
|
||||||
|
@ -1046,11 +1043,7 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height)
|
||||||
if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
|
if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
|
||||||
|
|
||||||
ResizeWindow(this, enlarge_x, enlarge_y);
|
ResizeWindow(this, enlarge_x, enlarge_y);
|
||||||
|
this->OnResize();
|
||||||
Point diff;
|
|
||||||
diff.x = enlarge_x;
|
|
||||||
diff.y = enlarge_y;
|
|
||||||
this->OnResize(diff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int nx = this->left;
|
int nx = this->left;
|
||||||
|
@ -1840,11 +1833,7 @@ static bool HandleWindowDragging()
|
||||||
|
|
||||||
/* ResizeWindow sets both pre- and after-size to dirty for redrawal */
|
/* ResizeWindow sets both pre- and after-size to dirty for redrawal */
|
||||||
ResizeWindow(w, x, y);
|
ResizeWindow(w, x, y);
|
||||||
|
w->OnResize();
|
||||||
Point diff;
|
|
||||||
diff.x = x;
|
|
||||||
diff.y = y;
|
|
||||||
w->OnResize(diff);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2696,11 +2685,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
case WC_MAIN_TOOLBAR:
|
case WC_MAIN_TOOLBAR:
|
||||||
if (neww - w->width != 0) {
|
if (neww - w->width != 0) {
|
||||||
ResizeWindow(w, min(neww, 640) - w->width, 0);
|
ResizeWindow(w, min(neww, 640) - w->width, 0);
|
||||||
|
w->OnResize();
|
||||||
Point delta;
|
|
||||||
delta.x = neww - w->width;
|
|
||||||
delta.y = 0;
|
|
||||||
w->OnResize(delta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
top = w->top;
|
top = w->top;
|
||||||
|
|
|
@ -771,9 +771,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Called after the window got resized.
|
* Called after the window got resized.
|
||||||
* For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
|
* For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
|
||||||
* @param delta The amount of which the window size changed.
|
|
||||||
*/
|
*/
|
||||||
virtual void OnResize(Point delta) {}
|
virtual void OnResize() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dropdown option associated to this window has been selected.
|
* A dropdown option associated to this window has been selected.
|
||||||
|
|
Loading…
Reference in New Issue