Allow mouse wheel scrolling to manipulate stepper widgets and tool sizes
| 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) |
| 1224 | { |
| 1225 | const auto stepperGroupIndex = getStepperGroupWidgetIndex(w, widgetIndex); |
| 1226 | if (!stepperGroupIndex.has_value()) |
| 1227 | { |
| 1228 | return false; |
| 1229 | } |
| 1230 | |
| 1231 | const auto entryWidgetType = w.widgets[*stepperGroupIndex].type; |
| 1232 | if (entryWidgetType == WidgetType::wt_3) |
| 1233 | { |
| 1234 | auto expectedContent1 = Gfx::recolour(ImageIds::decrease_tool_area, Colour::white); |
| 1235 | auto expectedContent2 = Gfx::recolour(ImageIds::increase_tool_area, Colour::white); |
| 1236 | |
| 1237 | auto button1Image = w.widgets[*stepperGroupIndex + 1].image; |
| 1238 | auto button2Image = w.widgets[*stepperGroupIndex + 2].image; |
| 1239 | if (button1Image != expectedContent1 || button2Image != expectedContent2) |
| 1240 | { |
| 1241 | return false; |
| 1242 | } |
| 1243 | } |
| 1244 | else if (entryWidgetType == WidgetType::textbox) |
| 1245 | { |
| 1246 | auto button1StringId = w.widgets[*stepperGroupIndex + 1].text; |
| 1247 | auto button2StringId = w.widgets[*stepperGroupIndex + 2].text; |
| 1248 | if (button1StringId != StringIds::stepper_minus || button2StringId != StringIds::stepper_plus) |
| 1249 | { |
| 1250 | return false; |
| 1251 | } |
| 1252 | } |
| 1253 | |
| 1254 | const auto targetWidgetIndex = wheel < 0 ? *stepperGroupIndex + 2 : *stepperGroupIndex + 1; |
| 1255 | if (w.isDisabled(targetWidgetIndex)) |
| 1256 | { |
| 1257 | return false; |
| 1258 | } |
| 1259 | |
| 1260 | w.callOnMouseDown(targetWidgetIndex, w.widgets[targetWidgetIndex].id); |
| 1261 | return true; |
| 1262 | } |
| 1263 | |
| 1264 | // 0x004C628E |
| 1265 | static bool windowWheelInput(Window& window, int wheel) |
no test coverage detected