diff options
author | crupest <crupest@outlook.com> | 2019-03-21 21:42:28 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-21 21:42:28 +0800 |
commit | fdbb02b2cbdd4e4069005d0535a343229f7c4d32 (patch) | |
tree | 3cc25c18b3b019f09d6478b8b9f7b4ddbaed9eb6 /src/ui/render/render_object.hpp | |
parent | 616ebd78b543876388cb3d64f108abea041d4983 (diff) | |
download | cru-fdbb02b2cbdd4e4069005d0535a343229f7c4d32.tar.gz cru-fdbb02b2cbdd4e4069005d0535a343229f7c4d32.tar.bz2 cru-fdbb02b2cbdd4e4069005d0535a343229f7c4d32.zip |
...
Diffstat (limited to 'src/ui/render/render_object.hpp')
-rw-r--r-- | src/ui/render/render_object.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/render/render_object.hpp b/src/ui/render/render_object.hpp index 34f5dcee..a9950198 100644 --- a/src/ui/render/render_object.hpp +++ b/src/ui/render/render_object.hpp @@ -37,7 +37,11 @@ class RenderObject : public Object { Point GetOffset() const { return offset_; } void SetOffset(const Point& offset) { offset_ = offset; } Size GetSize() const { return size_; } - void SetSize(const Size& size) { size_ = size; } + void SetSize(const Size& size) { + const auto old_size = size_; + size_ = size; + OnSizeChanged(old_size, size); + } Thickness GetMargin() const { return margin_; } void SetMargin(const Thickness& margin) { margin_ = margin; } @@ -64,6 +68,8 @@ class RenderObject : public Object { virtual void OnAddChild(RenderObject* new_child, int position); virtual void OnRemoveChild(RenderObject* removed_child, int position); + virtual void OnSizeChanged(const Size& old_size, const Size& new_size); + virtual Size OnMeasureContent(const Size& available_size) = 0; virtual void OnLayoutContent(const Rect& content_rect) = 0; |