Skip to content

Commit 03c91fc

Browse files
committed
LibGUI: Highlight interactive area of hovered CheckBox and RadioButton
This is consistent what we do for regular Buttons and gives a pleasant visual cue when you're over a clickable area.
1 parent d92f62d commit 03c91fc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Libraries/LibGUI/CheckBox.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ void CheckBox::paint_event(PaintEvent& event)
7575
if (fill_with_background_color())
7676
painter.fill_rect(rect(), palette().window());
7777

78+
if (is_enabled() && is_hovered())
79+
painter.fill_rect(rect(), palette().hover_highlight());
80+
7881
Gfx::Rect box_rect {
7982
0, height() / 2 - s_box_height / 2 - 1,
8083
s_box_width, s_box_height

Libraries/LibGUI/RadioButton.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ void RadioButton::paint_event(PaintEvent& event)
5252
Painter painter(*this);
5353
painter.add_clip_rect(event.rect());
5454

55+
if (fill_with_background_color())
56+
painter.fill_rect(rect(), palette().window());
57+
58+
if (is_enabled() && is_hovered())
59+
painter.fill_rect(rect(), palette().hover_highlight());
60+
5561
Gfx::Rect circle_rect { { 2, 0 }, circle_size() };
5662
circle_rect.center_vertically_within(rect());
5763

0 commit comments

Comments
 (0)