| 1756 | } |
| 1757 | |
| 1758 | std::string GetWidgetString(WidgetID widget, StringID stringid) const override |
| 1759 | { |
| 1760 | switch (widget) { |
| 1761 | case WID_BV_CAPTION: |
| 1762 | if (this->vehicle_type == VEH_TRAIN && !this->listview_mode) { |
| 1763 | const RailTypeInfo *rti = GetRailTypeInfo(this->filter.railtype); |
| 1764 | return GetString(rti->strings.build_caption); |
| 1765 | } |
| 1766 | if (this->vehicle_type == VEH_ROAD && !this->listview_mode) { |
| 1767 | const RoadTypeInfo *rti = GetRoadTypeInfo(this->filter.roadtype); |
| 1768 | return GetString(rti->strings.build_caption); |
| 1769 | } |
| 1770 | return GetString((this->listview_mode ? STR_VEHICLE_LIST_AVAILABLE_TRAINS : STR_BUY_VEHICLE_TRAIN_ALL_CAPTION) + this->vehicle_type); |
| 1771 | |
| 1772 | case WID_BV_SORT_DROPDOWN: |
| 1773 | return GetString(std::data(_engine_sort_listing[this->vehicle_type])[this->sort_criteria]); |
| 1774 | |
| 1775 | case WID_BV_CARGO_FILTER_DROPDOWN: |
| 1776 | return GetString(this->GetCargoFilterLabel(this->cargo_filter_criteria)); |
| 1777 | |
| 1778 | case WID_BV_SHOW_HIDE: { |
| 1779 | const Engine *e = (this->sel_engine == EngineID::Invalid()) ? nullptr : Engine::Get(this->sel_engine); |
| 1780 | if (e != nullptr && e->IsHidden(_local_company)) { |
| 1781 | return GetString(STR_BUY_VEHICLE_TRAIN_SHOW_TOGGLE_BUTTON + this->vehicle_type); |
| 1782 | } |
| 1783 | return GetString(STR_BUY_VEHICLE_TRAIN_HIDE_TOGGLE_BUTTON + this->vehicle_type); |
| 1784 | } |
| 1785 | |
| 1786 | default: |
| 1787 | if (IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) { |
| 1788 | return this->GetWidget<NWidgetBadgeFilter>(widget)->GetStringParameter(this->badge_filter_choices); |
| 1789 | } |
| 1790 | |
| 1791 | return this->Window::GetWidgetString(widget, stringid); |
| 1792 | } |
| 1793 | } |
| 1794 | |
| 1795 | void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override |
| 1796 | { |
nothing calls this directly
no test coverage detected