mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07: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:
parent
ecc39678f5
commit
849fdc1c0b
8 changed files with 66 additions and 13 deletions
|
@ -96,13 +96,14 @@ public:
|
|||
|
||||
Layout* layout() { return m_layout.ptr(); }
|
||||
const Layout* layout() const { return m_layout.ptr(); }
|
||||
void set_layout(OwnPtr<Layout>&&);
|
||||
void set_layout(NonnullRefPtr<Layout>);
|
||||
|
||||
template<typename T>
|
||||
T& set_layout()
|
||||
template<class T, class... Args>
|
||||
inline T& set_layout(Args&&... args)
|
||||
{
|
||||
set_layout(make<T>());
|
||||
return static_cast<T&>(*layout());
|
||||
auto layout = T::construct(forward<Args>(args)...);
|
||||
set_layout(*layout);
|
||||
return layout;
|
||||
}
|
||||
|
||||
SizePolicy horizontal_size_policy() const { return m_horizontal_size_policy; }
|
||||
|
@ -304,7 +305,7 @@ private:
|
|||
void focus_next_widget();
|
||||
|
||||
Window* m_window { nullptr };
|
||||
OwnPtr<Layout> m_layout;
|
||||
RefPtr<Layout> m_layout;
|
||||
|
||||
Gfx::Rect m_relative_rect;
|
||||
Gfx::ColorRole m_background_role;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue