| 678 | } |
| 679 | |
| 680 | void LinkGraphLegendWindow::OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) |
| 681 | { |
| 682 | /* Check which button is clicked */ |
| 683 | if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) { |
| 684 | if (!this->IsWidgetDisabled(widget)) { |
| 685 | this->ToggleWidgetLoweredState(widget); |
| 686 | this->UpdateOverlayCompanies(); |
| 687 | } |
| 688 | } else if (widget == WID_LGL_COMPANIES_ALL || widget == WID_LGL_COMPANIES_NONE) { |
| 689 | for (CompanyID c = CompanyID::Begin(); c < MAX_COMPANIES; ++c) { |
| 690 | if (this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) continue; |
| 691 | this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, widget == WID_LGL_COMPANIES_ALL); |
| 692 | } |
| 693 | this->UpdateOverlayCompanies(); |
| 694 | this->SetDirty(); |
| 695 | } else if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) { |
| 696 | this->ToggleWidgetLoweredState(widget); |
| 697 | this->UpdateOverlayCargoes(); |
| 698 | } else if (widget == WID_LGL_CARGOES_ALL || widget == WID_LGL_CARGOES_NONE) { |
| 699 | for (uint c = 0; c < this->num_cargo; c++) { |
| 700 | this->SetWidgetLoweredState(WID_LGL_CARGO_FIRST + c, widget == WID_LGL_CARGOES_ALL); |
| 701 | } |
| 702 | this->UpdateOverlayCargoes(); |
| 703 | } |
| 704 | this->SetDirty(); |
| 705 | } |
| 706 | |
| 707 | /** |
| 708 | * Invalidate the data of this window if the cargoes or companies have changed. |
nothing calls this directly
no test coverage detected