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

Function onMouseDown

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

Source from the content-addressed store, hash-verified

1430 }
1431
1432 static void onMouseDown(Window& self, const WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)
1433 {
1434 if (widgetIndex == widx::filterDropdown)
1435 {
1436 auto& dropdown = self.widgets[widx::filterLabel];
1437 Dropdown::show(self.x + dropdown.left, self.y + dropdown.top, dropdown.width() - 4, dropdown.height(), self.getColour(WindowColour::secondary), 7, 0);
1438
1439 Dropdown::add(0, StringIds::dropdown_stringid, StringIds::objSelectionFilterBeginner);
1440 Dropdown::add(1, StringIds::dropdown_stringid, StringIds::objSelectionFilterAdvanced);
1441 Dropdown::add(2, StringIds::dropdown_stringid, StringIds::objSelectionFilterExpert);
1442 Dropdown::add(3, 0);
1443 Dropdown::add(4, StringIds::dropdown_without_checkmark, StringIds::objSelectionFilterVanilla);
1444 Dropdown::add(5, StringIds::dropdown_without_checkmark, StringIds::objSelectionFilterOpenLoco);
1445 Dropdown::add(6, StringIds::dropdown_without_checkmark, StringIds::objSelectionFilterCustom);
1446
1447 // Mark current level
1448 Dropdown::setItemSelected(self.filterLevel);
1449
1450 // Show vanilla objects?
1451 if ((FilterFlags(self.var_858) & FilterFlags::vanilla) != FilterFlags::none)
1452 {
1453 Dropdown::setItemSelected(4);
1454 }
1455
1456 // Show OpenLoco objects?
1457 if ((FilterFlags(self.var_858) & FilterFlags::openLoco) != FilterFlags::none)
1458 {
1459 Dropdown::setItemSelected(5);
1460 }
1461
1462 // Show custom objects?
1463 if ((FilterFlags(self.var_858) & FilterFlags::custom) != FilterFlags::none)
1464 {
1465 Dropdown::setItemSelected(6);
1466 }
1467 }
1468 }
1469
1470 static void onDropdown(Window& self, WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id, int16_t itemIndex)
1471 {

Callers

nothing calls this directly

Calls 7

showFunction · 0.85
setItemSelectedFunction · 0.85
FilterFlagsEnum · 0.85
getColourMethod · 0.80
addFunction · 0.50
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected