diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-06 04:08:09 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-06 04:08:09 +0200 |
commit | f12573cb6319b1ee30fdabb2264e8b63bec030e1 (patch) | |
tree | 342843598b81bc1bdde0950792679d601c7fb6a9 /SharedGraphics | |
parent | 22c204af6648364eb9c9a13d32e148a48f682555 (diff) | |
download | serenity-f12573cb6319b1ee30fdabb2264e8b63bec030e1.zip |
Add a slight hover highlight to GButton and WSButton. :^)
Diffstat (limited to 'SharedGraphics')
-rw-r--r-- | SharedGraphics/StylePainter.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/SharedGraphics/StylePainter.cpp b/SharedGraphics/StylePainter.cpp index 336f1b5030..d695b07dd8 100644 --- a/SharedGraphics/StylePainter.cpp +++ b/SharedGraphics/StylePainter.cpp @@ -1,15 +1,20 @@ #include <SharedGraphics/StylePainter.h> #include <LibGUI/GPainter.h> -static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked) +static void paint_button_new(Painter& painter, const Rect& rect, bool pressed, bool checked, bool hovered) { 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) - button_color = Color::from_rgb(0xd6d2ce); + if (checked) { + if (hovered) + button_color = Color::from_rgb(0xe3dfdb); + else + button_color = Color::from_rgb(0xd6d2ce); + } else if (hovered) + button_color = Color::from_rgb(0xd4d4d4); PainterStateSaver saver(painter); painter.translate(rect.location()); @@ -51,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) { if (button_style == ButtonStyle::Normal) - return paint_button_new(painter, rect, pressed, checked); + return paint_button_new(painter, rect, pressed, checked, hovered); Color button_color = Color::LightGray; Color highlight_color = Color::White; |