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

Method DrawWidgets

src/widget.cpp:784–809  ·  view source on GitHub ↗

* Paint all widgets of a window. */

Source from the content-addressed store, hash-verified

782 * Paint all widgets of a window.
783 */
784void Window::DrawWidgets() const
785{
786 this->nested_root->Draw(this);
787
788 if (this->flags.Test(WindowFlag::WhiteBorder)) {
789 DrawFrameRect(0, 0, this->width - 1, this->height - 1, COLOUR_WHITE, FrameFlag::BorderOnly);
790 }
791
792 if (this->flags.Test(WindowFlag::Highlighted)) {
793 extern bool _window_highlight_colour;
794 for (const auto &pair : this->widget_lookup) {
795 const NWidgetBase *widget = pair.second;
796 if (!widget->IsHighlighted()) continue;
797
798 Rect outer = widget->GetCurrentRect();
799 Rect inner = outer.Shrink(WidgetDimensions::scaled.bevel).Expand(1);
800
801 PixelColour colour = _string_colourmap[_window_highlight_colour ? widget->GetHighlightColour() : TC_WHITE];
802
803 GfxFillRect(outer.left, outer.top, inner.left, inner.bottom, colour);
804 GfxFillRect(inner.left + 1, outer.top, inner.right - 1, inner.top, colour);
805 GfxFillRect(inner.right, outer.top, outer.right, inner.bottom, colour);
806 GfxFillRect(outer.left + 1, inner.bottom, outer.right - 1, outer.bottom, colour);
807 }
808 }
809}
810
811/**
812 * Draw a sort button's up or down arrow symbol.

Callers 15

OnPaintMethod · 0.95
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80
OnPaintMethod · 0.80

Calls 9

TestMethod · 0.80
GetCurrentRectMethod · 0.80
ExpandMethod · 0.80
ShrinkMethod · 0.80
DrawFrameRectFunction · 0.70
GfxFillRectFunction · 0.70
DrawMethod · 0.45
IsHighlightedMethod · 0.45
GetHighlightColourMethod · 0.45

Tested by

no test coverage detected