aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/controls/Control.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h
index c00e3a65..edbf5919 100644
--- a/include/cru/ui/controls/Control.h
+++ b/include/cru/ui/controls/Control.h
@@ -5,8 +5,6 @@
#include "../render/Base.h"
#include "cru/common/Event.h"
-#include <string_view>
-
namespace cru::ui::controls {
class CRU_UI_API Control : public Object {
friend host::WindowHost;
@@ -31,10 +29,18 @@ class CRU_UI_API Control : public Object {
Control* GetParent() const { return parent_; }
const std::vector<Control*>& GetChildren() const { return children_; }
+ Index IndexOf(Control* child) const;
// Traverse the tree rooted the control including itself.
void TraverseDescendants(const std::function<void(Control*)>& predicate);
+ bool IsAutoDeleteChildren() const { return auto_delete_children_; }
+ void SetAutoDeleteChildren(bool auto_delete_children) {
+ auto_delete_children_ = auto_delete_children;
+ }
+
+ void RemoveFromParent();
+
public:
virtual render::RenderObject* GetRenderObject() const = 0;
@@ -146,6 +152,8 @@ class CRU_UI_API Control : public Object {
host::WindowHost* window_host_ = nullptr;
+ bool auto_delete_children_ = true;
+
private:
bool is_mouse_over_ = false;