mirror of https://github.com/OpenRCT2/OpenRCT2.git
Implement onClose event for custom windows
This commit is contained in:
parent
c0aa5bdcc8
commit
ca98ffc697
|
@ -192,6 +192,9 @@ namespace OpenRCT2::Ui::Windows
|
||||||
std::vector<CustomWidgetDesc> Widgets;
|
std::vector<CustomWidgetDesc> Widgets;
|
||||||
std::vector<colour_t> Colours;
|
std::vector<colour_t> Colours;
|
||||||
|
|
||||||
|
// Event handlers
|
||||||
|
DukValue OnClose;
|
||||||
|
|
||||||
CustomWindowDesc() = default;
|
CustomWindowDesc() = default;
|
||||||
|
|
||||||
bool IsResizable() const
|
bool IsResizable() const
|
||||||
|
@ -235,6 +238,8 @@ namespace OpenRCT2::Ui::Windows
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.OnClose = desc["onClose"];
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,8 +343,13 @@ namespace OpenRCT2::Ui::Windows
|
||||||
|
|
||||||
static void window_custom_close(rct_window* w)
|
static void window_custom_close(rct_window* w)
|
||||||
{
|
{
|
||||||
delete static_cast<CustomWindowInfo*>(w->custom_info);
|
auto info = static_cast<CustomWindowInfo*>(w->custom_info);
|
||||||
w->custom_info = nullptr;
|
if (info != nullptr)
|
||||||
|
{
|
||||||
|
InvokeEventHandler(info->Owner, info->Desc.OnClose);
|
||||||
|
delete info;
|
||||||
|
w->custom_info = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_custom_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
static void window_custom_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||||
|
|
Loading…
Reference in New Issue