MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WidgetVScrollbarDraw

Function WidgetVScrollbarDraw

src/openrct2-ui/interface/Widget.cpp:818–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816 }
817
818 static void WidgetVScrollbarDraw(
819 RenderTarget& rt, const ScrollArea& scroll, int32_t l, int32_t t, int32_t r, int32_t b, ColourWithFlags colour)
820 {
821 colour.flags.set(ColourFlag::translucent, false);
822
823 // Trough
824 Rectangle::fill(rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, getColourMap(colour.colour).lighter);
825 Rectangle::fill(
826 rt, { { l, t + kScrollBarWidth }, { r, b - kScrollBarWidth } }, getColourMap(colour.colour).midDark, true);
827 Rectangle::fill(
828 rt, { { l + 2, t + kScrollBarWidth }, { l + 2, b - kScrollBarWidth } }, getColourMap(colour.colour).midDark);
829 Rectangle::fill(
830 rt, { { l + 3, t + kScrollBarWidth }, { l + 3, b - kScrollBarWidth } }, getColourMap(colour.colour).lighter);
831 Rectangle::fill(
832 rt, { { l + 7, t + kScrollBarWidth }, { l + 7, b - kScrollBarWidth } }, getColourMap(colour.colour).midDark);
833 Rectangle::fill(
834 rt, { { l + 8, t + kScrollBarWidth }, { l + 8, b - kScrollBarWidth } }, getColourMap(colour.colour).lighter);
835
836 // Up button
837 Rectangle::fillInset(
838 rt, { { l, t }, { r, t + (kScrollBarWidth - 1) } }, colour,
839 ((scroll.flags & VSCROLLBAR_UP_PRESSED) ? Rectangle::BorderStyle::inset : Rectangle::BorderStyle::outset));
840 drawText(rt, { l + 1, t - 1 }, kBlackUpArrowString);
841
842 // Thumb
843 Rectangle::fillInset(
844 rt,
845 { { l, std::max(t + kScrollBarWidth, t + scroll.vThumbTop - 1) },
846 { r, std::min(b - kScrollBarWidth, t + scroll.vThumbBottom - 1) } },
847 { colour },
848 ((scroll.flags & VSCROLLBAR_THUMB_PRESSED) ? Rectangle::BorderStyle::inset : Rectangle::BorderStyle::outset));
849
850 // Down button
851 Rectangle::fillInset(
852 rt, { { l, b - (kScrollBarWidth - 1) }, { r, b } }, colour,
853 ((scroll.flags & VSCROLLBAR_DOWN_PRESSED) ? Rectangle::BorderStyle::inset : Rectangle::BorderStyle::outset));
854 drawText(rt, { l + 1, b - (kScrollBarWidth - 1) }, kBlackDownArrowString);
855 }
856
857 /**
858 *

Callers 1

WidgetScrollDrawFunction · 0.85

Calls 5

fillFunction · 0.85
getColourMapFunction · 0.85
fillInsetFunction · 0.85
drawTextFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected