aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/TreeView.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-18 00:46:27 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-18 00:46:27 +0800
commit6b4edc9be8ec556147c195cf2047d92b9439efd7 (patch)
treea1d7b7d1e821b4e1911fd00761f77a24ee483f4a /include/cru/ui/controls/TreeView.h
parentf7c4d19df66c602d74795e98ce2ee4390d06fbb4 (diff)
downloadcru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.gz
cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.tar.bz2
cru-6b4edc9be8ec556147c195cf2047d92b9439efd7.zip
Bring back ControlHost and refactor tree management of control.
Diffstat (limited to 'include/cru/ui/controls/TreeView.h')
-rw-r--r--include/cru/ui/controls/TreeView.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/cru/ui/controls/TreeView.h b/include/cru/ui/controls/TreeView.h
index f4938259..62b1c69b 100644
--- a/include/cru/ui/controls/TreeView.h
+++ b/include/cru/ui/controls/TreeView.h
@@ -48,6 +48,11 @@ class CRU_UI_API TreeViewItem : public Object {
};
class CRU_UI_API TreeView : public Control {
+ friend TreeViewItem;
+
+ private:
+ using Control::AddChild;
+
public:
constexpr static std::string_view kControlType = "TreeView";
@@ -61,11 +66,11 @@ class CRU_UI_API TreeView : public Control {
}
render::TreeRenderObject* GetRenderObject() { return &render_object_; }
- void ForEachChild(const std::function<void(Control*)>& predicate) override;
- void RemoveChild(Control* control) override;
-
TreeViewItem* GetRootItem() { return &root_item_; }
+ protected:
+ void OnChildRemoved(Control* control, Index index) override;
+
private:
render::TreeRenderObject render_object_;
TreeViewItem root_item_;