From 67fa13f4ace34411943980991c5096f87d24fef8 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Mon, 29 Jul 2024 22:31:57 +0200 Subject: [PATCH] Move window shim definitions into Widget.h (#22412) * Move window shim definitions into Widget.h * Remove unnecessary TileInspectorGlobals.h include from Window.h * Remove Ride.h include from Window.h --- src/openrct2-ui/WindowManager.cpp | 1 + src/openrct2-ui/interface/Widget.h | 10 ++++++++++ src/openrct2-ui/interface/Window.cpp | 1 + src/openrct2-ui/windows/MapGen.cpp | 1 + src/openrct2-ui/windows/Viewport.cpp | 1 + src/openrct2-ui/windows/Window.h | 23 ++++++----------------- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index ec05c08c7f..8ea1874682 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/interface/Widget.h b/src/openrct2-ui/interface/Widget.h index b9ef002a5e..701501f96b 100644 --- a/src/openrct2-ui/interface/Widget.h +++ b/src/openrct2-ui/interface/Widget.h @@ -17,6 +17,16 @@ using namespace OpenRCT2; +// clang-format off +#define WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, CLOSE_STR) \ + { WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, STR_NONE }, \ + { WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \ + { WindowWidgetType::CloseBox, 0, WIDTH - 13, WIDTH - 3, 2, 13, CLOSE_STR, STR_CLOSE_WINDOW_TIP } + +#define WINDOW_SHIM(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X) +#define WINDOW_SHIM_WHITE(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X_WHITE) +// clang-format on + ImageId GetColourButtonImage(colour_t colour); Widget* GetWidgetByIndex(const WindowBase& w, WidgetIndex widgetIndex); diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 452cf4381f..a9df3f57cd 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 82f33c0632..33f40ebd90 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index e467bfff2c..ff8dde70be 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -15,6 +15,7 @@ #include #include #include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/windows/Window.h b/src/openrct2-ui/windows/Window.h index 48d6394636..c0ff2a1d7e 100644 --- a/src/openrct2-ui/windows/Window.h +++ b/src/openrct2-ui/windows/Window.h @@ -11,19 +11,19 @@ #include #include -#include -#include #include -// TODO: only for WINDOW_SHIM_RAW below; we can do better. -#include "../UiStringIds.h" - +struct ObjectEntryDescriptor; struct Peep; +struct Ride; +struct RideSelection; struct TileElement; -struct Vehicle; struct TrackDesign; +struct Vehicle; + enum class GuestListFilterType : int32_t; enum class ScatterToolDensity : uint8_t; + using loadsave_callback = void (*)(int32_t result, const utf8* path); using scenarioselect_callback = void (*)(const utf8* path); @@ -224,15 +224,4 @@ namespace OpenRCT2::Ui::Windows WindowBase* SceneryScatterOpen(); WindowBase* PatrolAreaOpen(EntityId staffId); EntityId WindowPatrolAreaGetCurrentStaffId(); - - // clang-format off -#define WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, CLOSE_STR) \ - { WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, STR_NONE }, \ - { WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \ - { WindowWidgetType::CloseBox, 0, WIDTH - 13, WIDTH - 3, 2, 13, CLOSE_STR, STR_CLOSE_WINDOW_TIP } - -#define WINDOW_SHIM(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X) -#define WINDOW_SHIM_WHITE(TITLE, WIDTH, HEIGHT) WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, STR_CLOSE_X_WHITE) - - // clang-format on } // namespace OpenRCT2::Ui::Windows