1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 00:42:14 +00:00

LibGUI: Improve GBoxLayout so it can better support GToolBar.

Added spacing and margin concepts to GLayout. Support layout a sequence
of nothing but fixed-size objects in the desired orientation. :^)
This commit is contained in:
Andreas Kling 2019-02-20 09:04:28 +01:00
parent b704d3d295
commit dc753b58a5
5 changed files with 84 additions and 20 deletions

View file

@ -4,6 +4,7 @@
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
#include <LibGUI/GMargins.h>
class GWidget;
@ -20,6 +21,12 @@ public:
void notify_adopted(Badge<GWidget>, GWidget&);
void notify_disowned(Badge<GWidget>, GWidget&);
GMargins margins() const { return m_margins; }
void set_margins(const GMargins&);
int spacing() const { return m_spacing; }
void set_spacing(int);
protected:
struct Entry {
WeakPtr<GWidget> widget;
@ -27,5 +34,8 @@ protected:
};
WeakPtr<GWidget> m_owner;
Vector<Entry> m_entries;
GMargins m_margins;
int m_spacing { 0 };
};