LibGUI+LibGfx: Improve focus rect appearance

Draw a dotted focus rect to make it stand out more. Also make it much
larger on regular text-only GUI::Buttons.
This commit is contained in:
Andreas Kling 2020-10-26 20:43:59 +01:00
commit b7dfa83223
Notes: sideshowbarker 2024-07-19 01:41:59 +09:00
6 changed files with 47 additions and 2 deletions

View file

@ -66,6 +66,9 @@ void RadioButton::paint_event(PaintEvent& event)
Gfx::IntRect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() };
text_rect.center_vertically_within(rect());
paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft);
if (is_focused())
painter.draw_focus_rect(text_rect.inflated(6, 6), palette().focus_outline());
}
template<typename Callback>