MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnClick

Method OnClick

src/industry_gui.cpp:1783–1815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781 }
1782
1783 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
1784 {
1785 switch (widget) {
1786 case WID_ID_DROPDOWN_ORDER:
1787 this->industries.ToggleSortOrder();
1788 this->SetDirty();
1789 break;
1790
1791 case WID_ID_DROPDOWN_CRITERIA:
1792 ShowDropDownMenu(this, IndustryDirectoryWindow::sorter_names, this->industries.SortType(), WID_ID_DROPDOWN_CRITERIA, 0, 0);
1793 break;
1794
1795 case WID_ID_FILTER_BY_ACC_CARGO: // Cargo filter dropdown
1796 ShowDropDownList(this, this->BuildCargoDropDownList(), this->accepted_cargo_filter_criteria, widget);
1797 break;
1798
1799 case WID_ID_FILTER_BY_PROD_CARGO: // Cargo filter dropdown
1800 ShowDropDownList(this, this->BuildCargoDropDownList(), this->produced_cargo_filter_criteria, widget);
1801 break;
1802
1803 case WID_ID_INDUSTRY_LIST: {
1804 auto it = this->vscroll->GetScrolledItemFromWidget(this->industries, pt.y, this, WID_ID_INDUSTRY_LIST, WidgetDimensions::scaled.framerect.top);
1805 if (it != this->industries.end()) {
1806 if (_ctrl_pressed) {
1807 ShowExtraViewportWindow((*it)->location.tile);
1808 } else {
1809 ScrollMainWindowToTile((*it)->location.tile);
1810 }
1811 }
1812 break;
1813 }
1814 }
1815 }
1816
1817 void OnDropdownSelect(WidgetID widget, int index, int) override
1818 {

Callers

nothing calls this directly

Calls 10

ShowDropDownMenuFunction · 0.85
ShowDropDownListFunction · 0.85
ShowExtraViewportWindowFunction · 0.85
ScrollMainWindowToTileFunction · 0.85
ToggleSortOrderMethod · 0.80
SortTypeMethod · 0.80
SetDirtyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected