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

Method DrawWidget

src/transparency_gui.cpp:43–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 }
42
43 void DrawWidget(const Rect &r, WidgetID widget) const override
44 {
45 switch (widget) {
46 case WID_TT_SIGNS:
47 case WID_TT_TREES:
48 case WID_TT_HOUSES:
49 case WID_TT_INDUSTRIES:
50 case WID_TT_BUILDINGS:
51 case WID_TT_BRIDGES:
52 case WID_TT_STRUCTURES:
53 case WID_TT_CATENARY:
54 case WID_TT_TEXT: {
55 int i = widget - WID_TT_BEGIN;
56 if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, r.left + WidgetDimensions::scaled.fullbevel.left, r.top + WidgetDimensions::scaled.fullbevel.top);
57 break;
58 }
59 case WID_TT_BUTTONS: {
60 const Rect fr = r.Shrink(WidgetDimensions::scaled.framerect);
61 for (WidgetID i = WID_TT_BEGIN; i < WID_TT_END; i++) {
62 if (i == WID_TT_TEXT) continue; // Loading and cost/income text has no invisibility button.
63
64 const Rect wr = this->GetWidget<NWidgetBase>(i)->GetCurrentRect().Shrink(WidgetDimensions::scaled.fullbevel);
65 DrawFrameRect(wr.WithY(fr), COLOUR_PALE_GREEN,
66 HasBit(_invisibility_opt, i - WID_TT_BEGIN) ? FrameFlag::Lowered : FrameFlags{});
67 }
68 break;
69 }
70 }
71 }
72
73 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
74 {

Callers

nothing calls this directly

Calls 7

HasBitFunction · 0.85
DrawSpriteFunction · 0.85
ShrinkMethod · 0.80
GetCurrentRectMethod · 0.80
WithYMethod · 0.80
DrawFrameRectFunction · 0.70

Tested by

no test coverage detected