| 869 | } |
| 870 | |
| 871 | EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override |
| 872 | { |
| 873 | if (this->vscroll->UpdateListPositionOnKeyPress(this->list_pos, keycode) == ES_NOT_HANDLED) { |
| 874 | switch (keycode) { |
| 875 | case WKC_SPACE: |
| 876 | case WKC_RETURN: |
| 877 | if (keycode == WKC_RETURN || !IsWidgetFocused(WID_NCL_FILTER)) { |
| 878 | if (this->selected != nullptr) { |
| 879 | _network_content_client.ToggleSelectedState(*this->selected); |
| 880 | this->content.ForceResort(); |
| 881 | this->InvalidateData(); |
| 882 | } |
| 883 | if (this->filter_data.types.Any()) { |
| 884 | this->content.ForceRebuild(); |
| 885 | this->InvalidateData(); |
| 886 | } |
| 887 | return ES_HANDLED; |
| 888 | } |
| 889 | /* space is pressed and filter is focused. */ |
| 890 | [[fallthrough]]; |
| 891 | |
| 892 | default: |
| 893 | return ES_NOT_HANDLED; |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | if (this->content.empty()) { |
| 898 | if (this->UpdateFilterState()) { |
| 899 | this->content.ForceRebuild(); |
| 900 | this->InvalidateData(); |
| 901 | } |
| 902 | return ES_HANDLED; |
| 903 | } |
| 904 | |
| 905 | this->selected = this->content[this->list_pos]; |
| 906 | |
| 907 | if (this->UpdateFilterState()) { |
| 908 | this->content.ForceRebuild(); |
| 909 | } else { |
| 910 | /* Scroll to the new content if it is outside the current range. */ |
| 911 | this->ScrollToSelected(); |
| 912 | } |
| 913 | |
| 914 | /* redraw window */ |
| 915 | this->InvalidateData(); |
| 916 | return ES_HANDLED; |
| 917 | } |
| 918 | |
| 919 | void OnEditboxChanged(WidgetID wid) override |
| 920 | { |
nothing calls this directly
no test coverage detected