mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
39
Libraries/LibGUI/GGroupBox.cpp
Normal file
39
Libraries/LibGUI/GGroupBox.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <LibGUI/GGroupBox.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
GGroupBox::GGroupBox(const StringView& title, GWidget* parent)
|
||||
: GWidget(parent)
|
||||
, m_title(title)
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_background_color(Color::WarmGray);
|
||||
}
|
||||
|
||||
GGroupBox::~GGroupBox()
|
||||
{
|
||||
}
|
||||
|
||||
void GGroupBox::paint_event(GPaintEvent& event)
|
||||
{
|
||||
GPainter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Rect frame_rect {
|
||||
0, font().glyph_height() / 2,
|
||||
width(), height() - font().glyph_height() / 2
|
||||
};
|
||||
StylePainter::paint_frame(painter, frame_rect, FrameShape::Box, FrameShadow::Sunken, 2);
|
||||
|
||||
Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
|
||||
painter.fill_rect(text_rect, background_color());
|
||||
painter.draw_text(text_rect, m_title, TextAlignment::Center, foreground_color());
|
||||
}
|
||||
|
||||
void GGroupBox::set_title(const StringView& title)
|
||||
{
|
||||
if (m_title == title)
|
||||
return;
|
||||
m_title = title;
|
||||
update();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue