1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +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

@ -33,19 +33,25 @@
namespace GUI {
class BoxLayout : public Layout {
C_OBJECT(BoxLayout);
public:
explicit BoxLayout(Gfx::Orientation);
virtual ~BoxLayout() override {}
Gfx::Orientation orientation() const { return m_orientation; }
virtual void run(Widget&) override;
protected:
explicit BoxLayout(Gfx::Orientation);
virtual void save_to(JsonObject &) override;
private:
Gfx::Orientation m_orientation;
};
class VerticalBoxLayout final : public BoxLayout {
C_OBJECT(VerticalBoxLayout);
public:
explicit VerticalBoxLayout()
: BoxLayout(Gfx::Orientation::Vertical)
@ -55,6 +61,7 @@ public:
};
class HorizontalBoxLayout final : public BoxLayout {
C_OBJECT(HorizontalBoxLayout);
public:
explicit HorizontalBoxLayout()
: BoxLayout(Gfx::Orientation::Horizontal)