1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 11:35:07 +00:00

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
parent 149b7f92a7
commit c62be7bb2b
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()