1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 10:24:59 +00:00

SharedGraphics: Add some useful painting helpers and make use of them.

This commit is contained in:
Andreas Kling 2019-02-05 11:42:35 +01:00
parent b782055b96
commit 38f589a9cb
6 changed files with 38 additions and 22 deletions

View file

@ -68,17 +68,11 @@ void GCheckBox::paint_event(GPaintEvent&)
painter.fill_rect(box_rect, Color::White);
painter.draw_rect(box_rect, Color::Black);
if (m_being_modified) {
auto modification_rect = box_rect;
modification_rect.shrink(2, 2);
painter.draw_rect(modification_rect, Color::MidGray);
}
if (m_being_modified)
painter.draw_rect(box_rect.shrunken(2, 2), Color::MidGray);
if (m_checked) {
auto bitmap_rect = box_rect;
bitmap_rect.shrink(2, 2);
painter.draw_bitmap(bitmap_rect.location(), *s_checked_bitmap, foreground_color());
}
if (m_checked)
painter.draw_bitmap(box_rect.shrunken(2, 2).location(), *s_checked_bitmap, foreground_color());
if (!caption().is_empty())
painter.draw_text(text_rect, caption(), Painter::TextAlignment::TopLeft, foreground_color());