MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WindowGetScrollIndex

Function WindowGetScrollIndex

src/openrct2-ui/interface/Window.cpp:51–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 }
50
51 static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetIndex)
52 {
53 if (w.widgets[targetWidgetIndex].type != WidgetType::scroll)
54 return -1;
55
56 int32_t scrollIndex = 0;
57 for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
58 {
59 if (widgetIndex == targetWidgetIndex)
60 break;
61 auto& widget = w.widgets[widgetIndex];
62 if (widget.type == WidgetType::scroll)
63 scrollIndex++;
64 }
65
66 return scrollIndex;
67 }
68
69 static Widget* WindowGetScrollWidget(const WindowBase& w, int32_t scrollIndex)
70 {

Callers 1

WindowAllWheelInputFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected