| 1224 | } |
| 1225 | |
| 1226 | void DrawWidget(const Rect &r, WidgetID widget) const override |
| 1227 | { |
| 1228 | if (widget != WID_MH_BACKGROUND || std::empty(_news)) return; |
| 1229 | |
| 1230 | /* Fill the widget with news items. */ |
| 1231 | bool rtl = _current_text_dir == TD_RTL; |
| 1232 | Rect news = r.Shrink(WidgetDimensions::scaled.framerect).Indent(this->date_width + WidgetDimensions::scaled.hsep_wide, rtl); |
| 1233 | Rect date = r.Shrink(WidgetDimensions::scaled.framerect).WithWidth(this->date_width, rtl); |
| 1234 | int y = news.top; |
| 1235 | |
| 1236 | auto [first, last] = this->vscroll->GetVisibleRangeIterators(_news); |
| 1237 | for (auto ni = first; ni != last; ++ni) { |
| 1238 | DrawString(date.left, date.right, y, GetString(STR_JUST_DATE_TINY, ni->date), TC_WHITE); |
| 1239 | |
| 1240 | DrawNewsString(news.left, news.right, y, TC_WHITE, *ni); |
| 1241 | y += this->line_height; |
| 1242 | } |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * Some data on this window has become invalid. |
nothing calls this directly
no test coverage detected