diff options
Diffstat (limited to 'include/cru/ui/render/RenderObject.hpp')
-rw-r--r-- | include/cru/ui/render/RenderObject.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/cru/ui/render/RenderObject.hpp b/include/cru/ui/render/RenderObject.hpp index 2b166efc..8bcd4c62 100644 --- a/include/cru/ui/render/RenderObject.hpp +++ b/include/cru/ui/render/RenderObject.hpp @@ -2,6 +2,7 @@ #include "Base.hpp" #include "MeasureRequirement.hpp" +#include "cru/common/Base.hpp" #include "cru/common/Event.hpp" #include "cru/ui/Base.hpp" @@ -63,9 +64,7 @@ class RenderObject : public Object { ~RenderObject() override = default; controls::Control* GetAttachedControl() const { return control_; } - void SetAttachedControl(controls::Control* new_control) { - control_ = new_control; - } + void SetAttachedControl(controls::Control* new_control); host::WindowHost* GetWindowHost() const { return window_host_; } @@ -76,6 +75,7 @@ class RenderObject : public Object { void AddChild(RenderObject* render_object, Index position); void RemoveChild(Index position); + RenderObject* GetFirstChild() const; void TraverseDescendants(const std::function<void(RenderObject*)>& action); // Offset from parent's lefttop to lefttop of this render object. Margin is @@ -131,6 +131,9 @@ class RenderObject : public Object { // This will set offset of this render object and call OnLayoutCore. void Layout(const Point& offset); + virtual Rect GetPaddingRect() const; + virtual Rect GetContentRect() const; + void Draw(platform::graphics::IPainter* painter); // Param point must be relative the lefttop of render object including margin. @@ -201,10 +204,11 @@ class RenderObject : public Object { // Lefttop of content_rect should be added when calculated children's offset. virtual void OnLayoutContent(const Rect& content_rect) = 0; - virtual void OnAfterLayout(); + virtual void OnAttachedControlChanged(controls::Control* control) { + CRU_UNUSED(control) + } - virtual Rect GetPaddingRect() const; - virtual Rect GetContentRect() const; + virtual void OnAfterLayout(); private: void SetParent(RenderObject* new_parent); |