Merge branch 'master' into jgrpp

# Conflicts:
#	src/airport_gui.cpp
#	src/blitter/32bpp_optimized.cpp
#	src/blitter/32bpp_simple.cpp
#	src/blitter/32bpp_sse2.cpp
#	src/blitter/8bpp_optimized.cpp
#	src/blitter/8bpp_simple.cpp
#	src/blitter/null.cpp
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/crashlog.cpp
#	src/dropdown.cpp
#	src/dropdown_type.h
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/main_gui.cpp
#	src/newgrf_debug_gui.cpp
#	src/news_gui.cpp
#	src/news_type.h
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/signs.cpp
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/spriteloader/grf.cpp
#	src/texteff.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/opengl.cpp
#	src/viewport.cpp
#	src/waypoint_cmd.cpp
#	src/zoom_type.h
This commit is contained in:
Jonathan G Rennison
2024-05-30 17:54:01 +01:00
142 changed files with 1255 additions and 1309 deletions

View File

@@ -8,18 +8,49 @@
/** @file dropdown.cpp Implementation of the dropdown widget. */
#include "stdafx.h"
#include "window_gui.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "dropdown_common_type.h"
#include "string_func.h"
#include "strings_func.h"
#include "window_gui.h"
#include "window_func.h"
#include "guitimer_func.h"
#include "zoom_func.h"
#include "dropdown_type.h"
#include "widgets/dropdown_widget.h"
#include "safeguards.h"
std::unique_ptr<DropDownListItem> MakeDropDownListDividerItem()
{
return std::make_unique<DropDownListDividerItem>(-1);
}
std::unique_ptr<DropDownListItem> MakeDropDownListStringItem(StringID str, int value, bool masked, bool shaded)
{
return std::make_unique<DropDownListStringItem>(str, value, masked, shaded);
}
std::unique_ptr<DropDownListItem> MakeDropDownListStringItem(const std::string &str, int value, bool masked, bool shaded)
{
return std::make_unique<DropDownListStringItem>(str, value, masked, shaded);
}
std::unique_ptr<DropDownListItem> MakeDropDownListIconItem(SpriteID sprite, PaletteID palette, StringID str, int value, bool masked, bool shaded)
{
return std::make_unique<DropDownListIconItem>(sprite, palette, str, value, masked, shaded);
}
std::unique_ptr<DropDownListItem> MakeDropDownListIconItem(const Dimension &dim, SpriteID sprite, PaletteID palette, StringID str, int value, bool masked, bool shaded)
{
return std::make_unique<DropDownListIconItem>(dim, sprite, palette, str, value, masked, shaded);
}
std::unique_ptr<DropDownListItem> MakeDropDownListCheckedItem(bool checked, StringID str, int value, bool masked, bool shaded)
{
return std::make_unique<DropDownListCheckedItem>(checked, str, value, masked, shaded);
}
static constexpr NWidgetPart _nested_dropdown_menu_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -451,7 +482,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, WidgetID
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
if (i >= 32 || !HasBit(hidden_mask, i)) {
list.push_back(std::make_unique<DropDownListStringItem>(strings[i], i, i < 32 && HasBit(disabled_mask, i)));
list.push_back(MakeDropDownListStringItem(strings[i], i, i < 32 && HasBit(disabled_mask, i)));
}
}