* Draw an image button. * @param r Rectangle of the button. * @param type Widget type (#WWT_IMGBTN or #WWT_IMGBTN_2). * @param colour Colour of the button. * @param clicked Button is clicked. * @param img Sprite to draw. * @param align Alignment of the sprite. */
| 360 | * @param align Alignment of the sprite. |
| 361 | */ |
| 362 | static inline void DrawImageButtons(const Rect &r, WidgetType type, Colours colour, bool clicked, SpriteID img, StringAlignment align) |
| 363 | { |
| 364 | assert(img != 0); |
| 365 | DrawFrameRect(r, colour, clicked ? FrameFlag::Lowered : FrameFlags{}); |
| 366 | |
| 367 | if ((type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2. |
| 368 | DrawSpriteIgnorePadding(img, PAL_NONE, r, align); |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Draw a button with image and rext. |
no test coverage detected