LibGfx: Filled checked toolbar buttons with a dither pattern

This makes them stand out a bit from buttons that are being pressed
(but not checked.)
This commit is contained in:
Andreas Kling 2020-10-23 11:37:35 +02:00
parent 06a29e8aa5
commit 9f118e3a26
Notes: sideshowbarker 2024-07-19 01:47:29 +09:00

View file

@ -165,7 +165,12 @@ void ClassicStylePainter::paint_button(Painter& painter, const IntRect& rect, co
if (pressed || checked) {
// Base
painter.fill_rect({ 1, 1, rect.width() - 2, rect.height() - 2 }, button_color);
IntRect base_rect { 1, 1, rect.width() - 2, rect.height() - 2 };
if (checked && !pressed) {
painter.fill_rect_with_dither_pattern(base_rect, palette.button().lightened(1.3f), palette.button());
} else {
painter.fill_rect(base_rect, button_color);
}
// Sunken shadow
painter.draw_line({ 1, 1 }, { rect.width() - 2, 1 }, shadow_color);