diff --git a/Userland/Libraries/LibGUI/BoxLayout.cpp b/Userland/Libraries/LibGUI/BoxLayout.cpp index d2106766dc..283d008813 100644 --- a/Userland/Libraries/LibGUI/BoxLayout.cpp +++ b/Userland/Libraries/LibGUI/BoxLayout.cpp @@ -10,8 +10,8 @@ #include #include -REGISTER_CORE_OBJECT(GUI, HorizontalBoxLayout) -REGISTER_CORE_OBJECT(GUI, VerticalBoxLayout) +REGISTER_LAYOUT(GUI, HorizontalBoxLayout) +REGISTER_LAYOUT(GUI, VerticalBoxLayout) namespace GUI { diff --git a/Userland/Libraries/LibGUI/Layout.h b/Userland/Libraries/LibGUI/Layout.h index 9beaad7b75..f65683cf08 100644 --- a/Userland/Libraries/LibGUI/Layout.h +++ b/Userland/Libraries/LibGUI/Layout.h @@ -14,6 +14,20 @@ #include #include +namespace Core { +namespace Registration { +extern Core::ObjectClassRegistration registration_Layout; +} +} + +#define REGISTER_LAYOUT(namespace_, class_name) \ + namespace Core { \ + namespace Registration { \ + Core::ObjectClassRegistration registration_##class_name( \ + #namespace_ "::" #class_name, []() { return static_ptr_cast(namespace_::class_name::construct()); }, ®istration_Layout); \ + } \ + } + namespace GUI { class Layout : public Core::Object {