diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 4bce4325bb..cb42b5335e 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -980,7 +980,7 @@ private: w = it->get(); - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) { continue; } diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index d3d6ec6c45..6ad62a773f 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -665,9 +665,9 @@ public: { for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; - if (w->flags & WF_STICK_TO_BACK) + if (w->flags.has(WindowFlag::stickToBack)) continue; if (loc.x + windowSize.width <= w->windowPos.x) @@ -759,9 +759,9 @@ public: // Place window next to another for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; - if (w->flags & WF_STICK_TO_BACK) + if (w->flags.has(WindowFlag::stickToBack)) continue; const ScreenCoordsXY offsets[] = { @@ -788,9 +788,9 @@ public: // Overlap for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; - if (w->flags & WF_STICK_TO_BACK) + if (w->flags.has(WindowFlag::stickToBack)) continue; const ScreenCoordsXY offsets[] = { @@ -839,9 +839,9 @@ public: { windowSize.height += wp->getTitleBarDiffTarget(); - if (flags & WF_AUTO_POSITION) + if (flags.has(WindowFlag::autoPosition)) { - if (flags & WF_CENTRE_SCREEN) + if (flags.has(WindowFlag::centreScreen)) { pos = GetCentrePositionForNewWindow(windowSize); } @@ -860,9 +860,9 @@ public: // Close least recently used window for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; - if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE))) + if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))) { Close(*w.get()); break; @@ -872,25 +872,25 @@ public: // Find right position to insert new window auto itDestPos = gWindowList.end(); - if (flags & WF_STICK_TO_BACK) + if (flags.has(WindowFlag::stickToBack)) { for (auto it = gWindowList.begin(); it != gWindowList.end(); it++) { - if ((*it)->flags & WF_DEAD) + if ((*it)->flags.has(WindowFlag::dead)) continue; - if (!((*it)->flags & WF_STICK_TO_BACK)) + if (!((*it)->flags.has(WindowFlag::stickToBack))) { itDestPos = it; } } } - else if (!(flags & WF_STICK_TO_FRONT)) + else if (!(flags.has(WindowFlag::stickToFront))) { for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++) { - if ((*it)->flags & WF_DEAD) + if ((*it)->flags.has(WindowFlag::dead)) continue; - if (!((*it)->flags & WF_STICK_TO_FRONT)) + if (!((*it)->flags.has(WindowFlag::stickToFront))) { itDestPos = it.base(); break; @@ -903,9 +903,9 @@ public: wp->flags = flags; // Play sounds and flash the window - if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) + if (!(flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))) { - wp->flags |= WF_WHITE_BORDER_MASK; + wp->flash(); OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (windowSize.width / 2)); } @@ -947,7 +947,7 @@ public: // Invalidate the window (area) w.invalidate(); - w.flags |= WF_DEAD; + w.flags |= WindowFlag::dead; } void CloseSurplus(int32_t cap, WindowClass avoid_classification) override @@ -962,9 +962,9 @@ public: WindowBase* foundW{}; for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; - if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE))) + if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))) { foundW = w.get(); break; @@ -991,7 +991,7 @@ public: for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); ++it) { auto& wnd = *(*it); - if (wnd.flags & WF_DEAD) + if (wnd.flags.has(WindowFlag::dead)) continue; if (pred(&wnd)) @@ -1007,7 +1007,7 @@ public: // Now close the collected windows for (auto* wnd : windowsToClose) { - if (!(wnd->flags & WF_DEAD)) + if (!(wnd->flags.has(WindowFlag::dead))) { Close(*wnd); } @@ -1053,7 +1053,7 @@ public: return; } - auto pred = [](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); }; + auto pred = [](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); }; CloseByCondition(pred, WindowCloseFlags::CloseSingle); } @@ -1065,14 +1065,15 @@ public: void CloseAll() override { CloseByClass(WindowClass::dropdown); - CloseByCondition([](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); }); + CloseByCondition( + [](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); }); } void CloseAllExceptClass(WindowClass cls) override { CloseByClass(WindowClass::dropdown); CloseByCondition([cls](WindowBase* w) -> bool { - return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); + return w->classification != cls && !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); }); } @@ -1081,7 +1082,7 @@ public: */ void CloseAllExceptFlags(WindowFlags flags) override { - CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags & flags); }); + CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags.hasAny(flags)); }); } /** @@ -1091,7 +1092,9 @@ public: { CloseByClass(WindowClass::dropdown); CloseByCondition([cls, number](WindowBase* w) -> bool { - return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))); + return ( + !(w->number == number && w->classification == cls) + && !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))); }); } @@ -1116,7 +1119,7 @@ public: { for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; if (w->classification == cls) { @@ -1135,7 +1138,7 @@ public: { for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; if (w->classification == cls && w->number == number) { @@ -1160,14 +1163,14 @@ public: for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++) { auto& w = *it; - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; if (screenCoords.x < w->windowPos.x || screenCoords.x >= w->windowPos.x + w->width || screenCoords.y < w->windowPos.y || screenCoords.y >= w->windowPos.y + w->height) continue; - if (w->flags & WF_NO_BACKGROUND) + if (w->flags.has(WindowFlag::noBackground)) { auto widgetIndex = FindWidgetFromPoint(*w.get(), screenCoords); if (widgetIndex == kWidgetIndexNull) @@ -1324,7 +1327,7 @@ public: */ WindowBase* BringToFront(WindowBase& w) override { - if (!(w.flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) + if (!(w.flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))) { auto itSourcePos = WindowGetIterator(&w); if (itSourcePos != gWindowList.end()) @@ -1334,11 +1337,11 @@ public: for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++) { auto& w2 = *it; - if (w2->flags & WF_DEAD) + if (w2->flags.has(WindowFlag::dead)) { continue; } - if (!(w2->flags & WF_STICK_TO_FRONT)) + if (!(w2->flags.has(WindowFlag::stickToFront))) { // base() returns the next element in the list, so we need to decrement it. itDestPos = std::prev(it.base()); @@ -1365,12 +1368,12 @@ public: return &w; } - WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override + WindowBase* BringToFrontByClass(WindowClass cls) override { WindowBase* w = FindByClass(cls); if (w != nullptr) { - w->flags |= flags; + w->flash(); w->invalidate(); w = BringToFront(*w); } @@ -1378,11 +1381,6 @@ public: return w; } - WindowBase* BringToFrontByClass(WindowClass cls) override - { - return BringToFrontByClassWithFlags(cls, WF_WHITE_BORDER_MASK); - } - /** * * rct2: 0x006ED78A @@ -1392,7 +1390,7 @@ public: WindowBase* w = FindByNumber(cls, number); if (w != nullptr) { - w->flags |= WF_WHITE_BORDER_MASK; + w->flash(); w->invalidate(); w = BringToFront(*w); } diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 2a5a67015f..6ab8f9ee73 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -492,7 +492,7 @@ namespace OpenRCT2 { int32_t snapProximity; - snapProximity = (w.flags & WF_NO_SNAPPING) ? 0 : Config::Get().general.WindowSnapProximity; + snapProximity = (w.flags.has(WindowFlag::noSnapping)) ? 0 : Config::Get().general.WindowSnapProximity; WindowMoveAndSnap(w, newScreenCoords - lastScreenCoords, snapProximity); } @@ -540,7 +540,7 @@ namespace OpenRCT2 static void InputViewportDragBegin(WindowBase& w) { - w.flags &= ~WF_SCROLLING_TO_LOCATION; + w.flags.unset(WindowFlag::scrollingToLocation); _inputState = InputState::ViewportRight; _dragWidget.windowClassification = w.classification; _dragWidget.windowNumber = w.number; @@ -591,7 +591,7 @@ namespace OpenRCT2 } else if (differentialCoords.x != 0 || differentialCoords.y != 0) { - if (!(w->flags & WF_NO_SCROLLING)) + if (!(w->flags.has(WindowFlag::noScrolling))) { // User dragged a scrollable viewport @@ -1076,7 +1076,7 @@ namespace OpenRCT2 { case WidgetType::frame: case WidgetType::resize: - if (WindowCanResize(*w) + if (w->canBeResized() && (screenCoords.x >= w->windowPos.x + w->width - 19 && screenCoords.y >= w->windowPos.y + w->height - 19)) InputWindowResizeBegin(*w, widgetIndex, screenCoords); break; @@ -1597,7 +1597,7 @@ namespace OpenRCT2 mainWindow = WindowGetMain(); if (mainWindow == nullptr) return; - if ((mainWindow->flags & WF_NO_SCROLLING) + if ((mainWindow->flags.has(WindowFlag::noScrolling)) || (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence)) return; if (mainWindow->viewport == nullptr) @@ -1704,7 +1704,7 @@ namespace OpenRCT2 return; } - if (targetWindow->flags & WF_NO_SCROLLING) + if (targetWindow->flags.has(WindowFlag::noScrolling)) { return; } diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index 1e7c7826b1..84198b8c89 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -938,6 +938,6 @@ static constexpr UIThemeWindowEntry PredefinedThemeRCT1_Entries[] = } // Some windows need to be transparent even if the colours aren't. // There doesn't seem to be any side-effects for all windows being transparent - window->flags |= WF_TRANSPARENT; + window->flags |= WindowFlag::transparent; } } // namespace OpenRCT2::Ui diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 4e75c5d0e6..f7fd73bdd0 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -141,7 +141,7 @@ namespace OpenRCT2::Ui int32_t b = w.windowPos.y + widget.bottom; // - uint8_t press = ((w.flags & WF_10) ? INSET_RECT_FLAG_FILL_MID_LIGHT : 0); + uint8_t press = (w.flags.has(WindowFlag::higherContrastOnPress) ? INSET_RECT_FLAG_FILL_MID_LIGHT : 0); auto colour = w.colours[widget.colour]; @@ -537,7 +537,7 @@ namespace OpenRCT2::Ui auto colour = w.colours[widget->colour]; uint8_t press = INSET_RECT_F_60; - if (w.flags & WF_10) + if (w.flags.has(WindowFlag::higherContrastOnPress)) press |= INSET_RECT_FLAG_FILL_MID_LIGHT; GfxFillRectInset(rt, { topLeft, bottomRight }, colour, press); @@ -593,7 +593,7 @@ namespace OpenRCT2::Ui // Check if the button is pressed down uint8_t press = 0; - if (w.flags & WF_10) + if (w.flags.has(WindowFlag::higherContrastOnPress)) press |= INSET_RECT_FLAG_FILL_MID_LIGHT; if (widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex)) press |= INSET_RECT_FLAG_BORDER_INSET; diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index f2b3cef84a..447b1ca27c 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -532,7 +532,7 @@ namespace OpenRCT2::Ui::Windows for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++) { auto& w = **it; - if (w.flags & WF_DEAD) + if (w.flags.has(WindowFlag::dead)) continue; auto viewport = w.viewport; @@ -925,7 +925,7 @@ namespace OpenRCT2::Ui::Windows // Work out if the window requires moving if (w->windowPos.x + 10 < width) { - if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) + if (w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)) { if (w->windowPos.y - 22 < height) { @@ -994,11 +994,6 @@ namespace OpenRCT2::Ui::Windows return false; } - bool WindowCanResize(const WindowBase& w) - { - return (w.flags & WF_RESIZABLE) && (w.minWidth != w.maxWidth || w.minHeight != w.maxHeight); - } - /** * * rct2: 0x006EA73F @@ -1026,7 +1021,7 @@ namespace OpenRCT2::Ui::Windows */ void WindowDrawWidgets(WindowBase& w, RenderTarget& rt) { - if ((w.flags & WF_TRANSPARENT) && !(w.flags & WF_NO_BACKGROUND)) + if ((w.flags.has(WindowFlag::transparent)) && !(w.flags.has(WindowFlag::noBackground))) GfxFilterRect( rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::Palette51); @@ -1051,7 +1046,7 @@ namespace OpenRCT2::Ui::Windows // todo: something missing here too? Between 006EC32B and 006EC369 - if (w.flags & WF_WHITE_BORDER_MASK) + if (w.flashTimer > 0) { GfxFillRectInset( rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, { COLOUR_WHITE }, diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h index df16994ae1..fbdb0b1c50 100644 --- a/src/openrct2-ui/interface/Window.h +++ b/src/openrct2-ui/interface/Window.h @@ -83,7 +83,6 @@ namespace OpenRCT2::Ui::Windows void WindowRelocateWindows(int32_t width, int32_t height); bool WindowSetResize(WindowBase& w, ScreenSize minSize, ScreenSize maxSize); - bool WindowCanResize(const WindowBase& w); void InvalidateAllWindowsAfterInput(); diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 4c4b54905a..723b7a209f 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -813,7 +813,7 @@ namespace OpenRCT2::Ui::Windows if (viewport == nullptr) { ViewportCreate(*this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0))); - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; invalidate(); } else @@ -1131,7 +1131,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* WindowCustomOpen(std::shared_ptr owner, DukValue dukDesc) { auto desc = CustomWindowDesc::FromDukValue(dukDesc); - uint16_t windowFlags = WF_RESIZABLE | WF_TRANSPARENT; + WindowFlags windowFlags = { WindowFlag::resizable, WindowFlag::transparent }; auto* windowMgr = GetWindowManager(); CustomWindow* window{}; diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index 89a8580e22..2d38793127 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -276,7 +276,7 @@ namespace OpenRCT2::Scripting { viewport->viewPos.x = left; viewport->viewPos.y = top; - w->flags &= ~WF_SCROLLING_TO_LOCATION; + w->flags.unset(WindowFlag::scrollingToLocation); w->savedViewPos.x = viewport->viewPos.x; w->savedViewPos.y = viewport->viewPos.y; viewport->Invalidate(); diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index 8d11943e71..93abaafb9e 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -97,7 +97,7 @@ namespace OpenRCT2::Scripting auto w = GetWindow(); if (w != nullptr) { - if (WindowCanResize(*w)) + if (w->canBeResized()) { WindowResizeByDelta(*w, value - w->width, 0); } @@ -122,7 +122,7 @@ namespace OpenRCT2::Scripting if (w != nullptr) { value += w->getTitleBarDiffNormal(); - if (WindowCanResize(*w)) + if (w->canBeResized()) { WindowResizeByDelta(*w, 0, value - w->height); } @@ -207,7 +207,7 @@ namespace OpenRCT2::Scripting auto w = GetWindow(); if (w != nullptr) { - return (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) != 0; + return (w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); } return false; } @@ -334,7 +334,7 @@ namespace OpenRCT2::Scripting { auto* windowMgr = Ui::GetWindowManager(); w = windowMgr->BringToFront(*w); - w->flags |= WF_WHITE_BORDER_MASK; + w->flash(); } } diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 8e6ee5d46e..09f3cce5ad 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -288,6 +288,6 @@ namespace OpenRCT2::Ui::Windows WindowBase* AboutOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::about, kWindowSize, WF_CENTRE_SCREEN); + return windowMgr->FocusOrCreate(WindowClass::about, kWindowSize, WindowFlag::centreScreen); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index 38cb3ad0de..ad8602fc6e 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -341,7 +341,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* AssetPacksOpen() { auto* windowMgr = GetWindowManager(); - auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN; + WindowFlags flags = { WindowFlag::autoPosition, WindowFlag::centreScreen }; return windowMgr->FocusOrCreate(WindowClass::assetPacks, kWindowSize, flags); } diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index 5dd9d01809..3cf07e3fb2 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -322,7 +322,7 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) return w; - w = windowMgr->Create(WindowClass::banner, kWindowSize, 0); + w = windowMgr->Create(WindowClass::banner, kWindowSize, {}); if (w != nullptr) w->initialise(number); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index f622aabf54..6e2aa2d371 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows int32_t width = (ContextGetWidth() * 4) / 5; int32_t height = (ContextGetHeight() * 4) / 5; auto* newWindow = windowMgr->Create( - WindowClass::changelog, { width, height }, WF_CENTRE_SCREEN | WF_RESIZABLE); + WindowClass::changelog, { width, height }, { WindowFlag::centreScreen, WindowFlag::resizable }); newWindow->SetPersonality(personality); return newWindow; } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 12484881c9..5286ee8aa8 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -369,7 +369,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::clearScenery, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); + WindowClass::clearScenery, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, {}); } /** diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 7005f75988..2f0f5aff70 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -223,6 +223,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* CustomCurrencyOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::customCurrencyConfig, kWindowSize, WF_CENTRE_SCREEN); + return windowMgr->FocusOrCreate( + WindowClass::customCurrencyConfig, kWindowSize, WindowFlag::centreScreen); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index cf4dfa3f41..ac5924bcae 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -156,7 +156,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->FocusOrCreate( WindowClass::debugPaint, { 16, ContextGetHeight() - 16 - 33 - kWindowSize.height }, kWindowSize, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noTitleBar }); return window; } diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 18324134b9..dc4219a39f 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -104,12 +104,12 @@ namespace OpenRCT2::Ui::Windows windowMgr->Close(*w); newWindow = windowMgr->Create( - WindowClass::demolishRidePrompt, windowPos, kWindowSize, WF_TRANSPARENT); + WindowClass::demolishRidePrompt, windowPos, kWindowSize, WindowFlag::transparent); } else { newWindow = windowMgr->Create( - WindowClass::demolishRidePrompt, kWindowSize, WF_CENTRE_SCREEN | WF_TRANSPARENT); + WindowClass::demolishRidePrompt, kWindowSize, { WindowFlag::centreScreen, WindowFlag::transparent }); } newWindow->SetRide(ride); diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index b54ba2ed06..169d8616c7 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -229,7 +229,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); if (colour.hasFlag(ColourFlag::translucent)) - flags |= WF_TRANSPARENT; + flags |= WindowFlag::transparent; colours[0] = colour; } @@ -262,7 +262,7 @@ namespace OpenRCT2::Ui::Windows UpdateSizeAndPosition(screenPos, extraY); if (colour.hasFlag(ColourFlag::translucent)) - flags |= WF_TRANSPARENT; + flags |= WindowFlag::transparent; colours[0] = colour; } @@ -394,7 +394,7 @@ namespace OpenRCT2::Ui::Windows // Create the window (width/height position are set later) auto* windowMgr = GetWindowManager(); auto* w = windowMgr->Create( - WindowClass::dropdown, { width, customItemHeight }, WF_STICK_TO_FRONT | WF_NO_TITLE_BAR); + WindowClass::dropdown, { width, customItemHeight }, { WindowFlag::stickToFront, WindowFlag::noTitleBar }); if (w != nullptr) { auto numRowsPerColumn = prefRowsPerColumn > 0 ? static_cast(prefRowsPerColumn) : Dropdown::kItemsMaxSize; @@ -438,7 +438,7 @@ namespace OpenRCT2::Ui::Windows // Create the window (width/height position are set later) auto* windowMgr = GetWindowManager(); - auto* w = windowMgr->Create(WindowClass::dropdown, { itemWidth, itemHeight }, WF_STICK_TO_FRONT); + auto* w = windowMgr->Create(WindowClass::dropdown, { itemWidth, itemHeight }, WindowFlag::stickToFront); if (w != nullptr) { w->setImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 29b0d14693..09bc868a0c 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -452,7 +452,8 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->Create( WindowClass::bottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - kToolbarHeight), - { ContextGetWidth(), kToolbarHeight }, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); + { ContextGetWidth(), kToolbarHeight }, + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar }); return window; } diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index ebefe7584f..0d7e76813f 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -588,7 +588,8 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::editorInventionList, kWindowSize, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN); + WindowClass::editorInventionList, kWindowSize, + { WindowFlag::noScrolling, WindowFlag::resizable, WindowFlag::centreScreen }); } #pragma endregion @@ -686,7 +687,8 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseByClass(WindowClass::editorInventionListDrag); auto* wnd = windowMgr->Create( - WindowClass::editorInventionListDrag, { 10, 14 }, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); + WindowClass::editorInventionListDrag, { 10, 14 }, + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noSnapping }); if (wnd != nullptr) { wnd->init(*researchItem, editorPos, objectSelectionScrollWidth); diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 99e9d8f3f9..96b5403f11 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1630,7 +1630,8 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::editorObjectSelection, kWindowSize, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); + WindowClass::editorObjectSelection, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::resizable, WindowFlag::centreScreen }); } // Used for forced closure diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 304e4fe374..d45f84ec48 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -403,7 +403,8 @@ namespace OpenRCT2::Ui::Windows if (window != nullptr) return window; - window = windowMgr->Create(WindowClass::editorParkEntrance, kWindowSize, WF_10 | WF_RESIZABLE); + window = windowMgr->Create( + WindowClass::editorParkEntrance, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); return window; } diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 323d33ea26..635135ad2b 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -2385,6 +2385,6 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::editorScenarioOptions, { 280, 148 }, WF_NO_SCROLLING | WF_CENTRE_SCREEN); + WindowClass::editorScenarioOptions, { 280, 148 }, { WindowFlag::noScrolling, WindowFlag::centreScreen }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 4ea518b4aa..a0c98c0ae4 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -144,7 +144,7 @@ namespace OpenRCT2::Ui::Windows return windowMgr->Create( std::move(errorWindow), WindowClass::error, windowPosition, { width, height }, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_TITLE_BAR); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noTitleBar }); } WindowBase* ErrorOpen(StringId title, StringId message, const Formatter& args, bool autoClose) diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index a31ef49d80..7918d12bde 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -487,19 +487,19 @@ namespace OpenRCT2::Ui::Windows { width = kWindowSizeResearch.width; height = kWindowSizeResearch.height; - flags &= ~WF_RESIZABLE; + flags.unset(WindowFlag::resizable); } else if (p == WINDOW_FINANCES_PAGE_SUMMARY) { width = kWindowSizeSummary.width; height = kWindowSizeSummary.height; - flags &= ~WF_RESIZABLE; + flags.unset(WindowFlag::resizable); } else if ( p == WINDOW_FINANCES_PAGE_VALUE_GRAPH || p == WINDOW_FINANCES_PAGE_PROFIT_GRAPH || p == WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH) { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; // We need to compensate for the enlarged title bar for windows that do not // constrain the window height between tabs (e.g. chart tabs) @@ -511,7 +511,7 @@ namespace OpenRCT2::Ui::Windows { width = kWindowSizeGraphsMarketing.width; height = kWindowSizeGraphsMarketing.height; - flags &= ~WF_RESIZABLE; + flags.unset(WindowFlag::resizable); } setWidgets(_windowFinancesPageWidgets[p]); @@ -879,7 +879,8 @@ namespace OpenRCT2::Ui::Windows static FinancesWindow* FinancesWindowOpen(uint8_t page) { auto* windowMgr = Ui::GetWindowManager(); - auto* window = windowMgr->FocusOrCreate(WindowClass::finances, kWindowSizeSummary, WF_10); + auto* window = windowMgr->FocusOrCreate( + WindowClass::finances, kWindowSizeSummary, WindowFlag::higherContrastOnPress); if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY) window->setPage(page); @@ -890,7 +891,8 @@ namespace OpenRCT2::Ui::Windows WindowBase* FinancesOpen() { auto* windowMgr = Ui::GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::finances, kWindowSizeSummary, WF_10); + return windowMgr->FocusOrCreate( + WindowClass::finances, kWindowSizeSummary, WindowFlag::higherContrastOnPress); } WindowBase* FinancesResearchOpen() diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index a489a0510d..1b1b72bf1b 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -1567,7 +1567,7 @@ namespace OpenRCT2::Ui::Windows } auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::footpath, kWindowSize, 0); + return windowMgr->FocusOrCreate(WindowClass::footpath, kWindowSize, {}); } void WindowFootpathResetSelectedPath() diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index df0eca8d17..729e4b99cd 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -693,7 +693,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->Create( WindowClass::bottomToolbar, ScreenCoordsXY(0, screenHeight - toolbarHeight), { screenWidth, toolbarHeight }, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar }); return window; } diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 4ca183112e..098f734a92 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -771,7 +771,7 @@ namespace OpenRCT2::Ui::Windows { viewport->flags = origViewportFlags; } - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; invalidate(); } invalidate(); @@ -1924,7 +1924,7 @@ namespace OpenRCT2::Ui::Windows if (Config::Get().general.DebuggingTools) windowSize.width += kTabWidth; - window = windowMgr->Create(WindowClass::peep, windowSize, WF_RESIZABLE); + window = windowMgr->Create(WindowClass::peep, windowSize, WindowFlag::resizable); if (window == nullptr) { return nullptr; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index a87009ef9f..be520e6fb0 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -951,7 +951,8 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->BringToFrontByClass(WindowClass::guestList); if (window == nullptr) { - window = windowMgr->Create(WindowClass::guestList, kWindowSize, WF_10 | WF_RESIZABLE); + window = windowMgr->Create( + WindowClass::guestList, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); } return window; } diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 0312cd4657..357204b6de 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -423,7 +423,7 @@ namespace OpenRCT2::Ui::Windows _currentTrackPieceDirection = 2; auto* window = windowMgr->FocusOrCreate( - WindowClass::installTrack, kWindowSize, WF_AUTO_POSITION | WF_CENTRE_SCREEN); + WindowClass::installTrack, kWindowSize, { WindowFlag::autoPosition, WindowFlag::centreScreen }); window->setupTrack(path, std::move(trackDesign)); return window; diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 957bc812b2..441ca812d6 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -876,7 +876,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::land, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); + WindowClass::land, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, {}); } /** diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index c5dd69576c..cebdd001d6 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -595,6 +595,6 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::landRights, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); + WindowClass::landRights, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, {}); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 8b05e93c17..581b4d4e95 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -1179,8 +1179,9 @@ namespace OpenRCT2::Ui::Windows ScreenSize windowSize = { config.FileBrowserWidth, config.FileBrowserHeight }; w = windowMgr->Create( - WindowClass::loadsave, windowSize, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN, - action, type); + WindowClass::loadsave, windowSize, + { WindowFlag::stickToFront, WindowFlag::resizable, WindowFlag::autoPosition, WindowFlag::centreScreen }, action, + type); } bool isSave = action == LoadSaveAction::save; diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index 568309ab2c..785a576aaa 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -78,6 +78,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->Create( - WindowClass::mainWindow, { 0, 0 }, { ContextGetWidth(), ContextGetHeight() }, WF_STICK_TO_BACK | WF_NO_TITLE_BAR); + WindowClass::mainWindow, { 0, 0 }, { ContextGetWidth(), ContextGetHeight() }, + { WindowFlag::stickToBack, WindowFlag::noTitleBar }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index ea27e11502..dff2aa6485 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -239,7 +239,7 @@ namespace OpenRCT2::Ui::Windows holdDownWidgets = (1uLL << WIDX_MAP_SIZE_SPINNER_Y_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_Y_DOWN) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_DOWN); - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; SetInitialWindowDimensions(); ResetMaxWindowDimensions(); @@ -1251,7 +1251,7 @@ namespace OpenRCT2::Ui::Windows try { auto* windowMgr = GetWindowManager(); - auto* w = windowMgr->FocusOrCreate(WindowClass::map, kWindowSize, WF_10); + auto* w = windowMgr->FocusOrCreate(WindowClass::map, kWindowSize, WindowFlag::higherContrastOnPress); w->selectedTab = 0; w->listInformationType = 0; return w; diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index becef83ef2..b8c0e43cc7 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -1534,7 +1534,8 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::mapgen, kWindowSize, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN); + WindowClass::mapgen, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::autoPosition, WindowFlag::centreScreen }); } static void HeightmapLoadsaveCallback(ModalResult result, const utf8* path) diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index abb80f73e8..41c30aca06 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -129,7 +129,7 @@ namespace OpenRCT2::Ui::Windows { w = windowMgr->Create( WindowClass::mapTooltip, pos, { width, height }, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar }); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 9ffc27f0ac..8a9ff43dce 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -446,7 +446,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WF_NO_AUTO_CLOSE); + WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WindowFlag::noAutoClose); } void WindowMazeConstructionUpdatePressedWidgets() diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index ad5faf1cbe..e30f619153 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -919,7 +919,8 @@ namespace OpenRCT2::Ui::Windows if (window == nullptr) { window = windowMgr->Create( - WindowClass::multiplayer, { 320, 144 }, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION); + WindowClass::multiplayer, { 320, 144 }, + { WindowFlag::higherContrastOnPress, WindowFlag::resizable, WindowFlag::autoPosition }); } return window; diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 51a8a9d7b5..6f3f63ab64 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -136,7 +136,9 @@ namespace OpenRCT2::Ui::Windows else { window = windowMgr->Create( - WindowClass::networkStatus, kWindowSize, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + WindowClass::networkStatus, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::transparent, WindowFlag::centreScreen, + WindowFlag::stickToFront }); } window->setCloseCallBack(onClose); @@ -164,7 +166,8 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->FocusOrCreate( - WindowClass::networkStatus, kWindowSize, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN); + WindowClass::networkStatus, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::transparent, WindowFlag::centreScreen }); char password[33]{}; WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32); diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 0d7cede249..a84522fcf3 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -400,7 +400,7 @@ namespace OpenRCT2::Ui::Windows w->close(); } - w = windowMgr->Create(WindowClass::newCampaign, kWindowSize, 0); + w = windowMgr->Create(WindowClass::newCampaign, kWindowSize, {}); if (w != nullptr) { w->setCampaign(campaignType); diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 1daf11117f..d9dece8636 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -1079,7 +1079,8 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::trackDesignList); windowMgr->CloseByClass(WindowClass::trackDesignPlace); - window = windowMgr->Create(WindowClass::constructRide, kWindowSize, WF_10 | WF_AUTO_POSITION); + window = windowMgr->Create( + WindowClass::constructRide, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::autoPosition }); return window; } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 1a58bb14ef..33a44f35f8 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -580,6 +580,6 @@ namespace OpenRCT2::Ui::Windows WindowBase* NewsOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::recentNews, kWindowSize, 0); + return windowMgr->FocusOrCreate(WindowClass::recentNews, kWindowSize, {}); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 830cc442f0..cfd5dcc105 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -577,7 +577,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->BringToFrontByClass(WindowClass::objectLoadError); if (window == nullptr) { - window = windowMgr->Create(WindowClass::objectLoadError, kWindowSize, 0); + window = windowMgr->Create(WindowClass::objectLoadError, kWindowSize, {}); } static_cast(window)->initialise(path, numMissingObjects, missingObjects); diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 3335dac9e9..982b7401cf 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -2427,6 +2427,6 @@ namespace OpenRCT2::Ui::Windows WindowBase* OptionsOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::options, kWindowSize, WF_CENTRE_SCREEN); + return windowMgr->FocusOrCreate(WindowClass::options, kWindowSize, WindowFlag::centreScreen); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 6d1bde4169..684ae34c24 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -106,8 +106,9 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::loadsaveOverwritePrompt); return windowMgr->Create( - WindowClass::loadsaveOverwritePrompt, kWindowSize, WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, name, - path, action, type, trackDesignPtr); + WindowClass::loadsaveOverwritePrompt, kWindowSize, + { WindowFlag::transparent, WindowFlag::stickToFront, WindowFlag::centreScreen }, name, path, action, type, + trackDesignPtr); } void WindowLoadSaveOverwritePromptInputKey(WindowBase* w, uint32_t keycode) diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index f59b738d39..282d3c16a6 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows void onResizeEntrance() { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; WindowSetResize(*this, { 230, 174 + 9 }, { 230 * 3, (274 + 9) * 3 }); initViewport(); } @@ -644,7 +644,7 @@ namespace OpenRCT2::Ui::Windows ViewportCreate( *this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value()); - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; invalidate(); } } @@ -659,7 +659,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Rating page void onResizeRating() { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; WindowSetResize(*this, { 268, 174 + 9 }, kMaxWindowSize); } @@ -726,7 +726,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Guests page void onResizeGuests() { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; WindowSetResize(*this, { 268, 174 + 9 }, kMaxWindowSize); } @@ -1285,7 +1285,8 @@ namespace OpenRCT2::Ui::Windows static ParkWindow* ParkWindowOpen(uint8_t page) { auto* windowMgr = GetWindowManager(); - auto* wnd = windowMgr->FocusOrCreate(WindowClass::parkInformation, { 230, 174 + 9 }, WF_10); + auto* wnd = windowMgr->FocusOrCreate( + WindowClass::parkInformation, { 230, 174 + 9 }, WindowFlag::higherContrastOnPress); if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE) { wnd->onMouseUp(WIDX_TAB_1 + page); diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 42903d400e..fbbc934fce 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -294,7 +294,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); auto* w = windowMgr->FocusOrCreate( - WindowClass::patrolArea, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); + WindowClass::patrolArea, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, {}); if (w != nullptr) { w->setStaffId(staffId); diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 5386e84af6..05c8393c74 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -235,7 +235,7 @@ namespace OpenRCT2::Ui::Windows { const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()); ViewportCreate(*this, windowPos, width, height, viewportFocus); - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; onPrepareDraw(); UpdateViewport(false); } @@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows if (!scroll || savedViewPos != centreLoc.value()) { - flags |= WF_SCROLLING_TO_LOCATION; + flags |= WindowFlag::scrollingToLocation; savedViewPos = centreLoc.value(); if (!scroll) { @@ -633,7 +633,7 @@ namespace OpenRCT2::Ui::Windows auto* window = static_cast(windowMgr->BringToFrontByNumber(WindowClass::player, id)); if (window == nullptr) { - window = windowMgr->Create(WindowClass::player, { 240, 170 }, WF_RESIZABLE); + window = windowMgr->Create(WindowClass::player, { 240, 170 }, WindowFlag::resizable); } window->init(id); diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp index 17ff7c4436..2dfbca8cd9 100644 --- a/src/openrct2-ui/windows/ProgressWindow.cpp +++ b/src/openrct2-ui/windows/ProgressWindow.cpp @@ -246,7 +246,9 @@ namespace OpenRCT2::Ui::Windows else { window = windowMgr->Create( - WindowClass::progressWindow, kWindowSize, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + WindowClass::progressWindow, kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::transparent, WindowFlag::centreScreen, + WindowFlag::stickToFront }); } window->setCaption(text); diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 39353b6362..3965e914e2 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -103,12 +103,12 @@ namespace OpenRCT2::Ui::Windows windowMgr->Close(*w); newWindow = windowMgr->Create( - WindowClass::demolishRidePrompt, windowPos, kWindowSize, WF_TRANSPARENT); + WindowClass::demolishRidePrompt, windowPos, kWindowSize, WindowFlag::transparent); } else { newWindow = windowMgr->Create( - WindowClass::demolishRidePrompt, kWindowSize, WF_CENTRE_SCREEN | WF_TRANSPARENT); + WindowClass::demolishRidePrompt, kWindowSize, { WindowFlag::centreScreen, WindowFlag::transparent }); } newWindow->SetRide(ride); diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 94acf79701..0ba864208d 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -296,7 +296,8 @@ namespace OpenRCT2::Ui::Windows WindowBase* ResearchOpen() { auto* windowMgr = GetWindowManager(); - auto* window = windowMgr->FocusOrCreate(WindowClass::research, kWindowSizeDevelopment, WF_10); + auto* window = windowMgr->FocusOrCreate( + WindowClass::research, kWindowSizeDevelopment, WindowFlag::higherContrastOnPress); window->setPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); return window; } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index f3dca034b5..975a8f6f8b 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1585,7 +1585,7 @@ namespace OpenRCT2::Ui::Windows ViewportCreate(*this, screenPos, viewWidth, viewHeight, focus.value()); - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; invalidate(); } if (viewport != nullptr) @@ -1707,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows newMinHeight += 15; } - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; WindowSetResize(*this, { kMinimumWindowWidth, newMinHeight }, { 500, 450 }); // Unlike with other windows, the focus needs to be recentred so it’s best to just reset it. focus = std::nullopt; @@ -4998,7 +4998,7 @@ namespace OpenRCT2::Ui::Windows void MusicResize() { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; auto ride = GetRide(rideId); if (ride == nullptr) @@ -6760,7 +6760,7 @@ namespace OpenRCT2::Ui::Windows void CustomerResize() { - flags |= WF_RESIZABLE; + flags |= WindowFlag::resizable; WindowSetResize(*this, { kMinimumWindowWidth, 163 }, { kMinimumWindowWidth, 163 }); } @@ -6940,7 +6940,8 @@ namespace OpenRCT2::Ui::Windows static RideWindow* WindowRideOpen(const Ride& ride) { auto* windowMgr = GetWindowManager(); - return windowMgr->Create(WindowClass::ride, kWindowSize, WF_10 | WF_RESIZABLE, ride); + return windowMgr->Create( + WindowClass::ride, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }, ride); } /** diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 653ede3c0a..95a87a2fc8 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2901,10 +2901,10 @@ namespace OpenRCT2::Ui::Windows return ContextOpenWindowView(WindowView::mazeConstruction); case RideConstructionWindowContext::Default: return windowMgr->Create( - WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WF_NO_AUTO_CLOSE); + WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WindowFlag::noAutoClose); } return windowMgr->Create( - WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WF_NO_AUTO_CLOSE); + WindowClass::rideConstruction, ScreenCoordsXY(0, 29), kWindowSize, WindowFlag::noAutoClose); } static void CloseConstructWindowOnCompletion(const Ride& ride) diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index bca4274caf..867eb6506e 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -1134,7 +1134,8 @@ namespace OpenRCT2::Ui::Windows if (window == nullptr) { window = windowMgr->Create( - WindowClass::rideList, ScreenCoordsXY(32, 32), kWindowSize, WF_10 | WF_RESIZABLE); + WindowClass::rideList, ScreenCoordsXY(32, 32), kWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); } return window; } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 81e3d832b1..413f99ffb2 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -250,6 +250,6 @@ namespace OpenRCT2::Ui::Windows auto savePromptWindow = std::make_unique(prompt_mode); return windowMgr->Create( std::move(savePromptWindow), WindowClass::savePrompt, {}, windowSize, - WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); + { WindowFlag::transparent, WindowFlag::stickToFront, WindowFlag::centreScreen, WindowFlag::autoPosition }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index ce3fc14bc8..d4b0714a4c 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -867,7 +867,7 @@ namespace OpenRCT2::Ui::Windows } window = windowMgr->Create( - WindowClass::scenarioSelect, {}, kWindowSize, WF_AUTO_POSITION | WF_CENTRE_SCREEN, callback); + WindowClass::scenarioSelect, {}, kWindowSize, { WindowFlag::autoPosition, WindowFlag::centreScreen }, callback); return window; } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index a16f71d5ec..702aa0b2f4 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -205,7 +205,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->FindByClass(WindowClass::sceneryScatter); if (window == nullptr) { - window = windowMgr->Create(WindowClass::sceneryScatter, kWindowSize, 0); + window = windowMgr->Create(WindowClass::sceneryScatter, kWindowSize, {}); } return window; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 745aedf921..72c1d20a96 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -540,7 +540,8 @@ namespace OpenRCT2::Ui::Windows return window; window = windowMgr->Create( - WindowClass::serverList, kMinimumWindowSize, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); + WindowClass::serverList, kMinimumWindowSize, + { WindowFlag::higherContrastOnPress, WindowFlag::resizable, WindowFlag::centreScreen }); return window; } diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 4892292a57..8f1781e719 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -275,7 +275,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* ServerStartOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::serverStart, kWindowSize, WF_CENTRE_SCREEN); + return windowMgr->FocusOrCreate(WindowClass::serverStart, kWindowSize, WindowFlag::centreScreen); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 3954c958f4..0243992ed2 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -79,7 +79,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); windowMgr->CloseByClass(WindowClass::changeKeyboardShortcut); auto* w = windowMgr->Create( - WindowClass::changeKeyboardShortcut, kWindowSizeChange, WF_CENTRE_SCREEN); + WindowClass::changeKeyboardShortcut, kWindowSizeChange, WindowFlag::centreScreen); if (w != nullptr) { w->_shortcutId = shortcutId; @@ -554,7 +554,7 @@ namespace OpenRCT2::Ui::Windows auto w = windowMgr->BringToFrontByClass(WindowClass::keyboardShortcutList); if (w == nullptr) { - w = windowMgr->Create(WindowClass::keyboardShortcutList, kWindowSize, WF_RESIZABLE); + w = windowMgr->Create(WindowClass::keyboardShortcutList, kWindowSize, WindowFlag::resizable); } return w; } @@ -615,7 +615,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::resetShortcutKeysPrompt, kWindowSizeReset, WF_CENTRE_SCREEN | WF_TRANSPARENT); + WindowClass::resetShortcutKeysPrompt, kWindowSizeReset, { WindowFlag::centreScreen, WindowFlag::transparent }); } #pragma endregion } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 1778449cc2..d55d08138d 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -337,7 +337,7 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) return w; - w = windowMgr->Create(WindowClass::banner, kWindowSize, 0); + w = windowMgr->Create(WindowClass::banner, kWindowSize, {}); if (w == nullptr) return nullptr; @@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) return w; - w = windowMgr->Create(WindowClass::banner, kWindowSize, 0); + w = windowMgr->Create(WindowClass::banner, kWindowSize, {}); if (w == nullptr) return nullptr; diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 28a133cd12..b8465dc462 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -1156,7 +1156,7 @@ namespace OpenRCT2::Ui::Windows int32_t viewportHeight = viewWidget.height() - 1; ViewportCreate(*this, screenPos, viewportWidth, viewportHeight, focus.value()); - flags |= WF_NO_SCROLLING; + flags |= WindowFlag::noScrolling; invalidate(); } } @@ -1230,7 +1230,8 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) return w; - w = windowMgr->Create(WindowClass::peep, kWindowSize, WF_10 | WF_RESIZABLE); + w = windowMgr->Create( + WindowClass::peep, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); if (w == nullptr) return nullptr; diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 6d2a8aa776..8c3a79eb02 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -96,7 +96,7 @@ namespace OpenRCT2::Ui::Windows // Check if the confirm window already exists auto* windowMgr = GetWindowManager(); auto* window = windowMgr->FocusOrCreate( - WindowClass::firePrompt, kWindowSize, WF_CENTRE_SCREEN | WF_TRANSPARENT); + WindowClass::firePrompt, kWindowSize, { WindowFlag::centreScreen, WindowFlag::transparent }); window->setWindowNumber(peep->Id.ToUnderlying()); return window; } diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index b2aaae4074..713984b508 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -731,7 +731,8 @@ namespace OpenRCT2::Ui::Windows WindowBase* StaffListOpen() { auto* windowMgr = GetWindowManager(); - return windowMgr->FocusOrCreate(WindowClass::staffList, kWindowSize, WF_10 | WF_RESIZABLE); + return windowMgr->FocusOrCreate( + WindowClass::staffList, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); } void WindowStaffListRefresh() diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index a3022c41fa..cddd4dc901 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -373,7 +373,8 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::textinput); auto w = windowMgr->Create( - WindowClass::textinput, { kWindowSize.width, kWindowSize.height + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + WindowClass::textinput, { kWindowSize.width, kWindowSize.height + 10 }, + { WindowFlag::centreScreen, WindowFlag::stickToFront }); if (w != nullptr) { w->setParentWindow(call_w, call_widget); @@ -388,7 +389,8 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); auto w = windowMgr->Create( - WindowClass::textinput, { kWindowSize.width, kWindowSize.height + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + WindowClass::textinput, { kWindowSize.width, kWindowSize.height + 10 }, + { WindowFlag::centreScreen, WindowFlag::stickToFront }); if (w != nullptr) { w->setTitle(title, description); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 4fa1c265a6..3443ca04cb 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -905,7 +905,8 @@ namespace OpenRCT2::Ui::Windows if (window != nullptr) return window; - window = windowMgr->Create(WindowClass::themes, kWindowSize, WF_10 | WF_RESIZABLE); + window = windowMgr->Create( + WindowClass::themes, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable }); return window; } diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index ae6ff017c0..d9321d4e82 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -2454,7 +2454,7 @@ static uint64_t PageDisabledWidgets[] = { WindowBase* window = windowMgr->BringToFrontByClass(WindowClass::tileInspector); if (window == nullptr) window = windowMgr->Create( - WindowClass::tileInspector, ScreenCoordsXY(0, 29), kWindowSize, WF_RESIZABLE); + WindowClass::tileInspector, ScreenCoordsXY(0, 29), kWindowSize, WindowFlag::resizable); return window; } diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index 26d2c6100a..548e39a504 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -59,6 +59,6 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); return windowMgr->Create( WindowClass::titleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), kWindowSize, - WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR); + { WindowFlag::stickToBack, WindowFlag::transparent, WindowFlag::noTitleBar }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index b699360826..e6eb8a3e53 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -71,7 +71,8 @@ namespace OpenRCT2::Ui::Windows if (window == nullptr) { window = windowMgr->Create( - WindowClass::titleLogo, ScreenCoordsXY(0, 0), kWindowSize, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR); + WindowClass::titleLogo, ScreenCoordsXY(0, 0), kWindowSize, + { WindowFlag::stickToBack, WindowFlag::transparent, WindowFlag::noTitleBar }); } return window; } diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index b923c281df..a23fcdeeaf 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -288,6 +288,6 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); return windowMgr->Create( WindowClass::titleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), { 0, windowHeight }, - WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); + { WindowFlag::stickToBack, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index 2254ca7cae..29f8b69703 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -60,7 +60,7 @@ namespace OpenRCT2::Ui::Windows { window = windowMgr->Create( WindowClass::titleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), kWindowSize, - WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR); + { WindowFlag::stickToBack, WindowFlag::transparent, WindowFlag::noTitleBar }); } return window; diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp index 72f897cddb..3f4b0263c0 100644 --- a/src/openrct2-ui/windows/TitleVersion.cpp +++ b/src/openrct2-ui/windows/TitleVersion.cpp @@ -45,7 +45,7 @@ namespace OpenRCT2::Ui::Windows { window = windowMgr->Create( WindowClass::titleVersion, ScreenCoordsXY(kTextOffset, ContextGetHeight() - 30), kWindowSize, - WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_TITLE_BAR); + { WindowFlag::stickToBack, WindowFlag::transparent, WindowFlag::noTitleBar }); } return window; } diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 0a5989b814..de5bfa3052 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); windowMgr->Create( std::move(tooltipWindow), WindowClass::tooltip, windowPos, { width, height }, - WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_NO_TITLE_BAR); + { WindowFlag::transparent, WindowFlag::stickToFront, WindowFlag::noTitleBar }); } void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index fea01635ba..55ec19be53 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -1510,7 +1510,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->Create( WindowClass::topToolbar, ScreenCoordsXY(0, 0), { ContextGetWidth(), kTopToolbarHeight + 1 }, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::noBackground, WindowFlag::noTitleBar }); window->setWidgets(_topToolbarWidgets); diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index e2717f8180..36df5ef85b 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -213,7 +213,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->Create( std::move(trackDesignManageWindow), WindowClass::manageTrackDesign, {}, kWindowSize, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_AUTO_POSITION); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::centreScreen, WindowFlag::autoPosition }); return window; } @@ -231,6 +231,6 @@ namespace OpenRCT2::Ui::Windows windowMgr->Create( std::move(trackDeletePromptWindow), WindowClass::trackDeletePrompt, {}, kWindowSizeDeletePrompt, - WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_AUTO_POSITION | WF_CENTRE_SCREEN); + { WindowFlag::stickToFront, WindowFlag::transparent, WindowFlag::autoPosition, WindowFlag::centreScreen }); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 1114b57241..bad37ef70c 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -755,7 +755,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseConstructionWindows(); - auto* window = windowMgr->FocusOrCreate(WindowClass::trackDesignPlace, kWindowSize, 0); + auto* window = windowMgr->FocusOrCreate(WindowClass::trackDesignPlace, kWindowSize, {}); if (window != nullptr) { window->init(std::move(openTrackDesign)); diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 21776ed6ad..ae5956b428 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -756,11 +756,11 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseConstructionWindows(); - WindowFlags flags = 0; + WindowFlags flags = {}; ScreenCoordsXY screenPos{}; if (gLegacyScene == LegacyScene::trackDesignsManager) { - flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN; + flags = { WindowFlag::autoPosition, WindowFlag::centreScreen }; } else { diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 6797931c19..8dee649d27 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -207,6 +207,6 @@ namespace OpenRCT2::Ui::Windows WindowBase* ViewportOpen() { - return GetWindowManager()->Create(WindowClass::viewport, kWindowSize, WF_RESIZABLE); + return GetWindowManager()->Create(WindowClass::viewport, kWindowSize, WindowFlag::resizable); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 24a09f8052..79313f9f7f 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -429,7 +429,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); return windowMgr->FocusOrCreate( - WindowClass::water, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); + WindowClass::water, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, {}); } /** diff --git a/src/openrct2/core/FlagHolder.hpp b/src/openrct2/core/FlagHolder.hpp index 94fb4ab86c..b8d443c970 100644 --- a/src/openrct2/core/FlagHolder.hpp +++ b/src/openrct2/core/FlagHolder.hpp @@ -50,6 +50,11 @@ struct FlagHolder return (holder & EnumsToFlags(types...)) != 0; } + constexpr bool hasAny(const FlagHolder& other) const + { + return (holder & other.holder) != 0; + } + template [[nodiscard]] constexpr bool hasAll(TTypes... types) const { @@ -97,4 +102,10 @@ struct FlagHolder res.holder |= other.holder; return res; } + + constexpr FlagHolder& operator|=(const FlagHolder& other) noexcept + { + holder |= other.holder; + return *this; + } }; diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 18edd02e86..fe6279e5b3 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -340,7 +340,7 @@ namespace OpenRCT2 // Get next valid window after. auto itNextWindow = [&]() { auto itNext = std::next(itWindowPos); - while (itNext != gWindowList.end() && (itNext->get()->flags & WF_DEAD)) + while (itNext != gWindowList.end() && (itNext->get()->flags.has(WindowFlag::dead))) { ++itNext; } @@ -442,7 +442,7 @@ namespace OpenRCT2 for (; it != gWindowList.end(); it++) { auto w = it->get(); - if (!(w->flags & WF_TRANSPARENT) || (w->flags & WF_DEAD)) + if (!(w->flags.has(WindowFlag::transparent)) || (w->flags.has(WindowFlag::dead))) continue; if (w->viewport == window->viewport) continue; @@ -485,30 +485,6 @@ namespace OpenRCT2 if ((!x_diff) && (!y_diff)) return; - if (w->flags & WF_7) - { - int32_t left = std::max(viewport->pos.x, 0); - int32_t top = std::max(viewport->pos.y, 0); - int32_t right = std::min(viewport->pos.x + viewport->width, ContextGetWidth()); - int32_t bottom = std::min(viewport->pos.y + viewport->height, ContextGetHeight()); - - if (left >= right) - return; - if (top >= bottom) - return; - - if (DrawingEngineHasDirtyOptimisations()) - { - RenderTarget& rt = DrawingEngineGetDpi(); - WindowDrawAll(rt, left, top, right, bottom); - return; - } - else - { - GfxInvalidateScreen(); - } - } - const int32_t left = std::max(viewport->pos.x, 0); const int32_t top = std::max(viewport->pos.y, 0); const int32_t right = std::min(left + viewport->width + std::min(viewport->pos.x, 0), ContextGetWidth()); @@ -620,7 +596,7 @@ namespace OpenRCT2 } auto windowCoords = window->savedViewPos; - if (window->flags & WF_SCROLLING_TO_LOCATION) + if (window->flags.has(WindowFlag::scrollingToLocation)) { // Moves the viewport if focusing in on an item uint8_t flags = 0; @@ -642,7 +618,7 @@ namespace OpenRCT2 // If we are at the final zoom position if (!windowCoords.x && !windowCoords.y) { - window->flags &= ~WF_SCROLLING_TO_LOCATION; + window->flags.unset(WindowFlag::scrollingToLocation); } if (flags & 1) { diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 6cba6c6406..0d42f7ea76 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -85,7 +85,7 @@ static constexpr float kWindowScrollLocations[][2] = { { for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; func(w.get()); } @@ -146,7 +146,7 @@ static constexpr float kWindowScrollLocations[][2] = { for (auto itOther = std::next(it); itOther != itEnd; ++itOther) { const auto& otherWindow = *(*itOther); - if (otherWindow.flags & WF_DEAD) + if (otherWindow.flags.has(WindowFlag::dead)) continue; if (otherWindow.windowPos.x <= window.windowPos.x && otherWindow.windowPos.y <= window.windowPos.y @@ -167,9 +167,10 @@ static constexpr float kWindowScrollLocations[][2] = { */ void WindowUpdateAll() { - // Remove all windows in gWindowList that have the WF_DEAD flag + // Remove all windows in gWindowList that have the WindowFlag::dead flag gWindowList.erase( - std::remove_if(gWindowList.begin(), gWindowList.end(), [](auto&& w) -> bool { return w->flags & WF_DEAD; }), + std::remove_if( + gWindowList.begin(), gWindowList.end(), [](auto&& w) -> bool { return w->flags.has(WindowFlag::dead); }), gWindowList.end()); // Periodic update happens every second so 40 ticks. @@ -182,10 +183,10 @@ static constexpr float kWindowScrollLocations[][2] = { // Border flash invalidation WindowVisitEach([](WindowBase* w) { - if (w->flags & WF_WHITE_BORDER_MASK) + if (w->flashTimer > 0) { - w->flags -= WF_WHITE_BORDER_ONE; - if (!(w->flags & WF_WHITE_BORDER_MASK)) + w->flashTimer--; + if (w->flashTimer == 0) { w->invalidate(); } @@ -244,7 +245,7 @@ static constexpr float kWindowScrollLocations[][2] = { WindowVisitEach([&window](WindowBase* w) { if (w == &window) return; - if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) + if (w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)) return; if (w->windowPos.x >= window.windowPos.x + window.width) return; @@ -277,7 +278,7 @@ static constexpr float kWindowScrollLocations[][2] = { if (&w1 == w2) return; // ? - if (w2->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) + if (w2->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)) return; // Check if w2 intersects with w1 if (w2->windowPos.x > (w1.windowPos.x + w1.width) || w2->windowPos.x + w2->width < w1.windowPos.x) @@ -312,7 +313,7 @@ static constexpr float kWindowScrollLocations[][2] = { { for (auto& w : gWindowList) { - if (w->flags & WF_DEAD) + if (w->flags.has(WindowFlag::dead)) continue; if (w->classification == WindowClass::mainWindow) { @@ -371,7 +372,7 @@ static constexpr float kWindowScrollLocations[][2] = { auto it = WindowGetIterator(&w); for (; it != gWindowList.end(); it++) { - if ((*it)->flags & WF_DEAD) + if ((*it)->flags.has(WindowFlag::dead)) continue; auto w2 = (*it).get(); @@ -403,12 +404,12 @@ static constexpr float kWindowScrollLocations[][2] = { // rct2: 0x006E7C76 if (w.viewportTargetSprite.IsNull()) { - if (!(w.flags & WF_NO_SCROLLING)) + if (!(w.flags.has(WindowFlag::noScrolling))) { w.savedViewPos = screenCoords - ScreenCoordsXY{ static_cast(w.viewport->ViewWidth() * kWindowScrollLocations[i][0]), static_cast(w.viewport->ViewHeight() * kWindowScrollLocations[i][1]) }; - w.flags |= WF_SCROLLING_TO_LOCATION; + w.flags.set(WindowFlag::scrollingToLocation); } } } @@ -496,9 +497,9 @@ static constexpr float kWindowScrollLocations[][2] = { { // Check if this window overlaps w auto topwindow = it->get(); - if (topwindow->flags & WF_TRANSPARENT) + if (topwindow->flags.has(WindowFlag::transparent)) continue; - if (topwindow->flags & WF_DEAD) + if (topwindow->flags.has(WindowFlag::dead)) continue; if (topwindow->windowPos.x >= right || topwindow->windowPos.y >= bottom) continue; @@ -558,9 +559,9 @@ static constexpr float kWindowScrollLocations[][2] = { for (auto it = WindowGetIterator(&w); it != gWindowList.end(); it++) { auto* v = (*it).get(); - if (v->flags & WF_DEAD) + if (v->flags.has(WindowFlag::dead)) continue; - if ((&w == v || (v->flags & WF_TRANSPARENT)) && v->isVisible) + if ((&w == v || (v->flags.has(WindowFlag::transparent))) && v->isVisible) { WindowDrawSingle(rt, *v, left, top, right, bottom); } @@ -857,7 +858,7 @@ static constexpr float kWindowScrollLocations[][2] = { { auto windowRT = rt.Crop({ left, top }, { right - left, bottom - top }); WindowVisitEach([&windowRT, left, top, right, bottom](WindowBase* w) { - if (w->flags & WF_TRANSPARENT) + if (w->flags.has(WindowFlag::transparent)) return; if (right <= w->windowPos.x || bottom <= w->windowPos.y) return; @@ -870,7 +871,7 @@ static constexpr float kWindowScrollLocations[][2] = { void WindowInitAll() { auto* windowMgr = Ui::GetWindowManager(); - windowMgr->CloseAllExceptFlags(0); + windowMgr->CloseAllExceptFlags({}); } void WindowFollowSprite(WindowBase& w, EntityId spriteIndex) diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index ca417cd85a..0415158f67 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -60,39 +60,39 @@ namespace OpenRCT2 struct Viewport; - enum WINDOW_FLAGS + enum class WindowFlag : uint8_t { - /* - WF_TIMEOUT_SHL = 0, - WF_TIMEOUT_MASK = 7, - WF_DRAGGING = 1 << 3, - WF_SCROLLER_UP = 1 << 4, - WF_SCROLLER_DOWN = 1 << 5, - WF_SCROLLER_MIDDLE = 1 << 6, - WF_DISABLE_VP_SCROLL = 1 << 9, - */ - - WF_STICK_TO_BACK = (1 << 0), - WF_STICK_TO_FRONT = (1 << 1), - WF_NO_SCROLLING = (1 << 2), // User is unable to scroll this viewport - WF_SCROLLING_TO_LOCATION = (1 << 3), - WF_TRANSPARENT = (1 << 4), - WF_NO_BACKGROUND = (1 << 5), // Instead of half transparency, completely remove the window background - WF_DEAD = (1u << 6), // Window is closed and will be deleted in the next update. - WF_7 = (1 << 7), - WF_RESIZABLE = (1 << 8), - WF_NO_AUTO_CLOSE = (1 << 9), // Don't auto close this window if too many windows are open - WF_10 = (1 << 10), - WF_WHITE_BORDER_ONE = (1 << 12), - WF_WHITE_BORDER_MASK = (1 << 12) | (1 << 13), - WF_NO_TITLE_BAR = (1 << 14), - WF_NO_SNAPPING = (1 << 15), + stickToBack, + stickToFront, + /** + * User is unable to scroll this viewport + */ + noScrolling, + scrollingToLocation, + transparent, + /** + * Instead of half transparency, completely remove the window background + */ + noBackground, + /** + * Window is closed and will be deleted in the next update. + */ + dead, + resizable, + /** + * Don't auto close this window if too many windows are open + */ + noAutoClose, + // TODO: investigate why exactly this is used. + higherContrastOnPress, + noTitleBar, + noSnapping, // *ONLY* create only flags below - WF_AUTO_POSITION = (1 << 16), - WF_CENTRE_SCREEN = (1 << 17), + autoPosition, + centreScreen, }; - using WindowFlags = uint32_t; + using WindowFlags = FlagHolder; enum class WindowView : uint8_t { diff --git a/src/openrct2/interface/WindowBase.cpp b/src/openrct2/interface/WindowBase.cpp index 9ea2e81d23..7c3e08c20f 100644 --- a/src/openrct2/interface/WindowBase.cpp +++ b/src/openrct2/interface/WindowBase.cpp @@ -11,7 +11,7 @@ namespace OpenRCT2 void WindowBase::setViewportLocation(const CoordsXYZ& coords) { WindowScrollToLocation(*this, coords); - flags &= ~WF_SCROLLING_TO_LOCATION; + flags.unset(WindowFlag::scrollingToLocation); // Immediately update the viewport position since we are not scrolling. if (viewport != nullptr) @@ -151,7 +151,7 @@ namespace OpenRCT2 int16_t WindowBase::getTitleBarCurrentHeight() const { - if (!(flags & WF_NO_TITLE_BAR) && widgets.size() > 2) + if (!(flags.has(WindowFlag::noTitleBar)) && widgets.size() > 2) return widgets[1].height(); else return 0; diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index bd318b90e6..4ea067b3a8 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -33,6 +33,8 @@ struct RCTObjectEntry; namespace OpenRCT2 { + constexpr uint8_t kDefaultWindowFlashCountdown = 3; + // TODO: move to Viewport.h? struct Focus { @@ -89,6 +91,10 @@ namespace OpenRCT2 RideId rideId; }; WindowFlags flags{}; + /** + * Set to 3 when the window should flash and decremented per tick. + */ + uint8_t flashTimer{}; OpenRCT2::ScrollArea scrolls[3]; uint16_t numListItems{}; // 0 for no items int16_t selectedListItem{}; // -1 for none selected @@ -128,7 +134,7 @@ namespace OpenRCT2 constexpr bool canBeResized() const { - return (flags & WF_RESIZABLE) && (minWidth != maxWidth || minHeight != maxHeight); + return flags.has(WindowFlag::resizable) && (minWidth != maxWidth || minHeight != maxHeight); } // Events @@ -221,15 +227,20 @@ namespace OpenRCT2 { } - int16_t right() + constexpr int16_t right() { return windowPos.x + width; } - int16_t bottom() + constexpr int16_t bottom() { return windowPos.y + height; } + + constexpr void flash() + { + flashTimer = kDefaultWindowFlashCountdown; + } }; #ifdef __WARN_SUGGEST_FINAL_METHODS__ diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 8c8adc1eee..e3f89cb3be 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -169,7 +169,7 @@ static void ScenarioEnd() auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseByClass(WindowClass::dropdown); - windowMgr->CloseAllExceptFlags(WF_STICK_TO_BACK | WF_STICK_TO_FRONT); + windowMgr->CloseAllExceptFlags({ WindowFlag::stickToBack, WindowFlag::stickToFront }); ContextOpenWindowView(WindowView::parkObjective); } diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index d46d2eee41..e37e042156 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -124,10 +124,6 @@ namespace OpenRCT2::Ui { return nullptr; } - WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) override - { - return nullptr; - } WindowBase* BringToFrontByNumber(WindowClass cls, WindowNumber number) override { return nullptr; diff --git a/src/openrct2/ui/WindowManager.h b/src/openrct2/ui/WindowManager.h index 5536a25120..1bd9d6f46c 100644 --- a/src/openrct2/ui/WindowManager.h +++ b/src/openrct2/ui/WindowManager.h @@ -51,7 +51,8 @@ namespace OpenRCT2::Ui = 0; template::value>::type* = nullptr> - T* Create(WindowClass cls, const ScreenCoordsXY& pos = {}, ScreenSize size = {}, WindowFlags flags = 0, TArgs&&... args) + T* Create( + WindowClass cls, const ScreenCoordsXY& pos = {}, ScreenSize size = {}, WindowFlags flags = {}, TArgs&&... args) { return static_cast(Create(std::make_unique(std::forward(args)...), cls, pos, size, flags)); } @@ -60,11 +61,11 @@ namespace OpenRCT2::Ui T* Create(WindowClass cls, ScreenSize size, WindowFlags flags, TArgs&&... args) { return static_cast( - Create(std::make_unique(std::forward(args)...), cls, {}, size, flags | WF_AUTO_POSITION)); + Create(std::make_unique(std::forward(args)...), cls, {}, size, flags | WindowFlag::autoPosition)); } template::value>::type* = nullptr> - T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, ScreenSize size, WindowFlags flags = 0) + T* FocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, ScreenSize size, WindowFlags flags = {}) { auto* w = BringToFrontByClass(cls); if (w == nullptr) @@ -75,7 +76,7 @@ namespace OpenRCT2::Ui } template::value>::type* = nullptr> - T* FocusOrCreate(WindowClass cls, ScreenSize size, WindowFlags flags = 0) + T* FocusOrCreate(WindowClass cls, ScreenSize size, WindowFlags flags = {}) { auto* w = BringToFrontByClass(cls); if (w == nullptr) @@ -113,7 +114,6 @@ namespace OpenRCT2::Ui virtual WindowBase* BringToFront(WindowBase& w) = 0; virtual WindowBase* BringToFrontByClass(WindowClass cls) = 0; - virtual WindowBase* BringToFrontByClassWithFlags(WindowClass cls, WindowFlags flags) = 0; virtual WindowBase* BringToFrontByNumber(WindowClass cls, WindowNumber number) = 0; };