MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getStepperGroupWidgetIndex

Function getStepperGroupWidgetIndex

src/OpenLoco/src/Ui/WindowManager.cpp:1197–1220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195 }
1196
1197 static std::optional<WidgetIndex_t> getStepperGroupWidgetIndex(Window& w, WidgetIndex_t startIndex)
1198 {
1199 // We only iterate 3 times as we might be at the textbox or one of the buttons.
1200 for (WidgetIndex_t index = 0; index < 3; index++)
1201 {
1202 const auto reverseIndex = startIndex - index;
1203 if (reverseIndex < 0)
1204 {
1205 break;
1206 }
1207
1208 if (isStepperGroup(w, reverseIndex, WidgetType::toolbarTab))
1209 {
1210 return reverseIndex;
1211 }
1212
1213 if (isStepperGroup(w, reverseIndex, WidgetType::button))
1214 {
1215 return reverseIndex;
1216 }
1217 }
1218
1219 return std::nullopt;
1220 }
1221
1222 // Allow mouse wheel scrolling to manipulate stepper widgets and tool sizes
1223 static bool stepperWheelInput(Window& w, WidgetIndex_t widgetIndex, int32_t wheel)

Callers 1

stepperWheelInputFunction · 0.85

Calls 1

isStepperGroupFunction · 0.85

Tested by

no test coverage detected