diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-12 02:51:59 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-12 02:51:59 +0200 |
commit | 09339fa912dc81703ac85bb77c372afb37e1b226 (patch) | |
tree | 2e575eec369de720bed9c11174f0090358eebb44 | |
parent | 269886fc4e40a8da94c89bcf031f3bb0fd70d968 (diff) | |
download | serenity-09339fa912dc81703ac85bb77c372afb37e1b226.zip |
StylePainter: Don't paint hover frame around disabled CoolBar buttons.
-rw-r--r-- | SharedGraphics/StylePainter.cpp | 5 | ||||
-rw-r--r-- | SharedGraphics/StylePainter.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/SharedGraphics/StylePainter.cpp b/SharedGraphics/StylePainter.cpp index b87837ee99..5e5741d78b 100644 --- a/SharedGraphics/StylePainter.cpp +++ b/SharedGraphics/StylePainter.cpp @@ -53,7 +53,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) +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); @@ -65,6 +65,9 @@ void StylePainter::paint_button(Painter& painter, const Rect& rect, ButtonStyle if (button_style == ButtonStyle::OldNormal) painter.draw_rect(rect, Color::Black); + if (button_style == ButtonStyle::CoolBar && !enabled) + return; + PainterStateSaver saver(painter); painter.translate(rect.location()); diff --git a/SharedGraphics/StylePainter.h b/SharedGraphics/StylePainter.h index 023191b077..0f22c65b8f 100644 --- a/SharedGraphics/StylePainter.h +++ b/SharedGraphics/StylePainter.h @@ -9,7 +9,7 @@ enum class FrameShape { NoFrame, Box, Container, Panel, VerticalLine, Horizontal class StylePainter { public: - static void paint_button(Painter&, const Rect&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false); + static void paint_button(Painter&, const Rect&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true); static void paint_surface(Painter&, const Rect&, bool paint_vertical_lines = true); static void paint_frame(Painter&, const Rect&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false); }; |