aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/render/RenderObject.h8
-rw-r--r--include/cru/ui/render/TreeRenderObject.h10
2 files changed, 11 insertions, 7 deletions
diff --git a/include/cru/ui/render/RenderObject.h b/include/cru/ui/render/RenderObject.h
index 1e47e7fc..a4ac0f4b 100644
--- a/include/cru/ui/render/RenderObject.h
+++ b/include/cru/ui/render/RenderObject.h
@@ -170,10 +170,14 @@ class CRU_UI_API RenderObject : public Object {
// default is to invalidate both layout and paint
virtual void OnRemoveChild(RenderObject* removed_child, Index position);
- // Draw all children with offset.
+ /**
+ * \brief Draw all children with offset.
+ */
void DefaultDrawChildren(platform::graphics::IPainter* painter);
- // Draw all children with translation of content rect lefttop.
+ /**
+ * \brief Call OnDrawContent with translation of content rect lefttop.
+ */
void DefaultDrawContent(platform::graphics::IPainter* painter);
// Call DefaultDrawContent. Then call DefaultDrawChildren.
diff --git a/include/cru/ui/render/TreeRenderObject.h b/include/cru/ui/render/TreeRenderObject.h
index da45244f..77ec0cff 100644
--- a/include/cru/ui/render/TreeRenderObject.h
+++ b/include/cru/ui/render/TreeRenderObject.h
@@ -1,5 +1,6 @@
#pragma once
#include "RenderObject.h"
+#include "cru/platform/graphics/Painter.h"
namespace cru::ui::render {
class TreeRenderObject;
@@ -33,9 +34,6 @@ class CRU_UI_API TreeRenderObjectItem : public Object {
TreeRenderObjectItem* AddItem(Index position);
void RemoveItem(Index position);
- Point GetCachedOffset() const { return offset_cache_; }
- void SetCachedOffset(const Point& point) { offset_cache_ = point; }
-
private:
TreeRenderObject* tree_render_object_;
@@ -43,8 +41,6 @@ class CRU_UI_API TreeRenderObjectItem : public Object {
std::vector<TreeRenderObjectItem*> children_;
RenderObject* render_object_;
-
- Point offset_cache_;
};
class CRU_UI_API TreeRenderObject : public RenderObject {
@@ -63,7 +59,11 @@ class CRU_UI_API TreeRenderObject : public RenderObject {
float GetTabWidth() const { return tab_width_; }
void SetTabWidth(float tab_width);
+ RenderObject* HitTest(const Point& point) override;
+
protected:
+ void OnDrawCore(platform::graphics::IPainter* painter) override;
+
Size OnMeasureContent(const MeasureRequirement& requirement,
const MeasureSize& preferred_size) override;
void OnLayoutContent(const Rect& content_rect) override;