diff options
Diffstat (limited to 'src/ui/control.hpp')
-rw-r--r-- | src/ui/control.hpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/ui/control.hpp b/src/ui/control.hpp index e85d0e6d..5f8ac02a 100644 --- a/src/ui/control.hpp +++ b/src/ui/control.hpp @@ -1,9 +1,6 @@ #pragma once #include "pre.hpp" -#include <any> -#include <unordered_map> -#include <utility> #include "system_headers.hpp" #include "base.hpp" @@ -15,6 +12,10 @@ namespace cru::ui { class Window; +namespace render { +class RenderObject; +} + class Control : public Object { friend class Window; @@ -50,6 +51,9 @@ class Control : public Object { static void TraverseDescendantsInternal( Control* control, const std::function<void(Control*)>& predicate); + public: + virtual render::RenderObject* GetRenderObject() const = 0; + //*************** region: focus *************** public: bool RequestFocus(); @@ -152,16 +156,16 @@ class ContentControl : public Control { Control*& child_; }; -class MultiChildControl : public Control { +class Layout : public Control { protected: - MultiChildControl() = default; + Layout() = default; public: - MultiChildControl(const MultiChildControl& other) = delete; - MultiChildControl(MultiChildControl&& other) = delete; - MultiChildControl& operator=(const MultiChildControl& other) = delete; - MultiChildControl& operator=(MultiChildControl&& other) = delete; - ~MultiChildControl() override; + Layout(const Layout& other) = delete; + Layout(Layout&& other) = delete; + Layout& operator=(const Layout& other) = delete; + Layout& operator=(Layout&& other) = delete; + ~Layout() override; const std::vector<Control*>& GetChildren() const override final { return children_; @@ -172,8 +176,8 @@ class MultiChildControl : public Control { void RemoveChild(int position); protected: - virtual void OnAddChild(Control* child); - virtual void OnRemoveChild(Control* child); + virtual void OnAddChild(Control* child, int position); + virtual void OnRemoveChild(Control* child, int position); private: std::vector<Control*> children_; |