mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibGUI: Add read-only effective size properties for debugging
These new read-only properties help with debugging layouts, by exposing the size values that are actually used for final size determination.
This commit is contained in:
parent
68ad5f3780
commit
aba6422e11
2 changed files with 20 additions and 0 deletions
|
@ -285,6 +285,13 @@ inline auto clamp<GUI::UIDimension>(GUI::UIDimension const& input, GUI::UIDimens
|
|||
return result.has_value(); \
|
||||
});
|
||||
|
||||
#define REGISTER_READONLY_UI_DIMENSION_PROPERTY(property_name, getter) \
|
||||
register_property( \
|
||||
property_name, \
|
||||
[this] { \
|
||||
return this->getter().as_json_value(); \
|
||||
});
|
||||
|
||||
#define REGISTER_UI_SIZE_PROPERTY(property_name, getter, setter) \
|
||||
register_property( \
|
||||
property_name, \
|
||||
|
@ -309,3 +316,14 @@ inline auto clamp<GUI::UIDimension>(GUI::UIDimension const& input, GUI::UIDimens
|
|||
} \
|
||||
return false; \
|
||||
});
|
||||
|
||||
#define REGISTER_READONLY_UI_SIZE_PROPERTY(property_name, getter) \
|
||||
register_property( \
|
||||
property_name, \
|
||||
[this] { \
|
||||
auto size = this->getter(); \
|
||||
JsonObject size_object; \
|
||||
size_object.set("width", size.width().as_json_value()); \
|
||||
size_object.set("height", size.height().as_json_value()); \
|
||||
return size_object; \
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue