mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
GButton: Draw disabled buttons with grayed-out text.
Based on a patch from "pd" (thanks!)
This commit is contained in:
parent
13b8c7eab8
commit
4508287cb2
2 changed files with 10 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue