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

LibGUI: Make Layout a Core::Object and add basic serialization

This allows you to view layouts (as data) in Inspector.
This commit is contained in:
Andreas Kling 2020-03-05 09:21:46 +01:00
parent ecc39678f5
commit 849fdc1c0b
8 changed files with 66 additions and 13 deletions

View file

@ -29,14 +29,16 @@
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
#include <LibCore/Object.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Margins.h>
namespace GUI {
class Layout {
class Layout : public Core::Object {
C_OBJECT_ABSTRACT(Layout);
public:
Layout();
virtual ~Layout();
void add_widget(Widget&);
@ -57,7 +59,11 @@ public:
int spacing() const { return m_spacing; }
void set_spacing(int);
virtual void save_to(JsonObject&) override;
protected:
Layout();
struct Entry {
enum class Type {
Invalid = 0,