mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 07:43:01 +01:00
Create new methods for dropdowns
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <openrct2-ui/UiStringIds.h>
|
#include <openrct2-ui/UiStringIds.h>
|
||||||
#include <openrct2/core/EnumUtils.hpp>
|
#include <openrct2/core/EnumUtils.hpp>
|
||||||
#include <openrct2/interface/Window.h>
|
#include <openrct2/interface/Window.h>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
struct ImageId;
|
struct ImageId;
|
||||||
|
|
||||||
@@ -39,9 +40,15 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
void WindowDropdownShowText(
|
void WindowDropdownShowText(
|
||||||
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items,
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags, size_t num_items,
|
||||||
size_t prefRowsPerColumn = 0);
|
size_t prefRowsPerColumn = 0);
|
||||||
|
void WindowDropdownShowText(
|
||||||
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags,
|
||||||
|
std::span<const Dropdown::Item> items, size_t prefRowsPerColumn = 0);
|
||||||
void WindowDropdownShowTextCustomWidth(
|
void WindowDropdownShowTextCustomWidth(
|
||||||
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
|
||||||
size_t num_items, int32_t width, size_t prefRowsPerColumn = 0);
|
size_t num_items, int32_t width, size_t prefRowsPerColumn = 0);
|
||||||
|
void WindowDropdownShowTextCustomWidth(
|
||||||
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
|
||||||
|
std::span<const Dropdown::Item> items, int32_t width, size_t prefRowsPerColumn = 0);
|
||||||
|
|
||||||
void WindowDropdownShowImage(
|
void WindowDropdownShowImage(
|
||||||
int32_t x, int32_t y, int32_t extray, ColourWithFlags colour, uint8_t flags, int32_t numItems, int32_t itemWidth,
|
int32_t x, int32_t y, int32_t extray, ColourWithFlags colour, uint8_t flags, int32_t numItems, int32_t itemWidth,
|
||||||
|
|||||||
@@ -310,6 +310,14 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void copyItemsToGlobal(std::span<const Dropdown::Item> items)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
|
{
|
||||||
|
gDropdownItems[i] = items[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a text dropdown menu.
|
* Shows a text dropdown menu.
|
||||||
* rct2: 0x006ECFB9
|
* rct2: 0x006ECFB9
|
||||||
@@ -340,6 +348,14 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
screenPos, extray, colour, 0, flags, num_items, max_string_width + 3, prefRowsPerColumn);
|
screenPos, extray, colour, 0, flags, num_items, max_string_width + 3, prefRowsPerColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowDropdownShowText(
|
||||||
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t flags,
|
||||||
|
std::span<const Dropdown::Item> items, size_t prefRowsPerColumn)
|
||||||
|
{
|
||||||
|
copyItemsToGlobal(items);
|
||||||
|
WindowDropdownShowText(screenPos, extray, colour, flags, items.size(), prefRowsPerColumn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a text dropdown menu.
|
* Shows a text dropdown menu.
|
||||||
* rct2: 0x006ECFB9, although 0x006ECE50 is real version
|
* rct2: 0x006ECFB9, although 0x006ECE50 is real version
|
||||||
@@ -373,6 +389,15 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowDropdownShowTextCustomWidth(
|
||||||
|
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t custom_height, uint8_t flags,
|
||||||
|
std::span<const Dropdown::Item> items, int32_t width, size_t prefRowsPerColumn)
|
||||||
|
{
|
||||||
|
copyItemsToGlobal(items);
|
||||||
|
WindowDropdownShowTextCustomWidth(
|
||||||
|
screenPos, extray, colour, custom_height, flags, items.size(), width, prefRowsPerColumn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows an image dropdown menu.
|
* Shows an image dropdown menu.
|
||||||
* rct2: 0x006ECFB9
|
* rct2: 0x006ECFB9
|
||||||
|
|||||||
Reference in New Issue
Block a user