| 605 | } |
| 606 | |
| 607 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 608 | { |
| 609 | switch (widget) { |
| 610 | case WID_STL_LIST: { |
| 611 | auto it = this->vscroll->GetScrolledItemFromWidget(this->stations, pt.y, this, WID_STL_LIST, WidgetDimensions::scaled.framerect.top); |
| 612 | if (it == this->stations.end()) return; // click out of list bound |
| 613 | |
| 614 | const Station *st = *it; |
| 615 | /* do not check HasStationInUse - it is slow and may be invalid */ |
| 616 | assert(st->owner == this->window_number || st->owner == OWNER_NONE); |
| 617 | |
| 618 | if (_ctrl_pressed) { |
| 619 | ShowExtraViewportWindow(st->xy); |
| 620 | } else { |
| 621 | ScrollMainWindowToTile(st->xy); |
| 622 | } |
| 623 | break; |
| 624 | } |
| 625 | |
| 626 | case WID_STL_TRAIN: |
| 627 | case WID_STL_TRUCK: |
| 628 | case WID_STL_BUS: |
| 629 | case WID_STL_AIRPLANE: |
| 630 | case WID_STL_SHIP: |
| 631 | if (_ctrl_pressed) { |
| 632 | this->filter.facilities.Flip(static_cast<StationFacility>(widget - WID_STL_TRAIN)); |
| 633 | this->ToggleWidgetLoweredState(widget); |
| 634 | } else { |
| 635 | for (StationFacility i : this->filter.facilities) { |
| 636 | this->RaiseWidget(to_underlying(i) + WID_STL_TRAIN); |
| 637 | } |
| 638 | this->filter.facilities = {}; |
| 639 | this->filter.facilities.Set(static_cast<StationFacility>(widget - WID_STL_TRAIN)); |
| 640 | this->LowerWidget(widget); |
| 641 | } |
| 642 | this->stations.ForceRebuild(); |
| 643 | this->SetDirty(); |
| 644 | break; |
| 645 | |
| 646 | case WID_STL_FACILALL: |
| 647 | for (WidgetID i = WID_STL_TRAIN; i <= WID_STL_SHIP; i++) { |
| 648 | this->LowerWidget(i); |
| 649 | } |
| 650 | |
| 651 | this->filter.facilities = {StationFacility::Train, StationFacility::TruckStop, StationFacility::BusStop, StationFacility::Airport, StationFacility::Dock}; |
| 652 | this->stations.ForceRebuild(); |
| 653 | this->SetDirty(); |
| 654 | break; |
| 655 | |
| 656 | case WID_STL_SORTBY: // flip sorting method asc/desc |
| 657 | this->stations.ToggleSortOrder(); |
| 658 | this->SetDirty(); |
| 659 | break; |
| 660 | |
| 661 | case WID_STL_SORTDROPBTN: // select sorting criteria dropdown menu |
| 662 | ShowDropDownMenu(this, CompanyStationsWindow::sorter_names, this->stations.SortType(), WID_STL_SORTDROPBTN, 0, 0); |
| 663 | break; |
| 664 |
nothing calls this directly
no test coverage detected