aboutsummaryrefslogtreecommitdiff
path: root/src/ui/render/render_object.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-12-11 23:38:59 +0800
committercrupest <crupest@outlook.com>2018-12-11 23:38:59 +0800
commit5220ab4fee1281b2daeacf4dd50448e06eb1f5e8 (patch)
treef4eeba51b3fb6af483b952d79becb1d2b857ac75 /src/ui/render/render_object.hpp
parent5f1c790741192733cf2867ce79923b48ad6b6151 (diff)
downloadcru-5220ab4fee1281b2daeacf4dd50448e06eb1f5e8.tar.gz
cru-5220ab4fee1281b2daeacf4dd50448e06eb1f5e8.tar.bz2
cru-5220ab4fee1281b2daeacf4dd50448e06eb1f5e8.zip
...
Diffstat (limited to 'src/ui/render/render_object.hpp')
-rw-r--r--src/ui/render/render_object.hpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/ui/render/render_object.hpp b/src/ui/render/render_object.hpp
index 6603728d..4432636c 100644
--- a/src/ui/render/render_object.hpp
+++ b/src/ui/render/render_object.hpp
@@ -4,6 +4,7 @@
#include "system_headers.hpp"
#include <functional>
+#include <cassert>
#include "base.hpp"
#include "ui/ui_base.hpp"
@@ -343,7 +344,40 @@ namespace cru::ui::render
};
- class ContainerRenderObject; //TODO!
+ class ContainerRenderObject : public RenderObject
+ {
+ public:
+ ContainerRenderObject() = default;
+ ContainerRenderObject(const ContainerRenderObject& other) = delete;
+ ContainerRenderObject& operator=(const ContainerRenderObject& other) = delete;
+ ContainerRenderObject(ContainerRenderObject&& other) = delete;
+ ContainerRenderObject& operator=(ContainerRenderObject&& other) = delete;
+ ~ContainerRenderObject();
+
+ const std::vector<RenderObject*>& GetChildren() const
+ {
+ return children_;
+ }
+
+ RenderObject* GetAt(const int position) const
+ {
+ assert(position >= 0);
+ assert(position < static_cast<int>(children_.size()));
+ return children_.at(static_cast<std::vector<RenderObject*>::size_type>(position));
+ }
+
+ void AddChild(RenderObject* child);
+
+ void AddChild(RenderObject* child, int position);
+
+ void RemoveChild(int position);
+
+ protected:
+ void Draw(ID2D1RenderTarget* render_target) override;
+
+ private:
+ std::vector<RenderObject*> children_;
+ };