diff options
-rw-r--r-- | LibGUI/GButton.cpp | 7 | ||||
-rw-r--r-- | SharedGraphics/StylePainter.cpp | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/LibGUI/GButton.cpp b/LibGUI/GButton.cpp index 6c86bb530f..7a957a1f5f 100644 --- a/LibGUI/GButton.cpp +++ b/LibGUI/GButton.cpp @@ -60,7 +60,12 @@ void GButton::paint_event(GPaintEvent& event) content_rect.move_by(m_icon->width() + 4, 0); content_rect.set_width(content_rect.width() - m_icon->width() - 4); } - painter.draw_text(content_rect, m_caption, font, text_alignment(), foreground_color(), TextElision::Right); + if (is_enabled()) + painter.draw_text(content_rect, m_caption, font, text_alignment(), foreground_color(), TextElision::Right); + else { + painter.draw_text(content_rect.translated(1, 1), m_caption, font, text_alignment(), Color::White, TextElision::Right); + painter.draw_text(content_rect, m_caption, font, text_alignment(), Color::from_rgb(0x808080), TextElision::Right); + } } void GButton::mousemove_event(GMouseEvent& event) diff --git a/SharedGraphics/StylePainter.cpp b/SharedGraphics/StylePainter.cpp index 338b9bf226..0e6b496c52 100644 --- a/SharedGraphics/StylePainter.cpp +++ b/SharedGraphics/StylePainter.cpp @@ -1,19 +1,19 @@ #include <SharedGraphics/StylePainter.h> #include <LibGUI/GPainter.h> -static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked, bool hovered) +static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked, bool hovered, bool enabled) { Color button_color = Color::from_rgb(0xc0c0c0); Color highlight_color2 = Color::from_rgb(0xdfdfdf); Color shadow_color1 = Color::from_rgb(0x808080); Color shadow_color2 = Color::from_rgb(0x404040); - if (checked) { + if (checked && enabled) { if (hovered) button_color = Color::from_rgb(0xe3dfdb); else button_color = Color::from_rgb(0xd6d2ce); - } else if (hovered) + } else if (hovered && enabled) button_color = Color::from_rgb(0xd4d4d4); PainterStateSaver saver(painter); @@ -56,7 +56,7 @@ static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, b void StylePainter::paint_button(Painter& painter, const Rect& rect, ButtonStyle button_style, bool pressed, bool hovered, bool checked, bool enabled) { if (button_style == ButtonStyle::Normal) - return paint_button_new(painter, rect, pressed, checked, hovered); + return paint_button_new(painter, rect, pressed, checked, hovered, enabled); Color button_color = checked ? Color::from_rgb(0xd6d2ce) : Color::LightGray; Color highlight_color = Color::White; |