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

Function DrawDropDownButton

src/settings_gui.cpp:1924–1936  ·  view source on GitHub ↗

* Draw a dropdown button. * @param x the x position to draw * @param y the y position to draw * @param button_colour the colour of the button * @param state true = lowered * @param clickable is the button clickable? */

Source from the content-addressed store, hash-verified

1922 * @param clickable is the button clickable?
1923 */
1924void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable)
1925{
1926 PixelColour colour = GetColourGradient(button_colour, SHADE_DARKER);
1927
1928 Rect r = {x, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1};
1929
1930 DrawFrameRect(r, button_colour, state ? FrameFlag::Lowered : FrameFlags{});
1931 DrawSpriteIgnorePadding(SPR_ARROW_DOWN, PAL_NONE, r, SA_CENTER);
1932
1933 if (!clickable) {
1934 GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), colour, FILLRECT_CHECKER);
1935 }
1936}
1937
1938/**
1939 * Draw a toggle button.

Callers 5

DrawSettingMethod · 0.85
DrawWidgetMethod · 0.85
DrawSettingMethod · 0.85
DrawWidgetMethod · 0.85
DrawWidgetMethod · 0.85

Calls 5

GetColourGradientFunction · 0.85
DrawSpriteIgnorePaddingFunction · 0.85
ShrinkMethod · 0.80
DrawFrameRectFunction · 0.70
GfxFillRectFunction · 0.70

Tested by

no test coverage detected