| 458 | } |
| 459 | |
| 460 | void PickerWindow::OnDropdownSelect(WidgetID widget, int index, int click_result) |
| 461 | { |
| 462 | switch (widget) { |
| 463 | case WID_PW_CONFIGURE_BADGES: { |
| 464 | bool reopen = HandleBadgeConfigurationDropDownClick(this->callbacks.GetFeature(), 1, index, click_result, this->badge_filter_choices); |
| 465 | |
| 466 | this->ReInit(); |
| 467 | |
| 468 | if (reopen) { |
| 469 | ReplaceDropDownList(this, BuildBadgeClassConfigurationList(this->badge_classes, 1, {}, COLOUR_DARK_GREEN), -1); |
| 470 | } else { |
| 471 | this->CloseChildWindows(WC_DROPDOWN_MENU); |
| 472 | } |
| 473 | |
| 474 | /* We need to refresh if a filter is removed. */ |
| 475 | this->InvalidateData({PickerInvalidation::Type, PickerInvalidation::Filter, PickerInvalidation::Position}); |
| 476 | break; |
| 477 | } |
| 478 | |
| 479 | default: |
| 480 | if (IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) { |
| 481 | if (index < 0) { |
| 482 | ResetBadgeFilter(this->badge_filter_choices, this->GetWidget<NWidgetBadgeFilter>(widget)->GetBadgeClassID()); |
| 483 | } else { |
| 484 | SetBadgeFilter(this->badge_filter_choices, BadgeID(index)); |
| 485 | } |
| 486 | this->InvalidateData({PickerInvalidation::Type, PickerInvalidation::Filter, PickerInvalidation::Position}); |
| 487 | } |
| 488 | break; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | void PickerWindow::OnInvalidateData(int data, bool gui_scope) |
| 493 | { |
no test coverage detected