* Draw [^][v] buttons * @param x the x position to draw * @param y the y position to draw * @param button_colour the colour of the button * @param state 0 = none clicked, 1 = first clicked, 2 = second clicked * @param clickable_up is the up button clickable? * @param clickable_down is the down button clickable? */
| 1896 | * @param clickable_down is the down button clickable? |
| 1897 | */ |
| 1898 | void DrawUpDownButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_up, bool clickable_down) |
| 1899 | { |
| 1900 | PixelColour colour = GetColourGradient(button_colour, SHADE_DARKER); |
| 1901 | |
| 1902 | Rect r = {x, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1}; |
| 1903 | Rect ur = r.WithWidth(SETTING_BUTTON_WIDTH / 2, (_current_text_dir == TD_RTL)); |
| 1904 | Rect dr = r.WithWidth(SETTING_BUTTON_WIDTH / 2, (_current_text_dir != TD_RTL)); |
| 1905 | |
| 1906 | DrawFrameRect(ur, button_colour, (state == 1) ? FrameFlag::Lowered : FrameFlags{}); |
| 1907 | DrawFrameRect(dr, button_colour, (state == 2) ? FrameFlag::Lowered : FrameFlags{}); |
| 1908 | DrawSpriteIgnorePadding(SPR_ARROW_UP, PAL_NONE, ur, SA_CENTER); |
| 1909 | DrawSpriteIgnorePadding(SPR_ARROW_DOWN, PAL_NONE, dr, SA_CENTER); |
| 1910 | |
| 1911 | /* Grey out the buttons that aren't clickable */ |
| 1912 | if (!clickable_up) GfxFillRect(ur.Shrink(WidgetDimensions::scaled.bevel), colour, FILLRECT_CHECKER); |
| 1913 | if (!clickable_down) GfxFillRect(dr.Shrink(WidgetDimensions::scaled.bevel), colour, FILLRECT_CHECKER); |
| 1914 | } |
| 1915 | |
| 1916 | /** |
| 1917 | * Draw a dropdown button. |
no test coverage detected