1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Merge pull request #18408 from Broxzier/refactor/13778-loadsave-window

Refactor LoadSaveWindow to class
This commit is contained in:
Michael Steenbeek
2022-12-31 14:54:49 +01:00
committed by GitHub
2 changed files with 735 additions and 744 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,7 @@
#include <limits>
#include <list>
#include <memory>
#include <utility>
#include <variant>
struct rct_drawpixelinfo;
@@ -583,10 +584,11 @@ T* WindowCreate(WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width =
{
return static_cast<T*>(WindowCreate(std::make_unique<T>(), cls, pos, width, height, flags));
}
template<typename T, typename std::enable_if<std::is_base_of<rct_window, T>::value>::type* = nullptr>
T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0)
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<rct_window, T>::value>::type* = nullptr>
T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0, TArgs&&... args)
{
return static_cast<T*>(WindowCreate(std::make_unique<T>(), cls, {}, width, height, flags | WF_AUTO_POSITION));
return static_cast<T*>(
WindowCreate(std::make_unique<T>(std::forward<TArgs>(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION));
}
template<typename T, typename std::enable_if<std::is_base_of<rct_window, T>::value>::type* = nullptr>
T* WindowFocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0)