mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Add: data parameter in Window::Close method.
This allows passing data when closing a window, e.g. to indicate how it was closed.
This commit is contained in:
parent
cda6f24fe8
commit
f379b31e28
@ -99,7 +99,7 @@ struct AIConfigWindow : public Window {
|
|||||||
this->OnInvalidateData(0);
|
this->OnInvalidateData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||||
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
CloseWindowByClass(WC_SCRIPT_SETTINGS);
|
||||||
|
@ -90,7 +90,7 @@ struct BuildAirToolbarWindow : Window {
|
|||||||
this->last_user_action = INVALID_WID_AT;
|
this->last_user_action = INVALID_WID_AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
if (this->IsWidgetLowered(WID_AT_AIRPORT)) SetViewportCatchmentStation(nullptr, true);
|
||||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||||
@ -285,7 +285,7 @@ public:
|
|||||||
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
this->InitNested(1);
|
this->InitNested(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
_exit_game = true;
|
_exit_game = true;
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
/* If we are not set to exit the game, it means the bootstrap failed. */
|
/* If we are not set to exit the game, it means the bootstrap failed. */
|
||||||
if (!_exit_game) {
|
if (!_exit_game) {
|
||||||
@ -208,7 +208,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Stop listening to the content client events. */
|
/** Stop listening to the content client events. */
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
_network_content_client.RemoveCallback(this);
|
_network_content_client.RemoveCallback(this);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -129,7 +129,7 @@ struct IConsoleWindow : Window
|
|||||||
this->line_offset = GetStringBoundingBox("] ").width + WidgetDimensions::scaled.frametext.left;
|
this->line_offset = GetStringBoundingBox("] ").width + WidgetDimensions::scaled.frametext.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
_iconsole_mode = ICONSOLE_CLOSED;
|
_iconsole_mode = ICONSOLE_CLOSED;
|
||||||
VideoDriver::GetInstance()->EditBoxLostFocus();
|
VideoDriver::GetInstance()->EditBoxLostFocus();
|
||||||
|
@ -294,7 +294,7 @@ struct DepotWindow : Window {
|
|||||||
OrderBackup::Reset();
|
OrderBackup::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_BUILD_VEHICLE, this->window_number);
|
CloseWindowById(WC_BUILD_VEHICLE, this->window_number);
|
||||||
CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false);
|
CloseWindowById(GetWindowClassForVehicleType(this->type), VehicleListIdentifier(VL_DEPOT_LIST, this->type, this->owner, this->GetDepotIndex()).Pack(), false);
|
||||||
|
@ -108,7 +108,7 @@ struct BuildDocksToolbarWindow : Window {
|
|||||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
|
if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
|
||||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||||
@ -422,7 +422,7 @@ public:
|
|||||||
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
|
@ -313,7 +313,7 @@ public:
|
|||||||
if (_right_button_down && !this->is_critical) this->Close();
|
if (_right_button_down && !this->is_critical) this->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
SetRedErrorSquare(INVALID_TILE);
|
SetRedErrorSquare(INVALID_TILE);
|
||||||
if (_window_system_initialized) ShowFirstError();
|
if (_window_system_initialized) ShowFirstError();
|
||||||
|
@ -399,7 +399,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
/* pause is only used in single-player, non-editor mode, non menu mode */
|
/* pause is only used in single-player, non-editor mode, non menu mode */
|
||||||
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
|
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
|
||||||
|
@ -105,7 +105,7 @@ struct GSConfigWindow : public Window {
|
|||||||
this->RebuildVisibleSettings();
|
this->RebuildVisibleSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowByClass(WC_SCRIPT_LIST);
|
CloseWindowByClass(WC_SCRIPT_LIST);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -125,7 +125,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow {
|
|||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false); // unpause
|
if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false); // unpause
|
||||||
if (_game_mode != GM_MENU) ShowHighscoreTable(this->window_number, this->rank);
|
if (_game_mode != GM_MENU) ShowHighscoreTable(this->window_number, this->rank);
|
||||||
@ -173,7 +173,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow {
|
|||||||
this->rank = ranking;
|
this->rank = ranking;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_MENU) ShowVitalWindows();
|
if (_game_mode != GM_MENU) ShowVitalWindows();
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@ struct QueryStringWindow : public Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (!this->editbox.handled && this->parent != nullptr) {
|
if (!this->editbox.handled && this->parent != nullptr) {
|
||||||
Window *parent = this->parent;
|
Window *parent = this->parent;
|
||||||
@ -1109,7 +1109,7 @@ struct QueryWindow : public Window {
|
|||||||
this->FinishInitNested(WN_CONFIRM_POPUP_QUERY);
|
this->FinishInitNested(WN_CONFIRM_POPUP_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (this->proc != nullptr) this->proc(this->parent, false);
|
if (this->proc != nullptr) this->proc(this->parent, false);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -302,7 +302,7 @@ struct NetworkChatWindow : public Window {
|
|||||||
PositionNetworkChatWindow(this);
|
PositionNetworkChatWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
|
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -108,7 +108,7 @@ BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(W
|
|||||||
this->InitNested(WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
|
this->InitNested(WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseNetworkContentDownloadStatusWindow::Close()
|
void BaseNetworkContentDownloadStatusWindow::Close([[maybe_unused]] int data)
|
||||||
{
|
{
|
||||||
_network_content_client.RemoveCallback(this);
|
_network_content_client.RemoveCallback(this);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
@ -200,7 +200,7 @@ public:
|
|||||||
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
|
this->parent = FindWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
TarScanner::Mode mode = TarScanner::NONE;
|
TarScanner::Mode mode = TarScanner::NONE;
|
||||||
for (auto ctype : this->receivedTypes) {
|
for (auto ctype : this->receivedTypes) {
|
||||||
@ -570,7 +570,7 @@ public:
|
|||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
_network_content_client.RemoveCallback(this);
|
_network_content_client.RemoveCallback(this);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
|
BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
|
||||||
|
|
||||||
void Close() override;
|
void Close([[maybe_unused]] int data = 0) override;
|
||||||
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override;
|
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override;
|
||||||
void DrawWidget(const Rect &r, int widget) const override;
|
void DrawWidget(const Rect &r, int widget) const override;
|
||||||
void OnDownloadProgress(const ContentInfo *ci, int bytes) override;
|
void OnDownloadProgress(const ContentInfo *ci, int bytes) override;
|
||||||
|
@ -672,7 +672,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||||||
this->OnInvalidateData(GOID_NEWGRF_CURRENT_LOADED);
|
this->OnInvalidateData(GOID_NEWGRF_CURRENT_LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowByClass(WC_GRF_PARAMETERS);
|
CloseWindowByClass(WC_GRF_PARAMETERS);
|
||||||
CloseWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
|
@ -419,7 +419,7 @@ struct BuildRailToolbarWindow : Window {
|
|||||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true);
|
if (this->IsWidgetLowered(WID_RAT_BUILD_STATION)) SetViewportCatchmentStation(nullptr, true);
|
||||||
if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) SetViewportCatchmentWaypoint(nullptr, true);
|
if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) SetViewportCatchmentWaypoint(nullptr, true);
|
||||||
@ -1031,7 +1031,7 @@ public:
|
|||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
@ -1694,7 +1694,7 @@ public:
|
|||||||
this->OnInvalidateData();
|
this->OnInvalidateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
_convert_signal_button = false;
|
_convert_signal_button = false;
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
@ -2018,7 +2018,7 @@ struct BuildRailWaypointWindow : PickerWindowBase {
|
|||||||
this->BuildPickerList();
|
this->BuildPickerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
|
@ -327,7 +327,7 @@ struct BuildRoadToolbarWindow : Window {
|
|||||||
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_NORMAL && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true);
|
if (_game_mode == GM_NORMAL && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true);
|
||||||
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
if (_settings_client.gui.link_terraform_toolbar) CloseWindowById(WC_SCEN_LAND_GEN, 0, false);
|
||||||
@ -1223,7 +1223,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
this->PickerWindowBase::Close();
|
this->PickerWindowBase::Close();
|
||||||
|
@ -186,7 +186,7 @@ struct GameOptionsWindow : Window {
|
|||||||
if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) this->GetWidget<NWidgetStacked>(WID_GO_SURVEY_SEL)->SetDisplayedPlane(SZSP_NONE);
|
if constexpr (!NetworkSurveyHandler::IsSurveyPossible()) this->GetWidget<NWidgetStacked>(WID_GO_SURVEY_SEL)->SetDisplayedPlane(SZSP_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
CloseWindowById(WC_CUSTOM_CURRENCY, 0);
|
||||||
CloseWindowByClass(WC_TEXTFILE);
|
CloseWindowByClass(WC_TEXTFILE);
|
||||||
|
@ -1096,7 +1096,7 @@ SmallMapWindow::~SmallMapWindow()
|
|||||||
delete this->overlay;
|
delete this->overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ void SmallMapWindow::Close()
|
/* virtual */ void SmallMapWindow::Close([[maybe_unused]] int data)
|
||||||
{
|
{
|
||||||
this->BreakIndustryChainLink();
|
this->BreakIndustryChainLink();
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -199,7 +199,7 @@ public:
|
|||||||
void SmallMapCenterOnCurrentPos();
|
void SmallMapCenterOnCurrentPos();
|
||||||
Point GetStationMiddle(const Station *st) const;
|
Point GetStationMiddle(const Station *st) const;
|
||||||
|
|
||||||
void Close() override;
|
void Close([[maybe_unused]] int data = 0) override;
|
||||||
void SetStringParameters(int widget) const override;
|
void SetStringParameters(int widget) const override;
|
||||||
void OnInit() override;
|
void OnInit() override;
|
||||||
void OnPaint() override;
|
void OnPaint() override;
|
||||||
|
@ -1325,7 +1325,7 @@ struct StationViewWindow : public Window {
|
|||||||
this->owner = Station::Get(window_number)->owner;
|
this->owner = Station::Get(window_number)->owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
|
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->window_number).Pack(), false);
|
||||||
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false);
|
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->window_number).Pack(), false);
|
||||||
@ -2287,7 +2287,7 @@ struct SelectStationWindow : Window {
|
|||||||
_thd.freeze = true;
|
_thd.freeze = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
SetViewportCatchmentSpecializedStation<T>(nullptr, true);
|
SetViewportCatchmentSpecializedStation<T>(nullptr, true);
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ public:
|
|||||||
this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server);
|
this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
SetViewportCatchmentTown(Town::Get(this->window_number), false);
|
SetViewportCatchmentTown(Town::Get(this->window_number), false);
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -2935,7 +2935,7 @@ public:
|
|||||||
this->UpdateButtonStatus();
|
this->UpdateButtonStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
||||||
CloseWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
CloseWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
this->OnInvalidateData(0);
|
this->OnInvalidateData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
CloseWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
|
CloseWindowById(GetWindowClassForVehicleType(this->vt), VehicleListIdentifier(VL_STATION_LIST, this->vt, this->owner, this->window_number).Pack(), false);
|
||||||
SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), false);
|
SetViewportCatchmentWaypoint(Waypoint::Get(this->window_number), false);
|
||||||
|
@ -173,7 +173,7 @@ struct DropdownWindow : Window {
|
|||||||
this->instant_close = instant_close;
|
this->instant_close = instant_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override
|
void Close([[maybe_unused]] int data = 0) override
|
||||||
{
|
{
|
||||||
/* Finish closing the dropdown, so it doesn't affect new window placement.
|
/* Finish closing the dropdown, so it doesn't affect new window placement.
|
||||||
* Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */
|
* Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */
|
||||||
|
@ -1045,7 +1045,7 @@ void Window::CloseChildWindows(WindowClass wc) const
|
|||||||
/**
|
/**
|
||||||
* Hide the window and all its child windows, and mark them for a later deletion.
|
* Hide the window and all its child windows, and mark them for a later deletion.
|
||||||
*/
|
*/
|
||||||
void Window::Close()
|
void Window::Close([[maybe_unused]] int data)
|
||||||
{
|
{
|
||||||
/* Don't close twice. */
|
/* Don't close twice. */
|
||||||
if (*this->z_position == nullptr) return;
|
if (*this->z_position == nullptr) return;
|
||||||
@ -1141,11 +1141,11 @@ Window *GetMainWindow()
|
|||||||
* @param number Number of the window within the window class
|
* @param number Number of the window within the window class
|
||||||
* @param force force closing; if false don't close when stickied
|
* @param force force closing; if false don't close when stickied
|
||||||
*/
|
*/
|
||||||
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
|
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
|
||||||
{
|
{
|
||||||
Window *w = FindWindowById(cls, number);
|
Window *w = FindWindowById(cls, number);
|
||||||
if (w != nullptr && (force || (w->flags & WF_STICKY) == 0)) {
|
if (w != nullptr && (force || (w->flags & WF_STICKY) == 0)) {
|
||||||
w->Close();
|
w->Close(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,12 +1153,12 @@ void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
|
|||||||
* Close all windows of a given class
|
* Close all windows of a given class
|
||||||
* @param cls Window class of windows to delete
|
* @param cls Window class of windows to delete
|
||||||
*/
|
*/
|
||||||
void CloseWindowByClass(WindowClass cls)
|
void CloseWindowByClass(WindowClass cls, int data)
|
||||||
{
|
{
|
||||||
/* Note: the container remains stable, even when deleting windows. */
|
/* Note: the container remains stable, even when deleting windows. */
|
||||||
for (Window *w : Window::Iterate()) {
|
for (Window *w : Window::Iterate()) {
|
||||||
if (w->window_class == cls) {
|
if (w->window_class == cls) {
|
||||||
w->Close();
|
w->Close(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3486,7 +3486,7 @@ void RelocateAllWindows(int neww, int newh)
|
|||||||
* Hide the window and all its child windows, and mark them for a later deletion.
|
* Hide the window and all its child windows, and mark them for a later deletion.
|
||||||
* Always call ResetObjectToPlace() when closing a PickerWindow.
|
* Always call ResetObjectToPlace() when closing a PickerWindow.
|
||||||
*/
|
*/
|
||||||
void PickerWindowBase::Close()
|
void PickerWindowBase::Close([[maybe_unused]] int data)
|
||||||
{
|
{
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
this->Window::Close();
|
this->Window::Close();
|
||||||
|
@ -73,13 +73,13 @@ void SetWindowDirty(WindowClass cls, T number)
|
|||||||
SetWindowDirty(cls, static_cast<typename T::BaseType>(number));
|
SetWindowDirty(cls, static_cast<typename T::BaseType>(number));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true);
|
void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true, int data = 0);
|
||||||
void CloseWindowByClass(WindowClass cls);
|
void CloseWindowByClass(WindowClass cls, int data = 0);
|
||||||
|
|
||||||
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
|
template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
|
||||||
void CloseWindowById(WindowClass cls, T number, bool force = true)
|
void CloseWindowById(WindowClass cls, T number, bool force = true, int data = 0)
|
||||||
{
|
{
|
||||||
CloseWindowById(cls, static_cast<typename T::BaseType>(number), force);
|
CloseWindowById(cls, static_cast<typename T::BaseType>(number), force, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditBoxInGlobalFocus();
|
bool EditBoxInGlobalFocus();
|
||||||
|
@ -488,7 +488,7 @@ public:
|
|||||||
static int SortButtonWidth();
|
static int SortButtonWidth();
|
||||||
|
|
||||||
void CloseChildWindows(WindowClass wc = WC_INVALID) const;
|
void CloseChildWindows(WindowClass wc = WC_INVALID) const;
|
||||||
virtual void Close();
|
virtual void Close(int data = 0);
|
||||||
static void DeleteClosedWindows();
|
static void DeleteClosedWindows();
|
||||||
|
|
||||||
void SetDirty() const;
|
void SetDirty() const;
|
||||||
@ -922,7 +922,7 @@ public:
|
|||||||
this->parent = parent;
|
this->parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close() override;
|
void Close([[maybe_unused]] int data = 0) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
||||||
|
Loading…
Reference in New Issue
Block a user