mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Add a slight hover highlight to GButton and WSButton. :^)
This commit is contained in:
parent
22c204af66
commit
f12573cb63
6 changed files with 40 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue