MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawWidget

Method DrawWidget

src/bridge_gui.cpp:228–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226 }
227
228 void DrawWidget(const Rect &r, WidgetID widget) const override
229 {
230 switch (widget) {
231 case WID_BBS_DROPDOWN_ORDER:
232 this->DrawSortButtonState(widget, this->bridges.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
233 break;
234
235 case WID_BBS_BRIDGE_LIST: {
236 Rect tr = r.WithHeight(this->resize.step_height).Shrink(WidgetDimensions::scaled.matrix);
237 bool rtl = _current_text_dir == TD_RTL;
238 auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->bridges);
239 for (auto it = first; it != last; ++it) {
240 const BridgeSpec *b = it->spec;
241 DrawSpriteIgnorePadding(b->sprite, b->pal, tr.WithWidth(this->icon_width, rtl), SA_HOR_CENTER | SA_BOTTOM);
242 DrawStringMultiLineWithClipping(tr.Indent(this->icon_width + WidgetDimensions::scaled.hsep_normal, rtl), GetBridgeSelectString(*it));
243 tr = tr.Translate(0, this->resize.step_height);
244 }
245 break;
246 }
247 }
248 }
249
250 EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
251 {

Callers

nothing calls this directly

Calls 10

DrawSpriteIgnorePaddingFunction · 0.85
DrawSortButtonStateMethod · 0.80
IsDescSortOrderMethod · 0.80
ShrinkMethod · 0.80
WithHeightMethod · 0.80
WithWidthMethod · 0.80
IndentMethod · 0.80
TranslateMethod · 0.80

Tested by

no test coverage detected