LibGUI: Draw contiguous frame if GroupBox title is left empty

This commit is contained in:
thankyouverycool 2020-07-14 11:50:34 -04:00 committed by Andreas Kling
parent 1dfae92eac
commit 4970c448bf
Notes: sideshowbarker 2024-07-19 04:50:09 +09:00

View File

@ -52,9 +52,11 @@ void GroupBox::paint_event(PaintEvent& event)
};
Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
Gfx::IntRect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
painter.fill_rect(text_rect, palette().button());
painter.draw_text(text_rect, m_title, Gfx::TextAlignment::Center, palette().button_text());
if (!m_title.is_empty()) {
Gfx::IntRect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
painter.fill_rect(text_rect, palette().button());
painter.draw_text(text_rect, m_title, Gfx::TextAlignment::Center, palette().button_text());
}
}
void GroupBox::set_title(const StringView& title)