| 595 | } |
| 596 | |
| 597 | void PickerWindow::EnsureSelectedClassIsValid() |
| 598 | { |
| 599 | int class_index = this->callbacks.GetSelectedClass(); |
| 600 | if (std::binary_search(std::begin(this->classes), std::end(this->classes), class_index)) return; |
| 601 | |
| 602 | if (!this->classes.empty()) { |
| 603 | class_index = this->classes.front(); |
| 604 | } else { |
| 605 | /* Classes can be empty if filters are enabled, find the first usable class. */ |
| 606 | int count = this->callbacks.GetClassCount(); |
| 607 | for (int i = 0; i < count; i++) { |
| 608 | if (this->callbacks.GetClassName(i) == INVALID_STRING_ID) continue; |
| 609 | class_index = i; |
| 610 | break; |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | this->callbacks.SetSelectedClass(class_index); |
| 615 | this->types.ForceRebuild(); |
| 616 | } |
| 617 | |
| 618 | void PickerWindow::EnsureSelectedClassIsVisible() |
| 619 | { |
no test coverage detected