| 490 | } |
| 491 | |
| 492 | void PickerWindow::OnInvalidateData(int data, bool gui_scope) |
| 493 | { |
| 494 | if (!gui_scope) return; |
| 495 | |
| 496 | PickerInvalidations pi(data); |
| 497 | |
| 498 | if (pi.Test(PickerInvalidation::Filter)) { |
| 499 | if (this->badge_filter_choices.empty()) { |
| 500 | this->type_string_filter.bdf.reset(); |
| 501 | } else { |
| 502 | this->type_string_filter.bdf.emplace(this->badge_filter_choices); |
| 503 | } |
| 504 | this->types.SetFilterState(!type_string_filter.IsEmpty() || type_string_filter.bdf.has_value()); |
| 505 | } |
| 506 | |
| 507 | if (pi.Test(PickerInvalidation::Class)) this->classes.ForceRebuild(); |
| 508 | if (pi.Test(PickerInvalidation::Type)) this->types.ForceRebuild(); |
| 509 | |
| 510 | this->BuildPickerClassList(); |
| 511 | if (pi.Test(PickerInvalidation::Validate)) this->EnsureSelectedClassIsValid(); |
| 512 | if (pi.Test(PickerInvalidation::Position)) this->EnsureSelectedClassIsVisible(); |
| 513 | |
| 514 | this->BuildPickerTypeList(); |
| 515 | if (pi.Test(PickerInvalidation::Validate)) this->EnsureSelectedTypeIsValid(); |
| 516 | if (pi.Test(PickerInvalidation::Position)) this->EnsureSelectedTypeIsVisible(); |
| 517 | |
| 518 | if (this->has_type_picker) { |
| 519 | SetWidgetLoweredState(WID_PW_MODE_ALL, HasBit(this->callbacks.mode, PFM_ALL)); |
| 520 | SetWidgetLoweredState(WID_PW_MODE_USED, HasBit(this->callbacks.mode, PFM_USED)); |
| 521 | SetWidgetLoweredState(WID_PW_MODE_SAVED, HasBit(this->callbacks.mode, PFM_SAVED)); |
| 522 | } |
| 523 | |
| 524 | SetWidgetDisabledState(WID_PW_SHRINK, this->preview_height == PREVIEW_HEIGHT); |
| 525 | SetWidgetDisabledState(WID_PW_EXPAND, this->preview_height == MAX_PREVIEW_HEIGHT); |
| 526 | } |
| 527 | |
| 528 | EventState PickerWindow::OnHotkey(int hotkey) |
| 529 | { |
no test coverage detected