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

Function onMouseUp

src/OpenLoco/src/Ui/Windows/ObjectSelectionWindow.cpp:1367–1430  ·  view source on GitHub ↗

0x004737BA

Source from the content-addressed store, hash-verified

1365
1366 // 0x004737BA
1367 static void onMouseUp(Window& self, WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)
1368 {
1369 switch (widgetIndex)
1370 {
1371 case widx::closeButton:
1372 tryCloseWindow();
1373 break;
1374
1375 case widx::primaryTab1:
1376 case widx::primaryTab2:
1377 case widx::primaryTab3:
1378 case widx::primaryTab4:
1379 case widx::primaryTab5:
1380 case widx::primaryTab6:
1381 case widx::primaryTab7:
1382 case widx::primaryTab8:
1383 case widx::primaryTab9:
1384 case widx::primaryTab10:
1385 case widx::primaryTab11:
1386 case widx::primaryTab12:
1387 {
1388 auto clickedTab = widgetIndex - widx::primaryTab1;
1389 switchPrimaryTab(self, clickedTab);
1390 break;
1391 }
1392
1393 case widx::clearButton:
1394 {
1395 inputSession.clearInput();
1396 applyFilterToObjectList(FilterFlags(self.var_858));
1397 self.initScrollWidgets();
1398 self.invalidate();
1399 break;
1400 }
1401
1402 case widx::secondaryTab1:
1403 case widx::secondaryTab2:
1404 case widx::secondaryTab3:
1405 case widx::secondaryTab4:
1406 case widx::secondaryTab5:
1407 case widx::secondaryTab6:
1408 case widx::secondaryTab7:
1409 case widx::secondaryTab8:
1410 {
1411 auto& subTabs = kMainTabInfo[self.currentTab].subTabs;
1412 auto previousSubType = subTabs[self.currentSecondaryTab].objectType;
1413
1414 self.currentSecondaryTab = widgetIndex - widx::secondaryTab1;
1415 auto currentSubType = subTabs[self.currentSecondaryTab].objectType;
1416 _currentVehicleType = static_cast<VehicleType>(self.currentSecondaryTab);
1417
1418 // Do we need to reload the object list?
1419 auto flags = FilterFlags(self.var_858);
1420 if (previousSubType != currentSubType)
1421 {
1422 populateTabObjectList(subTabs[self.currentSecondaryTab].objectType, flags);
1423 }
1424

Callers

nothing calls this directly

Calls 8

tryCloseWindowFunction · 0.85
switchPrimaryTabFunction · 0.85
applyFilterToObjectListFunction · 0.85
FilterFlagsEnum · 0.85
populateTabObjectListFunction · 0.85
clearInputMethod · 0.80
initScrollWidgetsMethod · 0.80
invalidateMethod · 0.45

Tested by

no test coverage detected