LibGUI: Share code for text painting in GAbstractButton.

This gives all the GAbstractButton a consistent disabled appearance.
This commit is contained in:
Andreas Kling 2019-05-24 22:54:37 +02:00
commit c62be7bb2b
Notes: sideshowbarker 2024-07-19 13:58:01 +09:00
5 changed files with 31 additions and 30 deletions

View file

@ -66,14 +66,7 @@ void GCheckBox::paint_event(GPaintEvent& event)
painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, foreground_color());
}
if (!text().is_empty()) {
painter.draw_text(text_rect, text(), TextAlignment::TopLeft, foreground_color());
if (is_focused()) {
Rect focus_rect = text_rect;
focus_rect.inflate(6, 4);
painter.draw_rect(focus_rect, Color(140, 140, 140));
}
}
paint_text(painter, text_rect, font(), TextAlignment::TopLeft);
}
void GCheckBox::click()