Refactor Dropdown to TitleCase (#13352)

* Refactor Dropdown Namespace

* Refactor Dropdown to TitleCase
This commit is contained in:
pizza2004 2020-11-03 01:16:06 -07:00 committed by GitHub
parent 1aff58b23e
commit 68bd035f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 294 additions and 292 deletions

View File

@ -1230,10 +1230,10 @@ void InputStateWidgetPressed(
if (w->classification == WC_DROPDOWN)
{
dropdown_index = dropdown_index_from_point(screenCoords, w);
dropdown_index = DropdownIndexFromPoint(screenCoords, w);
dropdownCleanup = dropdown_index == -1
|| (dropdown_index < DROPDOWN_ITEMS_MAX_SIZE && dropdown_is_disabled(dropdown_index))
|| gDropdownItemsFormat[dropdown_index] == DROPDOWN_SEPARATOR;
|| (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
|| gDropdownItemsFormat[dropdown_index] == Dropdown::SeparatorString;
w = nullptr; // To be closed right next
}
else
@ -1281,7 +1281,7 @@ void InputStateWidgetPressed(
if (dropdown_index == -1)
{
if (!dropdown_is_disabled(gDropdownDefaultIndex))
if (!Dropdown::IsDisabled(gDropdownDefaultIndex))
{
dropdown_index = gDropdownDefaultIndex;
}
@ -1346,7 +1346,7 @@ void InputStateWidgetPressed(
if (w->classification == WC_DROPDOWN)
{
int32_t dropdown_index = dropdown_index_from_point(screenCoords, w);
int32_t dropdown_index = DropdownIndexFromPoint(screenCoords, w);
if (dropdown_index == -1)
{
return;
@ -1394,12 +1394,12 @@ void InputStateWidgetPressed(
window_tooltip_show(OpenRCT2String{ colourTooltips[dropdown_index], {} }, screenCoords);
}
if (dropdown_index < DROPDOWN_ITEMS_MAX_SIZE && dropdown_is_disabled(dropdown_index))
if (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
{
return;
}
if (gDropdownItemsFormat[dropdown_index] == DROPDOWN_SEPARATOR)
if (gDropdownItemsFormat[dropdown_index] == Dropdown::SeparatorString)
{
return;
}

View File

@ -13,44 +13,46 @@
#include <openrct2/common.h>
#include <openrct2/localisation/StringIds.h>
constexpr const rct_string_id DROPDOWN_SEPARATOR = 0;
constexpr const rct_string_id DROPDOWN_FORMAT_COLOUR_PICKER = 0xFFFE;
constexpr const rct_string_id DROPDOWN_FORMAT_LAND_PICKER = 0xFFFF;
constexpr const int32_t DROPDOWN_ITEMS_MAX_SIZE = 512;
enum
namespace Dropdown
{
DROPDOWN_FLAG_CUSTOM_HEIGHT = (1 << 6),
DROPDOWN_FLAG_STAY_OPEN = (1 << 7)
};
constexpr const rct_string_id SeparatorString = 0;
constexpr const rct_string_id FormatColourPicker = 0xFFFE;
constexpr const rct_string_id FormatLandPicker = 0xFFFF;
constexpr const int32_t ItemsMaxSize = 512;
enum Flag
{
CustomHeight = (1 << 6),
StayOpen = (1 << 7)
};
bool IsChecked(int32_t index);
bool IsDisabled(int32_t index);
void SetChecked(int32_t index, bool value);
void SetDisabled(int32_t index, bool value);
} // namespace Dropdown
extern int32_t gDropdownNumItems;
extern rct_string_id gDropdownItemsFormat[DROPDOWN_ITEMS_MAX_SIZE];
extern int64_t gDropdownItemsArgs[DROPDOWN_ITEMS_MAX_SIZE];
extern rct_string_id gDropdownItemsFormat[Dropdown::ItemsMaxSize];
extern int64_t gDropdownItemsArgs[Dropdown::ItemsMaxSize];
extern bool gDropdownIsColour;
extern int32_t gDropdownLastColourHover;
extern int32_t gDropdownHighlightedIndex;
extern int32_t gDropdownDefaultIndex;
bool dropdown_is_checked(int32_t index);
bool dropdown_is_disabled(int32_t index);
void dropdown_set_checked(int32_t index, bool value);
void dropdown_set_disabled(int32_t index, bool value);
void window_dropdown_show_text(
const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items);
void window_dropdown_show_text_custom_width(
void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items);
void WindowDropdownShowTextCustomWidth(
const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items,
int32_t width);
void window_dropdown_show_image(
void WindowDropdownShowImage(
int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth,
int32_t itemHeight, int32_t numColumns);
void window_dropdown_close();
int32_t dropdown_index_from_point(const ScreenCoordsXY& loc, rct_window* w);
void window_dropdown_show_colour(rct_window* w, rct_widget* widget, uint8_t dropdownColour, uint8_t selectedColour);
void window_dropdown_show_colour_available(
void WindowDropdownClose();
int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, rct_window* w);
void WindowDropdownShowColour(rct_window* w, rct_widget* widget, uint8_t dropdownColour, uint8_t selectedColour);
void WindowDropdownShowColourAvailable(
rct_window* w, rct_widget* widget, uint8_t dropdownColour, uint8_t selectedColour, uint32_t availableColours);
uint32_t dropdown_get_appropriate_image_dropdown_items_per_row(uint32_t numItems);
uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems);
namespace Dropdown
{
@ -75,7 +77,7 @@ namespace Dropdown
constexpr Item Separator()
{
return Item(-1, DROPDOWN_SEPARATOR, STR_EMPTY);
return Item(-1, Dropdown::SeparatorString, STR_EMPTY);
}
template<int N> void SetItems(const Dropdown::Item (&items)[N])

View File

@ -67,7 +67,7 @@ void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, ui
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_SURFACE, i));
if (surfaceObj != nullptr)
{
gDropdownItemsFormat[itemIndex] = DROPDOWN_FORMAT_LAND_PICKER;
gDropdownItemsFormat[itemIndex] = Dropdown::FormatLandPicker;
gDropdownItemsArgs[itemIndex] = surfaceObj->IconImageId;
if (surfaceObj->Colour != 255)
{
@ -82,9 +82,9 @@ void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, ui
}
uint32_t surfaceCount = itemIndex;
window_dropdown_show_image(
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, surfaceCount, 47, 36,
dropdown_get_appropriate_image_dropdown_items_per_row(surfaceCount));
DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
gDropdownDefaultIndex = defaultIndex;
}
@ -100,7 +100,7 @@ void land_tool_show_edge_style_dropdown(rct_window* w, rct_widget* widget, uint8
const auto edgeObj = static_cast<TerrainEdgeObject*>(objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_EDGE, i));
if (edgeObj != nullptr && edgeObj->NumImagesLoaded > 1)
{
gDropdownItemsFormat[itemIndex] = DROPDOWN_FORMAT_LAND_PICKER;
gDropdownItemsFormat[itemIndex] = Dropdown::FormatLandPicker;
gDropdownItemsArgs[itemIndex] = edgeObj->IconImageId;
if (i == currentEdgeType)
{
@ -110,9 +110,9 @@ void land_tool_show_edge_style_dropdown(rct_window* w, rct_widget* widget, uint8
}
}
uint32_t edgeCount = itemIndex;
auto itemsPerRow = dropdown_get_appropriate_image_dropdown_items_per_row(edgeCount);
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(edgeCount);
window_dropdown_show_image(
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, edgeCount, 47, 36,
itemsPerRow);

View File

@ -511,7 +511,7 @@ namespace OpenRCT2::Ui::Windows
widget--;
auto selectedIndex = widgetDesc->SelectedIndex;
const auto& items = widgetDesc->Items;
const auto numItems = std::min<size_t>(items.size(), DROPDOWN_ITEMS_MAX_SIZE);
const auto numItems = std::min<size_t>(items.size(), Dropdown::ItemsMaxSize);
for (size_t i = 0; i < numItems; i++)
{
gDropdownItemsFormat[i] = selectedIndex == static_cast<int32_t>(i) ? STR_OPTIONS_DROPDOWN_ITEM_SELECTED
@ -519,9 +519,9 @@ namespace OpenRCT2::Ui::Windows
auto sz = items[i].c_str();
std::memcpy(&gDropdownItemsArgs[i], &sz, sizeof(const char*));
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1,
w->colours[widget->colour], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
w->colours[widget->colour], 0, Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
}
else if (widgetDesc->Type == "spinner")
{

View File

@ -200,7 +200,7 @@ static void window_banner_mousedown(rct_window* w, rct_widgetindex widgetIndex,
switch (widgetIndex)
{
case WIDX_MAIN_COLOUR:
window_dropdown_show_colour(w, widget, TRANSLUCENT(w->colours[1]), banner->colour);
WindowDropdownShowColour(w, widget, TRANSLUCENT(w->colours[1]), banner->colour);
break;
case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON:
@ -213,11 +213,11 @@ static void window_banner_mousedown(rct_window* w, rct_widgetindex widgetIndex,
// Switch to the dropdown box widget.
widget--;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ widget->left + w->windowPos.x, widget->top + w->windowPos.y }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 13, widget->width() - 3);
Dropdown::Flag::StayOpen, 13, widget->width() - 3);
dropdown_set_checked(banner->text_colour - 1, true);
Dropdown::SetChecked(banner->text_colour - 1, true);
break;
}
}

View File

@ -635,12 +635,12 @@ static void window_cheats_misc_mousedown(rct_window* w, rct_widgetindex widgetIn
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = WeatherTypes[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, std::size(WeatherTypes), dropdownWidget->width() - 3);
w->colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 3);
auto currentWeather = gClimateCurrent.Weather;
dropdown_set_checked(currentWeather, true);
Dropdown::SetChecked(currentWeather, true);
}
break;
case WIDX_STAFF_SPEED_DROPDOWN_BUTTON:
@ -655,10 +655,10 @@ static void window_cheats_misc_mousedown(rct_window* w, rct_widgetindex widgetIn
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3, dropdownWidget->width() - 3);
dropdown_set_checked(_selectedStaffSpeed, true);
w->colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3);
Dropdown::SetChecked(_selectedStaffSpeed, true);
}
}
}

View File

@ -117,17 +117,17 @@ static void custom_currency_window_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsFormat[1] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[1] = STR_SUFFIX;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 2, widget->width() - 3);
Dropdown::Flag::StayOpen, 2, widget->width() - 3);
if (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
{
dropdown_set_checked(0, true);
Dropdown::SetChecked(0, true);
}
else
{
dropdown_set_checked(1, true);
Dropdown::SetChecked(1, true);
}
break;

View File

@ -43,16 +43,16 @@ static int32_t _dropdown_item_height;
static bool _dropdown_list_vertically;
int32_t gDropdownNumItems;
rct_string_id gDropdownItemsFormat[DROPDOWN_ITEMS_MAX_SIZE];
int64_t gDropdownItemsArgs[DROPDOWN_ITEMS_MAX_SIZE];
static std::bitset<DROPDOWN_ITEMS_MAX_SIZE> _dropdownItemsChecked = {};
static std::bitset<DROPDOWN_ITEMS_MAX_SIZE> _dropdownItemsDisabled = {};
rct_string_id gDropdownItemsFormat[Dropdown::ItemsMaxSize];
int64_t gDropdownItemsArgs[Dropdown::ItemsMaxSize];
static std::bitset<Dropdown::ItemsMaxSize> _dropdownItemsChecked = {};
static std::bitset<Dropdown::ItemsMaxSize> _dropdownItemsDisabled = {};
bool gDropdownIsColour;
int32_t gDropdownLastColourHover;
int32_t gDropdownHighlightedIndex;
int32_t gDropdownDefaultIndex;
bool dropdown_is_checked(int32_t index)
bool Dropdown::IsChecked(int32_t index)
{
if (index < 0 || index >= static_cast<int32_t>(std::size(_dropdownItemsDisabled)))
{
@ -61,7 +61,7 @@ bool dropdown_is_checked(int32_t index)
return _dropdownItemsChecked[index];
}
bool dropdown_is_disabled(int32_t index)
bool Dropdown::IsDisabled(int32_t index)
{
if (index < 0 || index >= static_cast<int32_t>(std::size(_dropdownItemsDisabled)))
{
@ -70,7 +70,7 @@ bool dropdown_is_disabled(int32_t index)
return _dropdownItemsDisabled[index];
}
void dropdown_set_checked(int32_t index, bool value)
void Dropdown::SetChecked(int32_t index, bool value)
{
if (index < 0 || index >= static_cast<int32_t>(std::size(_dropdownItemsDisabled)))
{
@ -79,7 +79,7 @@ void dropdown_set_checked(int32_t index, bool value)
_dropdownItemsChecked[index] = value;
}
void dropdown_set_disabled(int32_t index, bool value)
void Dropdown::SetDisabled(int32_t index, bool value)
{
if (index < 0 || index >= static_cast<int32_t>(std::size(_dropdownItemsDisabled)))
{
@ -108,7 +108,7 @@ static rct_window_event_list window_dropdown_events([](auto& events)
* @param num_items (bx)
* @param colour (al)
*/
void window_dropdown_show_text(const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items)
void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t flags, size_t num_items)
{
int32_t string_width, max_string_width;
char buffer[256];
@ -123,7 +123,7 @@ void window_dropdown_show_text(const ScreenCoordsXY& screenPos, int32_t extray,
max_string_width = std::max(string_width, max_string_width);
}
window_dropdown_show_text_custom_width(screenPos, extray, colour, 0, flags, num_items, max_string_width + 3);
WindowDropdownShowTextCustomWidth(screenPos, extray, colour, 0, flags, num_items, max_string_width + 3);
}
/**
@ -138,21 +138,21 @@ void window_dropdown_show_text(const ScreenCoordsXY& screenPos, int32_t extray,
* @param colour (al)
* @param custom_height (ah) requires flag set as well
*/
void window_dropdown_show_text_custom_width(
void WindowDropdownShowTextCustomWidth(
const ScreenCoordsXY& screenPos, int32_t extray, uint8_t colour, uint8_t custom_height, uint8_t flags, size_t num_items,
int32_t width)
{
rct_window* w;
input_set_flag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
if (flags & DROPDOWN_FLAG_STAY_OPEN)
if (flags & Dropdown::Flag::StayOpen)
input_set_flag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
window_dropdown_close();
WindowDropdownClose();
// Set and calculate num items, rows and columns
_dropdown_item_width = width;
_dropdown_item_height = (flags & DROPDOWN_FLAG_CUSTOM_HEIGHT) ? custom_height : DROPDOWN_ITEM_HEIGHT;
_dropdown_item_height = (flags & Dropdown::Flag::CustomHeight) ? custom_height : DROPDOWN_ITEM_HEIGHT;
gDropdownNumItems = static_cast<int32_t>(num_items);
// There must always be at least one column to prevent dividing by zero
if (gDropdownNumItems == 0)
@ -214,7 +214,7 @@ void window_dropdown_show_text_custom_width(
* @param itemHeight (ah)
* @param numColumns (bl)
*/
void window_dropdown_show_image(
void WindowDropdownShowImage(
int32_t x, int32_t y, int32_t extray, uint8_t colour, uint8_t flags, int32_t numItems, int32_t itemWidth,
int32_t itemHeight, int32_t numColumns)
{
@ -222,11 +222,11 @@ void window_dropdown_show_image(
rct_window* w;
input_set_flag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
if (flags & DROPDOWN_FLAG_STAY_OPEN)
if (flags & Dropdown::Flag::StayOpen)
input_set_flag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
// Close existing dropdown
window_dropdown_close();
WindowDropdownClose();
// Set and calculate num items, rows and columns
_dropdown_item_width = itemWidth;
@ -280,7 +280,7 @@ void window_dropdown_show_image(
input_set_state(InputState::DropdownActive);
}
void window_dropdown_close()
void WindowDropdownClose()
{
window_close_by_class(WC_DROPDOWN);
}
@ -305,7 +305,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
cell_y = i / _dropdown_num_columns;
}
if (gDropdownItemsFormat[i] == DROPDOWN_SEPARATOR)
if (gDropdownItemsFormat[i] == Dropdown::SeparatorString)
{
l = w->windowPos.x + 2 + (cell_x * _dropdown_item_width);
t = w->windowPos.y + 2 + (cell_y * _dropdown_item_height);
@ -338,11 +338,11 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
item = gDropdownItemsFormat[i];
if (item == DROPDOWN_FORMAT_LAND_PICKER || item == DROPDOWN_FORMAT_COLOUR_PICKER)
if (item == Dropdown::FormatLandPicker || item == Dropdown::FormatColourPicker)
{
// Image item
image = static_cast<uint32_t>(gDropdownItemsArgs[i]);
if (item == DROPDOWN_FORMAT_COLOUR_PICKER && highlightedIndex == i)
if (item == Dropdown::FormatColourPicker && highlightedIndex == i)
image++;
gfx_draw_sprite(
@ -353,9 +353,9 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
else
{
// Text item
if (i < DROPDOWN_ITEMS_MAX_SIZE)
if (i < Dropdown::ItemsMaxSize)
{
if (dropdown_is_checked(i))
if (Dropdown::IsChecked(i))
{
item++;
}
@ -365,8 +365,8 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
colour = NOT_TRANSLUCENT(w->colours[0]);
if (i == highlightedIndex)
colour = COLOUR_WHITE;
if (dropdown_is_disabled(i))
if (i < DROPDOWN_ITEMS_MAX_SIZE)
if (Dropdown::IsDisabled(i))
if (i < Dropdown::ItemsMaxSize)
colour = NOT_TRANSLUCENT(w->colours[0]) | COLOUR_FLAG_INSET;
// Draw item string
@ -383,7 +383,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
* New function based on 6e914e
* returns -1 if index is invalid
*/
int32_t dropdown_index_from_point(const ScreenCoordsXY& loc, rct_window* w)
int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, rct_window* w)
{
int32_t top = loc.y - w->windowPos.y - 2;
if (top < 0)
@ -419,7 +419,7 @@ int32_t dropdown_index_from_point(const ScreenCoordsXY& loc, rct_window* w)
/**
* rct2: 0x006ED43D
*/
void window_dropdown_show_colour(rct_window* w, rct_widget* widget, uint8_t dropdownColour, uint8_t selectedColour)
void WindowDropdownShowColour(rct_window* w, rct_widget* widget, uint8_t dropdownColour, uint8_t selectedColour)
{
int32_t defaultIndex = -1;
// Set items
@ -428,21 +428,21 @@ void window_dropdown_show_colour(rct_window* w, rct_widget* widget, uint8_t drop
if (selectedColour == i)
defaultIndex = i;
gDropdownItemsFormat[i] = DROPDOWN_FORMAT_COLOUR_PICKER;
gDropdownItemsFormat[i] = Dropdown::FormatColourPicker;
gDropdownItemsArgs[i] = (i << 32) | (SPRITE_ID_PALETTE_COLOUR_1(i) | SPR_PALETTE_BTN);
}
// Show dropdown
window_dropdown_show_image(
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
DROPDOWN_FLAG_STAY_OPEN, COLOUR_COUNT, 12, 12, _appropriateImageDropdownItemsPerRow[COLOUR_COUNT]);
Dropdown::Flag::StayOpen, COLOUR_COUNT, 12, 12, _appropriateImageDropdownItemsPerRow[COLOUR_COUNT]);
gDropdownIsColour = true;
gDropdownLastColourHover = -1;
gDropdownDefaultIndex = defaultIndex;
}
uint32_t dropdown_get_appropriate_image_dropdown_items_per_row(uint32_t numItems)
uint32_t DropdownGetAppropriateImageDropdownItemsPerRow(uint32_t numItems)
{
return numItems < std::size(_appropriateImageDropdownItemsPerRow) ? _appropriateImageDropdownItemsPerRow[numItems] : 8;
}

View File

@ -592,22 +592,22 @@ void window_editor_object_selection_mousedown(rct_window* w, rct_widgetindex wid
gDropdownItemsArgs[DDIX_FILTER_NONSELECTED] = STR_NON_SELECTED_ONLY;
}
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1,
w->colours[widget->colour], DROPDOWN_FLAG_STAY_OPEN, _numSourceGameItems + numSelectionItems);
w->colours[widget->colour], Dropdown::Flag::StayOpen, _numSourceGameItems + numSelectionItems);
for (int32_t i = 0; i < _numSourceGameItems; i++)
{
if (_filter_flags & (1 << i))
{
dropdown_set_checked(i, true);
Dropdown::SetChecked(i, true);
}
}
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
{
dropdown_set_checked(DDIX_FILTER_SELECTED, _FILTER_SELECTED != 0);
dropdown_set_checked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED != 0);
Dropdown::SetChecked(DDIX_FILTER_SELECTED, _FILTER_SELECTED != 0);
Dropdown::SetChecked(DDIX_FILTER_NONSELECTED, _FILTER_NONSELECTED != 0);
}
break;
}

View File

@ -418,16 +418,16 @@ static void window_editor_objective_options_show_objective_dropdown(rct_window*
}
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, dropdownWidget->width() - 3);
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3);
objectiveType = gScenarioObjective.Type;
for (int32_t j = 0; j < numItems; j++)
{
if (gDropdownItemsArgs[j] - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType)
{
dropdown_set_checked(j, true);
Dropdown::SetChecked(j, true);
break;
}
}
@ -445,10 +445,10 @@ static void window_editor_objective_options_show_category_dropdown(rct_window* w
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = ScenarioCategoryStringIds[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 5, dropdownWidget->width() - 3);
dropdown_set_checked(gS6Info.category, true);
w->colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3);
Dropdown::SetChecked(gS6Info.category, true);
}
static void window_editor_objective_options_arg_1_increase(rct_window* w)

View File

@ -483,10 +483,10 @@ static void window_editor_scenario_options_show_climate_dropdown(rct_window* w)
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = ClimateNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, static_cast<uint8_t>(ClimateType::Count), dropdownWidget->width() - 3);
dropdown_set_checked(static_cast<uint8_t>(gClimate), true);
w->colours[1], 0, Dropdown::Flag::StayOpen, static_cast<uint8_t>(ClimateType::Count), dropdownWidget->width() - 3);
Dropdown::SetChecked(static_cast<uint8_t>(gClimate), true);
}
/**
@ -1174,16 +1174,16 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
gDropdownItemsFormat[2] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[2] = STR_PAID_ENTRY_PAID_RIDES;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3, dropdownWidget->width() - 3);
w->colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 3);
if (gParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES)
dropdown_set_checked(2, true);
Dropdown::SetChecked(2, true);
else if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)
dropdown_set_checked(0, true);
Dropdown::SetChecked(0, true);
else
dropdown_set_checked(1, true);
Dropdown::SetChecked(1, true);
break;
case WIDX_CLIMATE_DROPDOWN:

View File

@ -1200,12 +1200,12 @@ static void window_finances_research_mousedown(rct_window* w, rct_widgetindex wi
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = ResearchFundingLevelNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->width() - 3);
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3);
int32_t currentResearchLevel = gResearchFundingLevel;
dropdown_set_checked(currentResearchLevel, true);
Dropdown::SetChecked(currentResearchLevel, true);
}
/**

View File

@ -670,8 +670,8 @@ static void window_footpath_show_footpath_types_dialog(rct_window* w, rct_widget
numPathTypes++;
}
auto itemsPerRow = dropdown_get_appropriate_image_dropdown_items_per_row(numPathTypes);
window_dropdown_show_image(
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numPathTypes);
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, w->colours[1], 0, numPathTypes, 47,
36, itemsPerRow);
}

View File

@ -429,9 +429,9 @@ static void window_guest_list_mousedown(rct_window* w, rct_widgetindex widgetInd
case WIDX_PAGE_DROPDOWN_BUTTON:
widget = &w->widgets[widgetIndex - 1];
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, _window_guest_list_num_pages, widget->width() - 3);
Dropdown::Flag::StayOpen, _window_guest_list_num_pages, widget->width() - 3);
for (i = 0; i < _window_guest_list_num_pages; i++)
{
@ -440,7 +440,7 @@ static void window_guest_list_mousedown(rct_window* w, rct_widgetindex widgetInd
args[0] = STR_PAGE_X;
args[1] = i + 1;
}
dropdown_set_checked(_window_guest_list_selected_page, true);
Dropdown::SetChecked(_window_guest_list_selected_page, true);
break;
case WIDX_INFO_TYPE_DROPDOWN_BUTTON:
widget = &w->widgets[widgetIndex - 1];
@ -451,11 +451,11 @@ static void window_guest_list_mousedown(rct_window* w, rct_widgetindex widgetInd
gDropdownItemsArgs[i] = viewNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 2, widget->width() - 3);
Dropdown::Flag::StayOpen, 2, widget->width() - 3);
dropdown_set_checked(_window_guest_list_selected_view, true);
Dropdown::SetChecked(_window_guest_list_selected_view, true);
break;
}
}

View File

@ -289,7 +289,7 @@ static void window_multiplayer_groups_show_group_dropdown(rct_window* w, rct_wid
numItems = network_get_num_groups();
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
@ -300,11 +300,11 @@ static void window_multiplayer_groups_show_group_dropdown(rct_window* w, rct_wid
}
if (widget == &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP_DROPDOWN])
{
dropdown_set_checked(network_get_group_index(network_get_default_group()), true);
Dropdown::SetChecked(network_get_group_index(network_get_default_group()), true);
}
else if (widget == &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP_DROPDOWN])
{
dropdown_set_checked(network_get_group_index(_selectedGroup), true);
Dropdown::SetChecked(network_get_group_index(_selectedGroup), true);
}
}

View File

@ -217,7 +217,7 @@ static void window_new_campaign_mousedown(rct_window* w, rct_widgetindex widgetI
if (window_new_campaign_shop_items[0] != 255)
{
int32_t numItems = 0;
for (int32_t i = 0; i < DROPDOWN_ITEMS_MAX_SIZE; i++)
for (int32_t i = 0; i < Dropdown::ItemsMaxSize; i++)
{
if (window_new_campaign_shop_items[i] == 255)
break;
@ -227,9 +227,9 @@ static void window_new_campaign_mousedown(rct_window* w, rct_widgetindex widgetI
numItems++;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems,
dropdownWidget->height() + 1, w->colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->width() - 3);
}
}
@ -257,9 +257,9 @@ static void window_new_campaign_mousedown(rct_window* w, rct_widgetindex widgetI
}
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems,
dropdownWidget->height() + 1, w->colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->width() - 3);
}
break;
@ -412,10 +412,10 @@ void WindowCampaignRefreshRides()
}
// Take top 128 most valuable rides
if (window_new_campaign_rides.size() > DROPDOWN_ITEMS_MAX_SIZE)
if (window_new_campaign_rides.size() > Dropdown::ItemsMaxSize)
{
qsort(window_new_campaign_rides.data(), window_new_campaign_rides.size(), sizeof(ride_id_t), ride_value_compare);
window_new_campaign_rides.resize(DROPDOWN_ITEMS_MAX_SIZE);
window_new_campaign_rides.resize(Dropdown::ItemsMaxSize);
}
// Sort rides by name

View File

@ -681,7 +681,7 @@ static void window_options_display_mousedown(rct_window* w, rct_widgetindex widg
if (selectedResolution != -1 && selectedResolution < 32)
{
dropdown_set_checked(selectedResolution, true);
Dropdown::SetChecked(selectedResolution, true);
}
}
@ -696,7 +696,7 @@ static void window_options_display_mousedown(rct_window* w, rct_widgetindex widg
window_options_show_dropdown(w, widget, 3);
dropdown_set_checked(gConfigGeneral.fullscreen_mode, true);
Dropdown::SetChecked(gConfigGeneral.fullscreen_mode, true);
break;
case WIDX_DRAWING_ENGINE_DROPDOWN:
{
@ -711,7 +711,7 @@ static void window_options_display_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsArgs[i] = DrawingEngineStringIds[i];
}
window_options_show_dropdown(w, widget, numItems);
dropdown_set_checked(EnumValue(gConfigGeneral.drawing_engine), true);
Dropdown::SetChecked(EnumValue(gConfigGeneral.drawing_engine), true);
break;
}
case WIDX_SCALE_UP:
@ -738,7 +738,7 @@ static void window_options_display_mousedown(rct_window* w, rct_widgetindex widg
window_options_show_dropdown(w, widget, 2);
// Note: offset by one to compensate for lack of NN option.
dropdown_set_checked(static_cast<int32_t>(gConfigGeneral.scale_quality) - 1, true);
Dropdown::SetChecked(static_cast<int32_t>(gConfigGeneral.scale_quality) - 1, true);
break;
}
}
@ -1007,7 +1007,7 @@ static void window_options_rendering_mousedown(rct_window* w, rct_widgetindex wi
widget = &w->widgets[widgetIndex - 1];
window_options_show_dropdown(w, widget, 3);
dropdown_set_checked(static_cast<int32_t>(gConfigGeneral.virtual_floor_style), true);
Dropdown::SetChecked(static_cast<int32_t>(gConfigGeneral.virtual_floor_style), true);
break;
}
}
@ -1112,7 +1112,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
window_options_show_dropdown(w, widget, 2);
dropdown_set_checked(gConfigGeneral.show_height_as_units ? 0 : 1, true);
Dropdown::SetChecked(gConfigGeneral.show_height_as_units ? 0 : 1, true);
break;
case WIDX_CURRENCY_DROPDOWN:
{
@ -1125,7 +1125,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsArgs[i] = CurrencyDescriptors[i].stringId;
}
gDropdownItemsFormat[num_ordinary_currencies] = DROPDOWN_SEPARATOR;
gDropdownItemsFormat[num_ordinary_currencies] = Dropdown::SeparatorString;
gDropdownItemsFormat[num_ordinary_currencies + 1] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[num_ordinary_currencies + 1] = CurrencyDescriptors[EnumValue(CurrencyType::Custom)].stringId;
@ -1134,11 +1134,11 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
if (gConfigGeneral.currency_format == CurrencyType::Custom)
{
dropdown_set_checked(EnumValue(gConfigGeneral.currency_format) + 1, true);
Dropdown::SetChecked(EnumValue(gConfigGeneral.currency_format) + 1, true);
}
else
{
dropdown_set_checked(EnumValue(gConfigGeneral.currency_format), true);
Dropdown::SetChecked(EnumValue(gConfigGeneral.currency_format), true);
}
break;
}
@ -1152,7 +1152,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
window_options_show_dropdown(w, widget, 3);
dropdown_set_checked(static_cast<int32_t>(gConfigGeneral.measurement_format), true);
Dropdown::SetChecked(static_cast<int32_t>(gConfigGeneral.measurement_format), true);
break;
case WIDX_TEMPERATURE_DROPDOWN:
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
@ -1162,7 +1162,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
window_options_show_dropdown(w, widget, 2);
dropdown_set_checked(static_cast<int32_t>(gConfigGeneral.temperature_format), true);
Dropdown::SetChecked(static_cast<int32_t>(gConfigGeneral.temperature_format), true);
break;
case WIDX_LANGUAGE_DROPDOWN:
for (size_t i = 1; i < LANGUAGE_COUNT; i++)
@ -1171,7 +1171,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsArgs[i - 1] = reinterpret_cast<uintptr_t>(LanguagesDescriptors[i].native_name);
}
window_options_show_dropdown(w, widget, LANGUAGE_COUNT - 1);
dropdown_set_checked(LocalisationService_GetCurrentLanguage() - 1, true);
Dropdown::SetChecked(LocalisationService_GetCurrentLanguage() - 1, true);
break;
case WIDX_DATE_FORMAT_DROPDOWN:
for (size_t i = 0; i < 4; i++)
@ -1180,7 +1180,7 @@ static void window_options_culture_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsArgs[i] = DateFormatStringIds[i];
}
window_options_show_dropdown(w, widget, 4);
dropdown_set_checked(gConfigGeneral.date_format, true);
Dropdown::SetChecked(gConfigGeneral.date_format, true);
break;
}
}
@ -1399,7 +1399,7 @@ static void window_options_audio_mousedown(rct_window* w, rct_widgetindex widget
window_options_show_dropdown(w, widget, OpenRCT2::Audio::GetDeviceCount());
dropdown_set_checked(OpenRCT2::Audio::GetCurrentDeviceIndex(), true);
Dropdown::SetChecked(OpenRCT2::Audio::GetCurrentDeviceIndex(), true);
break;
case WIDX_TITLE_MUSIC_DROPDOWN:
uint32_t num_items = 4;
@ -1412,7 +1412,7 @@ static void window_options_audio_mousedown(rct_window* w, rct_widgetindex widget
window_options_show_dropdown(w, widget, num_items);
dropdown_set_checked(gConfigSound.title_music, true);
Dropdown::SetChecked(gConfigSound.title_music, true);
break;
}
}
@ -1671,11 +1671,11 @@ static void window_options_controls_mousedown(rct_window* w, rct_widgetindex wid
gDropdownItemsArgs[i] = reinterpret_cast<uintptr_t>(theme_manager_get_available_theme_name(i));
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, num_items, widget->width() - 3);
Dropdown::Flag::StayOpen, num_items, widget->width() - 3);
dropdown_set_checked(static_cast<int32_t>(theme_manager_get_active_available_theme_index()), true);
Dropdown::SetChecked(static_cast<int32_t>(theme_manager_get_active_available_theme_index()), true);
widget_invalidate(w, WIDX_THEMES_DROPDOWN);
break;
}
@ -1797,11 +1797,11 @@ static void window_options_misc_mousedown(rct_window* w, rct_widgetindex widgetI
gDropdownItemsArgs[i] = reinterpret_cast<uintptr_t>(title_sequence_manager_get_name(i));
}
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1],
DROPDOWN_FLAG_STAY_OPEN, num_items);
Dropdown::Flag::StayOpen, num_items);
dropdown_set_checked(static_cast<int32_t>(title_get_current_sequence()), true);
Dropdown::SetChecked(static_cast<int32_t>(title_get_current_sequence()), true);
break;
case WIDX_SCENARIO_GROUPING_DROPDOWN:
num_items = 2;
@ -1811,11 +1811,11 @@ static void window_options_misc_mousedown(rct_window* w, rct_widgetindex widgetI
gDropdownItemsFormat[1] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[1] = STR_OPTIONS_SCENARIO_ORIGIN;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, num_items, widget->width() - 3);
Dropdown::Flag::StayOpen, num_items, widget->width() - 3);
dropdown_set_checked(gConfigGeneral.scenario_select_mode, true);
Dropdown::SetChecked(gConfigGeneral.scenario_select_mode, true);
break;
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN:
for (size_t i = 0; i < 7; i++)
@ -1825,7 +1825,7 @@ static void window_options_misc_mousedown(rct_window* w, rct_widgetindex widgetI
}
window_options_show_dropdown(w, widget, 7);
dropdown_set_checked(gConfigGeneral.default_inspection_interval, true);
Dropdown::SetChecked(gConfigGeneral.default_inspection_interval, true);
break;
}
}
@ -2036,7 +2036,7 @@ static void window_options_advanced_mousedown(rct_window* w, rct_widgetindex wid
}
window_options_show_dropdown(w, widget, AUTOSAVE_NEVER + 1);
dropdown_set_checked(gConfigGeneral.autosave_frequency, true);
Dropdown::SetChecked(gConfigGeneral.autosave_frequency, true);
break;
case WIDX_AUTOSAVE_AMOUNT_UP:
gConfigGeneral.autosave_amount += 1;
@ -2317,9 +2317,9 @@ static void window_options_draw_tab_images(rct_drawpixelinfo* dpi, rct_window* w
// helper function, all dropdown boxes have similar properties
static void window_options_show_dropdown(rct_window* w, rct_widget* widget, int32_t num_items)
{
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, num_items, widget->width() - 3);
Dropdown::Flag::StayOpen, num_items, widget->width() - 3);
}
static void window_options_update_height_markers()

View File

@ -551,18 +551,18 @@ static void window_park_entrance_mousedown(rct_window* w, rct_widgetindex widget
gDropdownItemsFormat[1] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[0] = STR_CLOSE_PARK;
gDropdownItemsArgs[1] = STR_OPEN_PARK;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, 2);
if (park_is_open())
{
gDropdownDefaultIndex = 0;
dropdown_set_checked(1, true);
Dropdown::SetChecked(1, true);
}
else
{
gDropdownDefaultIndex = 1;
dropdown_set_checked(0, true);
Dropdown::SetChecked(0, true);
}
}
}

View File

@ -198,7 +198,7 @@ static void window_player_overview_show_group_dropdown(rct_window* w, rct_widget
numItems = network_get_num_groups();
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
@ -208,7 +208,7 @@ static void window_player_overview_show_group_dropdown(rct_window* w, rct_widget
gDropdownItemsArgs[i] = reinterpret_cast<uintptr_t>(network_get_group_name(i));
}
dropdown_set_checked(network_get_group_index(network_get_player_group(player)), true);
Dropdown::SetChecked(network_get_group_index(network_get_player_group(player)), true);
}
void window_player_overview_close(rct_window* w)

View File

@ -464,12 +464,12 @@ static void window_research_funding_mousedown(rct_window* w, rct_widgetindex wid
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = ResearchFundingLevelNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->width() - 3);
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 3);
int32_t currentResearchLevel = gResearchFundingLevel;
dropdown_set_checked(currentResearchLevel, true);
Dropdown::SetChecked(currentResearchLevel, true);
}
/**

View File

@ -1865,7 +1865,7 @@ static void window_ride_show_view_dropdown(rct_window* w, rct_widget* widget)
numItems += ride->num_vehicles;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
@ -1898,13 +1898,13 @@ static void window_ride_show_view_dropdown(rct_window* w, rct_widget* widget)
for (int32_t i = 0; i < ride->num_vehicles; i++)
{
// The +1 is to skip 'Overall view'
dropdown_set_disabled(i + 1, true);
Dropdown::SetDisabled(i + 1, true);
;
}
}
// Set checked item
dropdown_set_checked(w->ride.view, true);
Dropdown::SetChecked(w->ride.view, true);
}
static uint8_t window_ride_get_next_default_status(const Ride* ride)
@ -1980,9 +1980,9 @@ static void window_ride_show_open_dropdown(rct_window* w, rct_widget* widget)
#endif
window_ride_set_dropdown(info, RIDE_STATUS_TESTING, STR_TEST_RIDE);
window_ride_set_dropdown(info, RIDE_STATUS_OPEN, STR_OPEN_RIDE);
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, info.NumItems);
dropdown_set_checked(info.CheckedIndex, true);
Dropdown::SetChecked(info.CheckedIndex, true);
gDropdownDefaultIndex = info.DefaultIndex;
}
@ -2050,9 +2050,9 @@ static void window_ride_show_ride_type_dropdown(rct_window* w, rct_widget* widge
}
rct_widget* dropdownWidget = widget - 1;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], DROPDOWN_FLAG_STAY_OPEN, RIDE_TYPE_COUNT);
w->colours[1], Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
// Find the current ride type in the ordered list.
uint8_t pos = 0;
@ -2067,7 +2067,7 @@ static void window_ride_show_ride_type_dropdown(rct_window* w, rct_widget* widge
gDropdownHighlightedIndex = pos;
gDropdownDefaultIndex = pos;
dropdown_set_checked(pos, true);
Dropdown::SetChecked(pos, true);
}
static void populate_vehicle_type_dropdown(Ride* ride)
@ -2140,7 +2140,7 @@ static void window_ride_show_vehicle_type_dropdown(rct_window* w, rct_widget* wi
populate_vehicle_type_dropdown(ride);
size_t numItems = std::min<size_t>(VehicleDropdownData.size(), DROPDOWN_ITEMS_MAX_SIZE);
size_t numItems = std::min<size_t>(VehicleDropdownData.size(), Dropdown::ItemsMaxSize);
for (size_t i = 0; i < numItems; i++)
{
@ -2149,9 +2149,9 @@ static void window_ride_show_vehicle_type_dropdown(rct_window* w, rct_widget* wi
}
rct_widget* dropdownWidget = widget - 1;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
// Find the current vehicle type in the ordered list.
uint8_t pos = 0;
@ -2166,7 +2166,7 @@ static void window_ride_show_vehicle_type_dropdown(rct_window* w, rct_widget* wi
gDropdownHighlightedIndex = pos;
gDropdownDefaultIndex = pos;
dropdown_set_checked(pos, true);
Dropdown::SetChecked(pos, true);
}
/**
@ -3170,13 +3170,13 @@ static void window_ride_mode_dropdown(rct_window* w, rct_widget* widget)
}
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numAvailableModes, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
if (checkedIndex != -1)
{
dropdown_set_checked(checkedIndex, true);
Dropdown::SetChecked(checkedIndex, true);
}
}
@ -3196,11 +3196,11 @@ static void window_ride_load_dropdown(rct_window* w, rct_widget* widget)
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = VehicleLoadNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 5, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
dropdown_set_checked(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK, true);
Dropdown::SetChecked(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK, true);
}
/**
@ -3805,11 +3805,11 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = RideInspectionIntervalNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 7, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, 7, widget->right - dropdownWidget->left);
dropdown_set_checked(ride->inspection_interval, true);
Dropdown::SetChecked(ride->inspection_interval, true);
break;
case WIDX_FORCE_BREAKDOWN:
@ -3842,9 +3842,9 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
}
else
{
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, w->colours[1], DROPDOWN_FLAG_STAY_OPEN, num_items);
dropdownWidget->height() + 1, w->colours[1], Dropdown::Flag::StayOpen, num_items);
num_items = 1;
int32_t breakdownReason = ride->breakdown_reason_pending;
@ -3861,7 +3861,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
}
if (i == breakdownReason)
{
dropdown_set_checked(num_items, true);
Dropdown::SetChecked(num_items, true);
break;
}
gDropdownItemsFormat[num_items] = STR_DROPDOWN_MENU_LABEL;
@ -3873,7 +3873,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING) == 0)
{
dropdown_set_disabled(0, true);
Dropdown::SetDisabled(0, true);
}
}
break;
@ -4310,20 +4310,20 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
gDropdownItemsArgs[i] = ColourSchemeNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, widget->right - dropdownWidget->left);
dropdown_set_checked(colourSchemeIndex, true);
Dropdown::SetChecked(colourSchemeIndex, true);
break;
case WIDX_TRACK_MAIN_COLOUR:
window_dropdown_show_colour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].main);
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].main);
break;
case WIDX_TRACK_ADDITIONAL_COLOUR:
window_dropdown_show_colour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].additional);
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].additional);
break;
case WIDX_TRACK_SUPPORT_COLOUR:
window_dropdown_show_colour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].supports);
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].supports);
break;
case WIDX_MAZE_STYLE_DROPDOWN:
for (i = 0; i < 4; i++)
@ -4332,11 +4332,11 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
gDropdownItemsArgs[i] = MazeOptions[i].text;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, widget->right - dropdownWidget->left);
dropdown_set_checked(ride->track_colour[colourSchemeIndex].supports, true);
Dropdown::SetChecked(ride->track_colour[colourSchemeIndex].supports, true);
break;
case WIDX_ENTRANCE_STYLE_DROPDOWN:
{
@ -4357,9 +4357,9 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
}
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, ddIndex, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, ddIndex, widget->right - dropdownWidget->left);
break;
}
case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN:
@ -4371,12 +4371,12 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
| VehicleColourSchemeNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, rideEntry->max_cars_in_train > 1 ? 3 : 2,
w->colours[1], 0, Dropdown::Flag::StayOpen, rideEntry->max_cars_in_train > 1 ? 3 : 2,
widget->right - dropdownWidget->left);
dropdown_set_checked(ride->colour_scheme_type & 3, true);
Dropdown::SetChecked(ride->colour_scheme_type & 3, true);
break;
case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN:
numItems = ride->num_vehicles;
@ -4385,7 +4385,7 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
stringId = (ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_TRAIN ? STR_RIDE_COLOUR_TRAIN_OPTION
: STR_RIDE_COLOUR_VEHICLE_OPTION;
for (i = 0; i < std::min(numItems, DROPDOWN_ITEMS_MAX_SIZE); i++)
for (i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++)
{
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = (static_cast<int64_t>(i + 1) << 32)
@ -4393,23 +4393,23 @@ static void window_ride_colour_mousedown(rct_window* w, rct_widgetindex widgetIn
| stringId;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
dropdown_set_checked(w->vehicleIndex, true);
Dropdown::SetChecked(w->vehicleIndex, true);
break;
case WIDX_VEHICLE_MAIN_COLOUR:
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
window_dropdown_show_colour(w, widget, w->colours[1], vehicleColour.main);
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.main);
break;
case WIDX_VEHICLE_ADDITIONAL_COLOUR_1:
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
window_dropdown_show_colour(w, widget, w->colours[1], vehicleColour.additional_1);
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.additional_1);
break;
case WIDX_VEHICLE_ADDITIONAL_COLOUR_2:
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
window_dropdown_show_colour(w, widget, w->colours[1], vehicleColour.additional_2);
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.additional_2);
break;
}
}
@ -5037,15 +5037,15 @@ static void window_ride_music_mousedown(rct_window* w, rct_widgetindex widgetInd
gDropdownItemsArgs[i] = MusicStyleNames[window_ride_current_music_style_order[i]];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left);
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
for (auto i = 0; i < numItems; i++)
{
if (window_ride_current_music_style_order[i] == ride->music)
{
dropdown_set_checked(i, true);
Dropdown::SetChecked(i, true);
}
}
}
@ -5337,18 +5337,18 @@ static void window_ride_measurements_mousedown(rct_window* w, rct_widgetindex wi
gDropdownItemsFormat[0] = STR_SAVE_TRACK_DESIGN_ITEM;
gDropdownItemsFormat[1] = STR_SAVE_TRACK_DESIGN_WITH_SCENERY_ITEM;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1],
DROPDOWN_FLAG_STAY_OPEN, 2);
Dropdown::Flag::StayOpen, 2);
gDropdownDefaultIndex = 0;
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
{
dropdown_set_disabled(1, true);
Dropdown::SetDisabled(1, true);
}
else if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_TRACK))
{
// Disable saving without scenery if we're a flat ride
dropdown_set_disabled(0, true);
Dropdown::SetDisabled(0, true);
gDropdownDefaultIndex = 1;
}
}

View File

@ -3362,7 +3362,7 @@ static void window_ride_construction_show_special_track_dropdown(rct_window* w,
}
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, 0,
_numCurrentPossibleRideConfigurations, widget->width());
@ -3370,7 +3370,7 @@ static void window_ride_construction_show_special_track_dropdown(rct_window* w,
{
if (_currentDisabledSpecialTrackPieces & (1 << i))
{
dropdown_set_disabled(i, true);
Dropdown::SetDisabled(i, true);
}
}
gDropdownDefaultIndex = defaultIndex;

View File

@ -305,7 +305,7 @@ static void window_ride_list_mousedown(rct_window* w, rct_widgetindex widgetInde
{
gDropdownItemsFormat[0] = STR_CLOSE_ALL;
gDropdownItemsFormat[1] = STR_OPEN_ALL;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height(), w->colours[1], 0, 2);
}
else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN)
@ -340,12 +340,12 @@ static void window_ride_list_mousedown(rct_window* w, rct_widgetindex widgetInde
numItems++;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height(), w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
if (selectedIndex != -1)
{
dropdown_set_checked(selectedIndex, true);
Dropdown::SetChecked(selectedIndex, true);
}
}
}

View File

@ -679,13 +679,13 @@ static void window_scenery_mousedown(rct_window* w, rct_widgetindex widgetIndex,
switch (widgetIndex)
{
case WIDX_SCENERY_PRIMARY_COLOUR_BUTTON:
window_dropdown_show_colour(w, widget, w->colours[1], gWindowSceneryPrimaryColour);
WindowDropdownShowColour(w, widget, w->colours[1], gWindowSceneryPrimaryColour);
break;
case WIDX_SCENERY_SECONDARY_COLOUR_BUTTON:
window_dropdown_show_colour(w, widget, w->colours[1], gWindowScenerySecondaryColour);
WindowDropdownShowColour(w, widget, w->colours[1], gWindowScenerySecondaryColour);
break;
case WIDX_SCENERY_TERTIARY_COLOUR_BUTTON:
window_dropdown_show_colour(w, widget, w->colours[1], gWindowSceneryTertiaryColour);
WindowDropdownShowColour(w, widget, w->colours[1], gWindowSceneryTertiaryColour);
break;
}

View File

@ -273,7 +273,7 @@ static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollInd
}
auto dropdownPos = ScreenCoordsXY{ w->windowPos.x + listWidget->left + screenCoords.x + 2 - w->scrolls[0].h_left,
w->windowPos.y + listWidget->top + screenCoords.y + 2 - w->scrolls[0].v_top };
window_dropdown_show_text(dropdownPos, 0, COLOUR_GREY, 0, 2);
WindowDropdownShowText(dropdownPos, 0, COLOUR_GREY, 0, 2);
}
}

View File

@ -220,10 +220,10 @@ static void window_sign_mousedown(rct_window* w, rct_widgetindex widgetIndex, rc
switch (widgetIndex)
{
case WIDX_MAIN_COLOUR:
window_dropdown_show_colour(w, widget, TRANSLUCENT(w->colours[1]), static_cast<uint8_t>(w->list_information_type));
WindowDropdownShowColour(w, widget, TRANSLUCENT(w->colours[1]), static_cast<uint8_t>(w->list_information_type));
break;
case WIDX_TEXT_COLOUR:
window_dropdown_show_colour(w, widget, TRANSLUCENT(w->colours[1]), static_cast<uint8_t>(w->var_492));
WindowDropdownShowColour(w, widget, TRANSLUCENT(w->colours[1]), static_cast<uint8_t>(w->var_492));
break;
}
}

View File

@ -520,7 +520,7 @@ void window_staff_overview_mousedown(rct_window* w, rct_widgetindex widgetIndex,
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
int32_t extray = widget->height() + 1;
window_dropdown_show_text(dropdownPos, extray, w->colours[1], 0, 2);
WindowDropdownShowText(dropdownPos, extray, w->colours[1], 0, 2);
gDropdownDefaultIndex = 0;
const auto peep = GetStaff(w);
@ -532,7 +532,7 @@ void window_staff_overview_mousedown(rct_window* w, rct_widgetindex widgetIndex,
// Disable clear patrol area if no area is set.
if (gStaffModes[peep->StaffId] != StaffMode::Patrol)
{
dropdown_set_disabled(1, true);
Dropdown::SetDisabled(1, true);
}
}
@ -1440,12 +1440,12 @@ void window_staff_options_mousedown(rct_window* w, rct_widgetindex widgetIndex,
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
int32_t extray = widget->height() + 1;
int32_t width = widget->width() - 3;
window_dropdown_show_text_custom_width(dropdownPos, extray, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numCostumes, width);
WindowDropdownShowTextCustomWidth(dropdownPos, extray, w->colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, width);
// See above note.
if (checkedIndex != -1)
{
dropdown_set_checked(checkedIndex, true);
Dropdown::SetChecked(checkedIndex, true);
}
}

View File

@ -288,7 +288,7 @@ static void window_staff_list_mousedown(rct_window* w, rct_widgetindex widgetInd
window_staff_list_cancel_tools(w);
break;
case WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER:
window_dropdown_show_colour(
WindowDropdownShowColour(
w, widget, w->colours[1], staff_get_colour(static_cast<StaffType>(_windowStaffListSelectedTab)));
break;
}

View File

@ -511,11 +511,11 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex,
gDropdownItemsArgs[i] = reinterpret_cast<uintptr_t>(theme_manager_get_available_theme_name(i));
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, num_items, widget->width() - 3);
Dropdown::Flag::StayOpen, num_items, widget->width() - 3);
dropdown_set_checked(static_cast<int32_t>(theme_manager_get_active_available_theme_index()), true);
Dropdown::SetChecked(static_cast<int32_t>(theme_manager_get_active_available_theme_index()), true);
break;
case WIDX_THEMES_RCT1_RIDE_LIGHTS:
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
@ -656,7 +656,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr
+ 12;
uint8_t colour = theme_get_colour(wc, _colour_index_2);
window_dropdown_show_colour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour);
WindowDropdownShowColour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour);
widget_invalidate(w, WIDX_THEMES_LIST);
}
}

View File

@ -1092,13 +1092,13 @@ static void window_tile_inspector_mousedown(rct_window* w, rct_widgetindex widge
gDropdownItemsArgs[0] = STR_TILE_INSPECTOR_WALL_FLAT;
gDropdownItemsArgs[1] = STR_TILE_INSPECTOR_WALL_SLOPED_LEFT;
gDropdownItemsArgs[2] = STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 3, widget->width() - 3);
Dropdown::Flag::StayOpen, 3, widget->width() - 3);
// Set current value as checked
TileElement* const tileElement = window_tile_inspector_get_selected_element(w);
dropdown_set_checked(tileElement->AsWall()->GetSlope(), true);
Dropdown::SetChecked(tileElement->AsWall()->GetSlope(), true);
break;
}
case WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE:

View File

@ -361,11 +361,11 @@ static void window_title_command_editor_mousedown(rct_window* w, rct_widgetindex
gDropdownItemsArgs[i] = _window_title_command_editor_orders[i].nameStringId;
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
dropdown_set_checked(get_command_info_index(command.Type), true);
Dropdown::SetChecked(get_command_info_index(command.Type), true);
break;
}
case WIDX_INPUT_DROPDOWN:
@ -378,11 +378,11 @@ static void window_title_command_editor_mousedown(rct_window* w, rct_widgetindex
gDropdownItemsArgs[i] = SpeedNames[i];
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
dropdown_set_checked(command.Speed - 1, true);
Dropdown::SetChecked(command.Speed - 1, true);
}
else if (command.Type == TITLE_SCRIPT_LOAD)
{
@ -393,11 +393,11 @@ static void window_title_command_editor_mousedown(rct_window* w, rct_widgetindex
gDropdownItemsArgs[i] = reinterpret_cast<uintptr_t>(_sequence->Saves[i].c_str());
}
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
dropdown_set_checked(command.SaveIndex, true);
Dropdown::SetChecked(command.SaveIndex, true);
}
break;
}

View File

@ -532,10 +532,10 @@ static void window_title_editor_mousedown(rct_window* w, rct_widgetindex widgetI
}
widget--;
window_dropdown_show_text_custom_width(
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
dropdown_set_checked(static_cast<int32_t>(_selectedTitleSequence), true);
Dropdown::Flag::StayOpen, numItems, widget->width() - 3);
Dropdown::SetChecked(static_cast<int32_t>(_selectedTitleSequence), true);
}
break;
}

View File

@ -177,9 +177,9 @@ static void window_title_menu_mousedown(rct_window* w, rct_widgetindex widgetInd
gDropdownItemsFormat[2] = STR_ROLLER_COASTER_DESIGNER;
gDropdownItemsFormat[3] = STR_TRACK_DESIGNS_MANAGER;
gDropdownItemsFormat[4] = STR_OPEN_USER_CONTENT_FOLDER;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, TRANSLUCENT(w->colours[0]),
DROPDOWN_FLAG_STAY_OPEN, 5);
Dropdown::Flag::StayOpen, 5);
}
}

View File

@ -481,9 +481,9 @@ static void window_top_toolbar_mousedown(rct_window* w, rct_widgetindex widgetIn
numItems += 2;
}
}
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80,
DROPDOWN_FLAG_STAY_OPEN, numItems);
Dropdown::Flag::StayOpen, numItems);
break;
case WIDX_CHEATS:
top_toolbar_init_cheats_menu(w, widget);
@ -3300,7 +3300,7 @@ static void top_toolbar_init_map_menu(rct_window* w, rct_widget* widget)
}
#endif
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1] | 0x80, 0, i);
gDropdownDefaultIndex = DDIDX_SHOW_MAP;
}
@ -3361,18 +3361,18 @@ static void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget)
gDropdownItemsArgs[2] = STR_SPEED_FAST;
gDropdownItemsArgs[3] = STR_SPEED_TURBO;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80, 0,
num_items);
// Set checkmarks
if (gGameSpeed <= 4)
{
dropdown_set_checked(gGameSpeed - 1, true);
Dropdown::SetChecked(gGameSpeed - 1, true);
}
if (gGameSpeed == 8)
{
dropdown_set_checked(5, true);
Dropdown::SetChecked(5, true);
}
if (gConfigGeneral.debugging_tools)
@ -3409,7 +3409,7 @@ static void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget)
gDropdownItemsFormat[0] = STR_ROTATE_CLOCKWISE;
gDropdownItemsFormat[1] = STR_ROTATE_ANTI_CLOCKWISE;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1] | 0x80, 0, 2);
gDropdownDefaultIndex = DDIDX_ROTATE_CLOCKWISE;
@ -3453,37 +3453,37 @@ static void top_toolbar_init_cheats_menu(rct_window* w, rct_widget* widget)
SetItems(items);
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80, 0,
TOP_TOOLBAR_CHEATS_COUNT);
// Disable items that are not yet available in multiplayer
if (network_get_mode() != NETWORK_MODE_NONE)
{
dropdown_set_disabled(DDIDX_OBJECT_SELECTION, true);
dropdown_set_disabled(DDIDX_INVENTIONS_LIST, true);
Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true);
Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true);
}
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
{
dropdown_set_disabled(DDIDX_OBJECT_SELECTION, true);
dropdown_set_disabled(DDIDX_INVENTIONS_LIST, true);
dropdown_set_disabled(DDIDX_SCENARIO_OPTIONS, true);
dropdown_set_disabled(DDIDX_OBJECTIVE_OPTIONS, true);
dropdown_set_disabled(DDIDX_ENABLE_SANDBOX_MODE, true);
Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true);
Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true);
Dropdown::SetDisabled(DDIDX_SCENARIO_OPTIONS, true);
Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true);
Dropdown::SetDisabled(DDIDX_ENABLE_SANDBOX_MODE, true);
}
if (gCheatsSandboxMode)
{
dropdown_set_checked(DDIDX_ENABLE_SANDBOX_MODE, true);
Dropdown::SetChecked(DDIDX_ENABLE_SANDBOX_MODE, true);
}
if (gCheatsDisableClearanceChecks)
{
dropdown_set_checked(DDIDX_DISABLE_CLEARANCE_CHECKS, true);
Dropdown::SetChecked(DDIDX_DISABLE_CLEARANCE_CHECKS, true);
}
if (gCheatsDisableSupportLimits)
{
dropdown_set_checked(DDIDX_DISABLE_SUPPORT_LIMITS, true);
Dropdown::SetChecked(DDIDX_DISABLE_SUPPORT_LIMITS, true);
}
gDropdownDefaultIndex = DDIDX_CHEATS;
@ -3531,11 +3531,11 @@ static void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget)
gDropdownItemsFormat[DDIDX_DEBUG_PAINT] = STR_TOGGLE_OPTION;
gDropdownItemsArgs[DDIDX_DEBUG_PAINT] = STR_DEBUG_DROPDOWN_DEBUG_PAINT;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80,
DROPDOWN_FLAG_STAY_OPEN, TOP_TOOLBAR_DEBUG_COUNT);
Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT);
dropdown_set_checked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != nullptr);
Dropdown::SetChecked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != nullptr);
}
static void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
@ -3544,11 +3544,11 @@ static void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
gDropdownItemsFormat[DDIDX_NETWORK] = STR_NETWORK;
gDropdownItemsFormat[DDIDX_MULTIPLAYER_RECONNECT] = STR_MULTIPLAYER_RECONNECT;
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80, 0,
TOP_TOOLBAR_NETWORK_COUNT);
dropdown_set_disabled(DDIDX_MULTIPLAYER_RECONNECT, !network_is_desynchronised());
Dropdown::SetDisabled(DDIDX_MULTIPLAYER_RECONNECT, !network_is_desynchronised());
gDropdownDefaultIndex = DDIDX_MULTIPLAYER;
}
@ -3630,38 +3630,38 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget)
SetItems(items);
window_dropdown_show_text(
WindowDropdownShowText(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1] | 0x80, 0,
TOP_TOOLBAR_VIEW_MENU_COUNT);
// Set checkmarks
rct_viewport* mainViewport = window_get_main()->viewport;
if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
dropdown_set_checked(0, true);
Dropdown::SetChecked(0, true);
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE)
dropdown_set_checked(1, true);
Dropdown::SetChecked(1, true);
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL)
dropdown_set_checked(2, true);
Dropdown::SetChecked(2, true);
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES)
dropdown_set_checked(4, true);
Dropdown::SetChecked(4, true);
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY)
dropdown_set_checked(5, true);
Dropdown::SetChecked(5, true);
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_PATHS)
dropdown_set_checked(6, true);
Dropdown::SetChecked(6, true);
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)
dropdown_set_checked(7, true);
Dropdown::SetChecked(7, true);
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS)
dropdown_set_checked(8, true);
Dropdown::SetChecked(8, true);
if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS)
dropdown_set_checked(10, true);
Dropdown::SetChecked(10, true);
if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS)
dropdown_set_checked(11, true);
Dropdown::SetChecked(11, true);
if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS)
dropdown_set_checked(12, true);
Dropdown::SetChecked(12, true);
if (mainViewport->flags & VIEWPORT_FLAG_CLIP_VIEW)
dropdown_set_checked(DDIDX_VIEW_CLIPPING, true);
Dropdown::SetChecked(DDIDX_VIEW_CLIPPING, true);
if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
dropdown_set_checked(DDIDX_HIGHLIGHT_PATH_ISSUES, true);
Dropdown::SetChecked(DDIDX_HIGHLIGHT_PATH_ISSUES, true);
gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE;
}

View File

@ -16,7 +16,7 @@ enum INPUT_FLAGS
{
INPUT_FLAG_WIDGET_PRESSED = (1 << 0),
// The dropdown can stay open if the mouse is released, set on flag DROPDOWN_FLAG_STAY_OPEN
// The dropdown can stay open if the mouse is released, set on flag Dropdown::Flag::StayOpen
INPUT_FLAG_DROPDOWN_STAY_OPEN = (1 << 1),
// The mouse has been released and the dropdown is still open