1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 01:04:50 +01:00

Rename WindowWidgetType to WidgetType and change for new code style

This commit is contained in:
Gymnasiast
2025-06-10 19:55:12 +02:00
parent 149468406b
commit 650fa3ae2e
86 changed files with 2114 additions and 2153 deletions

View File

@@ -21,33 +21,33 @@ namespace OpenRCT2
using WidgetIndex = uint16_t;
constexpr WidgetIndex kWidgetIndexNull = 0xFFFF;
enum class WindowWidgetType : uint8_t
enum class WidgetType : uint8_t
{
Empty = 0,
Frame = 1,
Resize = 2,
ImgBtn = 3,
ColourBtn = 6,
TrnBtn = 7,
Tab = 8,
FlatBtn = 9,
Button = 10,
LabelCentred = 12, // Centred text
TableHeader = 13, // Left-aligned textual button
Label = 14, // Left-aligned text
Spinner = 15,
DropdownMenu = 16,
Viewport = 17,
Groupbox = 19,
Caption = 20,
CloseBox = 21,
Scroll = 22,
Checkbox = 23,
Placeholder = 25,
ProgressBar = 29,
Custom = 28,
TextBox = 27,
HorizontalSeparator = 30,
empty = 0,
frame = 1,
resize = 2,
imgBtn = 3,
colourBtn = 6,
trnBtn = 7,
tab = 8,
flatBtn = 9,
button = 10,
labelCentred = 12, // Centred text
tableHeader = 13, // Left-aligned textual button
label = 14, // Left-aligned text
spinner = 15,
dropdownMenu = 16,
viewport = 17,
groupbox = 19,
caption = 20,
closeBox = 21,
scroll = 22,
checkbox = 23,
placeholder = 25,
progressBar = 29,
custom = 28,
textBox = 27,
horizontalSeparator = 30,
};
using WidgetFlags = uint32_t;
@@ -75,7 +75,7 @@ namespace OpenRCT2
struct Widget
{
WindowWidgetType type{};
WidgetType type{};
uint8_t colour{};
int16_t left{};
int16_t right{};

View File

@@ -227,7 +227,7 @@ static constexpr float kWindowScrollLocations[][2] = {
for (i = 0; i < widget_index; i++)
{
const auto& widget = w.widgets[i];
if (widget.type == WindowWidgetType::Scroll)
if (widget.type == WidgetType::scroll)
result++;
}
return result;
@@ -832,7 +832,7 @@ static constexpr float kWindowScrollLocations[][2] = {
mainWind->height = height;
viewport->width = width;
viewport->height = height;
if (!mainWind->widgets.empty() && mainWind->widgets[WC_MAIN_WINDOW__0].type == WindowWidgetType::Viewport)
if (!mainWind->widgets.empty() && mainWind->widgets[WC_MAIN_WINDOW__0].type == WidgetType::viewport)
{
mainWind->widgets[WC_MAIN_WINDOW__0].right = width;
mainWind->widgets[WC_MAIN_WINDOW__0].bottom = height;

View File

@@ -77,7 +77,7 @@ namespace OpenRCT2
// Frame
auto& frameWidget = widgets[0];
if (frameWidget.type == WindowWidgetType::Frame)
if (frameWidget.type == WidgetType::frame)
{
frameWidget.right = width - 1;
frameWidget.bottom = height - 1;
@@ -85,13 +85,13 @@ namespace OpenRCT2
// Title/caption
auto& titleWidget = widgets[1];
bool hasTitleWidget = titleWidget.type == WindowWidgetType::Caption;
bool hasTitleWidget = titleWidget.type == WidgetType::caption;
if (hasTitleWidget)
titleWidget.right = width - 2;
// Close button
auto& closeButton = widgets[2];
if (closeButton.type == WindowWidgetType::CloseBox || closeButton.type == WindowWidgetType::Empty)
if (closeButton.type == WidgetType::closeBox || closeButton.type == WidgetType::empty)
{
bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent);
repositionCloseButton(closeButton, width, translucent);
@@ -101,7 +101,7 @@ namespace OpenRCT2
if (widgets.size() >= 4)
{
auto& pageWidget = widgets[3];
if (pageWidget.type == WindowWidgetType::Resize)
if (pageWidget.type == WidgetType::resize)
{
pageWidget.right = width - 1;
pageWidget.bottom = height - 1;