mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Widen WindowFlags to 32 bits
This commit is contained in:
@@ -838,7 +838,7 @@ public:
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
uint32_t flags) override
|
||||
WindowFlags flags) override
|
||||
{
|
||||
height += wp->getTitleBarDiffTarget();
|
||||
|
||||
@@ -1070,7 +1070,7 @@ public:
|
||||
/**
|
||||
* Closes all windows, save for those having any of the passed flags.
|
||||
*/
|
||||
void CloseAllExceptFlags(uint16_t flags) override
|
||||
void CloseAllExceptFlags(WindowFlags flags) override
|
||||
{
|
||||
CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags & flags); });
|
||||
}
|
||||
@@ -1347,7 +1347,7 @@ public:
|
||||
return &w;
|
||||
}
|
||||
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override
|
||||
{
|
||||
WindowBase* w = FindByClass(cls);
|
||||
if (w != nullptr)
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace OpenRCT2
|
||||
WF_AUTO_POSITION = (1 << 16),
|
||||
WF_CENTRE_SCREEN = (1 << 17),
|
||||
};
|
||||
using WindowFlags = uint32_t;
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace OpenRCT2
|
||||
rct_windownumber number{};
|
||||
RideId rideId;
|
||||
};
|
||||
uint16_t flags{};
|
||||
WindowFlags flags{};
|
||||
OpenRCT2::ScrollArea scrolls[3];
|
||||
uint16_t no_list_items{}; // 0 for no items
|
||||
int16_t selected_list_item{}; // -1 for none selected
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
uint32_t flags) override
|
||||
WindowFlags flags) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui
|
||||
void CloseTop() override {};
|
||||
void CloseAll() override {};
|
||||
void CloseAllExceptClass(WindowClass cls) override {};
|
||||
void CloseAllExceptFlags(uint16_t flags) override {};
|
||||
void CloseAllExceptFlags(WindowFlags flags) override {};
|
||||
void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) override {};
|
||||
void CloseConstructionWindows() override {};
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace OpenRCT2::Ui
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -44,26 +44,27 @@ namespace OpenRCT2::Ui
|
||||
virtual WindowBase* GetOwner(const Viewport* viewport) = 0;
|
||||
|
||||
virtual WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags)
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
WindowFlags flags)
|
||||
= 0;
|
||||
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* Create(
|
||||
WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0,
|
||||
WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, WindowFlags flags = 0,
|
||||
TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(Create(std::make_unique<T>(std::forward<TArgs>(args)...), cls, pos, width, height, flags));
|
||||
}
|
||||
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* Create(WindowClass cls, int32_t width, int32_t height, uint32_t flags, TArgs&&... args)
|
||||
T* Create(WindowClass cls, int32_t width, int32_t height, WindowFlags flags, TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
Create(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<WindowBase, T>::value>::type* = nullptr>
|
||||
T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, WindowFlags flags = 0)
|
||||
{
|
||||
auto* w = BringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
@@ -74,7 +75,7 @@ namespace OpenRCT2::Ui
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* FocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
T* FocusOrCreate(WindowClass cls, int32_t width, int32_t height, WindowFlags flags = 0)
|
||||
{
|
||||
auto* w = BringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
@@ -92,7 +93,7 @@ namespace OpenRCT2::Ui
|
||||
virtual void CloseTop() = 0;
|
||||
virtual void CloseAll() = 0;
|
||||
virtual void CloseAllExceptClass(WindowClass cls) = 0;
|
||||
virtual void CloseAllExceptFlags(uint16_t flags) = 0;
|
||||
virtual void CloseAllExceptFlags(WindowFlags flags) = 0;
|
||||
virtual void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) = 0;
|
||||
virtual void CloseConstructionWindows() = 0;
|
||||
|
||||
@@ -112,7 +113,7 @@ namespace OpenRCT2::Ui
|
||||
|
||||
virtual WindowBase* BringToFront(WindowBase& w) = 0;
|
||||
virtual WindowBase* BringToFrontByClass(WindowClass cls) = 0;
|
||||
virtual WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) = 0;
|
||||
virtual WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) = 0;
|
||||
virtual WindowBase* BringToFrontByNumber(WindowClass cls, rct_windownumber number) = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user