1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

GLayout: Add a simple spacer concept; dummy item that expands-to-fit.

A spacer can be inserted anywhere in a layout and will simply expand to fill
the available space. This is useful for pushing widgets into place. :^)
This commit is contained in:
Andreas Kling 2019-05-09 03:06:20 +02:00
parent bd5c79aff2
commit bffaa5ece6
4 changed files with 39 additions and 7 deletions

View file

@ -15,6 +15,7 @@ public:
void add_widget(GWidget&);
void add_layout(OwnPtr<GLayout>&&);
void add_spacer();
void remove_widget(GWidget&);
@ -31,9 +32,19 @@ public:
protected:
struct Entry {
enum class Type {
Invalid = 0,
Widget,
Layout,
Spacer,
};
Type type { Type::Invalid };
WeakPtr<GWidget> widget;
OwnPtr<GLayout> layout;
};
void add_entry(Entry&&);
WeakPtr<GWidget> m_owner;
Vector<Entry> m_entries;