diff options
author | FrHun <28605587+frhun@users.noreply.github.com> | 2021-09-28 15:42:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-03 16:13:19 +0100 |
commit | 4955769ab8e0169ca77cf931a007332b314fe513 (patch) | |
tree | 7aba970bd24f5655defab861bb4d59af10a4b812 /Userland/Libraries/LibGUI | |
parent | 72139e1262127e04469ef41d2a26e1eb6e7d3899 (diff) | |
download | serenity-4955769ab8e0169ca77cf931a007332b314fe513.zip |
LibGUI: Implement content_margins for GroupBox
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/GroupBox.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/GroupBox.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GroupBox.cpp b/Userland/Libraries/LibGUI/GroupBox.cpp index 17cfd8842c..1409c9e478 100644 --- a/Userland/Libraries/LibGUI/GroupBox.cpp +++ b/Userland/Libraries/LibGUI/GroupBox.cpp @@ -24,6 +24,16 @@ GroupBox::~GroupBox() { } +Margins GroupBox::content_margins() const +{ + return { + (!m_title.is_empty() ? font().glyph_height() + 1 /*room for the focus rect*/ : 2), + 2, + 2, + 2 + }; +} + void GroupBox::paint_event(PaintEvent& event) { Painter painter(*this); diff --git a/Userland/Libraries/LibGUI/GroupBox.h b/Userland/Libraries/LibGUI/GroupBox.h index 760979f67c..1f40727f69 100644 --- a/Userland/Libraries/LibGUI/GroupBox.h +++ b/Userland/Libraries/LibGUI/GroupBox.h @@ -17,6 +17,7 @@ public: String title() const { return m_title; } void set_title(const StringView&); + virtual Margins content_margins() const override; protected: explicit GroupBox(const StringView& title = {}); |