mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibGUI: Register layouts with inheritance
This commit is contained in:
parent
6dc2749795
commit
416988cc7f
2 changed files with 16 additions and 2 deletions
|
@ -10,8 +10,8 @@
|
|||
#include <LibGfx/Orientation.h>
|
||||
#include <stdio.h>
|
||||
|
||||
REGISTER_CORE_OBJECT(GUI, HorizontalBoxLayout)
|
||||
REGISTER_CORE_OBJECT(GUI, VerticalBoxLayout)
|
||||
REGISTER_LAYOUT(GUI, HorizontalBoxLayout)
|
||||
REGISTER_LAYOUT(GUI, VerticalBoxLayout)
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -14,6 +14,20 @@
|
|||
#include <LibGUI/Margins.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
||||
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<Core::Object>(namespace_::class_name::construct()); }, ®istration_Layout); \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class Layout : public Core::Object {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue