Rename members of ScrollbarType

This commit is contained in:
Gymnasiast committed 2026-08-07 06:57:34 +02:00
1 parent 4dbb57a87a
commit 1b63339ef7
4 files changed
+27 -27

No files matched your search

+14 -14
View File
@@ -178,12 +178,12 @@ namespace OpenRCT2::Scripting
{
auto value = JSToStdString(ctx, d);
if (value == "horizontal")
return ScrollbarType::Horizontal;
return ScrollbarType::horizontal;
if (value == "vertical")
return ScrollbarType::Vertical;
return ScrollbarType::vertical;
if (value == "both")
return ScrollbarType::Both;
return ScrollbarType::None;
return ScrollbarType::both;
return ScrollbarType::none;
}
JSValue ScrollbarTypeToJS(JSContext* ctx, const ScrollbarType value)
@@ -191,13 +191,13 @@ namespace OpenRCT2::Scripting
switch (value)
{
default:
case ScrollbarType::None:
case ScrollbarType::none:
return JSFromStdString(ctx, "none");
case ScrollbarType::Horizontal:
case ScrollbarType::horizontal:
return JSFromStdString(ctx, "horizontal");
case ScrollbarType::Vertical:
case ScrollbarType::vertical:
return JSFromStdString(ctx, "vertical");
case ScrollbarType::Both:
case ScrollbarType::both:
return JSFromStdString(ctx, "both");
}
}
@@ -224,11 +224,11 @@ void CustomListView::SetScrollbars(ScrollbarType value, bool initialising)
auto widget = GetWidget();
if (widget != nullptr)
{
if (value == ScrollbarType::Horizontal)
if (value == ScrollbarType::horizontal)
widget->content = SCROLL_HORIZONTAL;
else if (value == ScrollbarType::Vertical)
else if (value == ScrollbarType::vertical)
widget->content = SCROLL_VERTICAL;
else if (value == ScrollbarType::Both)
else if (value == ScrollbarType::both)
widget->content = SCROLL_BOTH;
else
widget->content = 0;
@@ -355,7 +355,7 @@ void CustomListView::Resize(const ScreenSize& size)
}
// Calculate column widths
bool hasHorizontalScroll = Scrollbars == ScrollbarType::Horizontal || Scrollbars == ScrollbarType::Both;
bool hasHorizontalScroll = Scrollbars == ScrollbarType::horizontal || Scrollbars == ScrollbarType::both;
int32_t widthRemaining = size.width;
for (size_t c = 0; c < Columns.size(); c++)
{
@@ -401,7 +401,7 @@ ScreenSize CustomListView::GetSize()
IsMouseDown = false;
ScreenSize result;
if (Scrollbars == ScrollbarType::Horizontal || Scrollbars == ScrollbarType::Both)
if (Scrollbars == ScrollbarType::horizontal || Scrollbars == ScrollbarType::both)
{
result.width = std::accumulate(
Columns.begin(), Columns.end(), 0, [](int32_t acc, const ListViewColumn& column) { return acc + column.Width; });
@@ -409,7 +409,7 @@ ScreenSize CustomListView::GetSize()
// Fixes an off-by-one error that causes the scrollbar thumb to not fill when the widget is wide enough
result.width--;
}
if (Scrollbars == ScrollbarType::Vertical || Scrollbars == ScrollbarType::Both)
if (Scrollbars == ScrollbarType::vertical || Scrollbars == ScrollbarType::both)
{
result.height = static_cast<int32_t>(Items.size() * kListRowHeight);
if (ShowColumnHeaders)
+5 -5
View File
@@ -26,10 +26,10 @@ namespace OpenRCT2::Ui::Windows
enum class ScrollbarType
{
None,
Horizontal,
Vertical,
Both
none,
horizontal,
vertical,
both
};
enum class ColumnSortOrder
@@ -99,7 +99,7 @@ namespace OpenRCT2::Ui::Windows
size_t ScrollIndex{};
std::vector<ListViewColumn> Columns;
std::vector<ListViewItem> Items;
ScrollbarType Scrollbars = ScrollbarType::Vertical;
ScrollbarType Scrollbars = ScrollbarType::vertical;
public:
std::shared_ptr<Plugin> Owner;
+7 -7
View File
@@ -173,7 +173,7 @@ namespace OpenRCT2::Ui::Windows
result.OnHighlight = JSToCallback(ctx, desc, "onHighlight");
result.CanSelect = AsOrDefault(ctx, desc, "canSelect", false);
if (JS_IsUndefined(scrollbars))
result.Scrollbars = ScrollbarType::Vertical;
result.Scrollbars = ScrollbarType::vertical;
else
result.Scrollbars = ScrollbarTypeFromJS(ctx, scrollbars);
JS_FreeValue(ctx, cols);
@@ -512,12 +512,12 @@ namespace OpenRCT2::Ui::Windows
auto& listView = _info.ListViews[scrollIndex];
auto wwidth = widget.width() - 2;
auto wheight = widget.height() - 2;
if (listView.GetScrollbars() == ScrollbarType::Horizontal
|| listView.GetScrollbars() == ScrollbarType::Both)
if (listView.GetScrollbars() == ScrollbarType::horizontal
|| listView.GetScrollbars() == ScrollbarType::both)
{
wheight -= kScrollBarWidth + 1;
}
if (listView.GetScrollbars() == ScrollbarType::Vertical || listView.GetScrollbars() == ScrollbarType::Both)
if (listView.GetScrollbars() == ScrollbarType::vertical || listView.GetScrollbars() == ScrollbarType::both)
{
wwidth -= kScrollBarWidth + 1;
}
@@ -1050,11 +1050,11 @@ namespace OpenRCT2::Ui::Windows
{
widget.type = WidgetType::scroll;
widget.content = 0;
if (desc.Scrollbars == ScrollbarType::Horizontal)
if (desc.Scrollbars == ScrollbarType::horizontal)
widget.content = SCROLL_HORIZONTAL;
else if (desc.Scrollbars == ScrollbarType::Vertical)
else if (desc.Scrollbars == ScrollbarType::vertical)
widget.content = SCROLL_VERTICAL;
else if (desc.Scrollbars == ScrollbarType::Both)
else if (desc.Scrollbars == ScrollbarType::both)
widget.content = SCROLL_BOTH;
widgetList.push_back(widget);
}
+1 -1
View File
@@ -903,7 +903,7 @@ namespace OpenRCT2::Scripting
static JSValue scrollbars_get(JSContext* ctx, JSValue thisVal)
{
auto scrollType = ScrollbarType::None;
auto scrollType = ScrollbarType::none;
auto listView = GetListView(thisVal);
if (listView != nullptr)
{