| 1688 | } |
| 1689 | |
| 1690 | void DrawWidget(const Rect &r, WidgetID widget) const override |
| 1691 | { |
| 1692 | switch (widget) { |
| 1693 | case WID_ID_DROPDOWN_ORDER: |
| 1694 | this->DrawSortButtonState(widget, this->industries.IsDescSortOrder() ? SBS_DOWN : SBS_UP); |
| 1695 | break; |
| 1696 | |
| 1697 | case WID_ID_INDUSTRY_LIST: { |
| 1698 | Rect ir = r.Shrink(WidgetDimensions::scaled.framerect); |
| 1699 | |
| 1700 | /* Setup a clipping rectangle... */ |
| 1701 | DrawPixelInfo tmp_dpi; |
| 1702 | if (!FillDrawPixelInfo(&tmp_dpi, ir)) return; |
| 1703 | /* ...but keep coordinates relative to the window. */ |
| 1704 | tmp_dpi.left += ir.left; |
| 1705 | tmp_dpi.top += ir.top; |
| 1706 | |
| 1707 | AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi); |
| 1708 | |
| 1709 | ir = ScrollRect(ir, *this->hscroll, 1); |
| 1710 | |
| 1711 | if (this->industries.empty()) { |
| 1712 | DrawString(ir, STR_INDUSTRY_DIRECTORY_NONE); |
| 1713 | break; |
| 1714 | } |
| 1715 | const CargoType acf_cargo_type = this->accepted_cargo_filter_criteria; |
| 1716 | auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->industries); |
| 1717 | for (auto it = first; it != last; ++it) { |
| 1718 | TextColour tc = TC_FROMSTRING; |
| 1719 | if (acf_cargo_type != CargoFilterCriteria::CF_ANY && acf_cargo_type != CargoFilterCriteria::CF_NONE) { |
| 1720 | Industry *ind = const_cast<Industry *>(*it); |
| 1721 | if (IndustryTemporarilyRefusesCargo(ind, acf_cargo_type)) { |
| 1722 | tc = TC_GREY | TC_FORCED; |
| 1723 | } |
| 1724 | } |
| 1725 | DrawString(ir, this->GetIndustryString(*it), tc); |
| 1726 | |
| 1727 | ir.top += this->resize.step_height; |
| 1728 | } |
| 1729 | break; |
| 1730 | } |
| 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override |
| 1735 | { |
nothing calls this directly
no test coverage detected