From 349b26d350d46fd6c48c6895ee9d8ef81add1315 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 9 Nov 2020 16:18:20 +0800 Subject: ... --- src/ui/controls/LayoutControl.cpp | 17 ++++++++++++++++- src/ui/controls/Popup.cpp | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/ui/controls/Popup.cpp (limited to 'src/ui/controls') diff --git a/src/ui/controls/LayoutControl.cpp b/src/ui/controls/LayoutControl.cpp index 85417beb..5954853e 100644 --- a/src/ui/controls/LayoutControl.cpp +++ b/src/ui/controls/LayoutControl.cpp @@ -1,3 +1,18 @@ #include "cru/ui/controls/LayoutControl.hpp" -namespace cru::ui::controls {} +#include "cru/ui/render/RenderObject.hpp" + +namespace cru::ui::controls { +void LayoutControl::OnAddChild(Control* child, Index position) { + if (container_render_object_ != nullptr) { + container_render_object_->AddChild(child->GetRenderObject(), position); + } +} + +void LayoutControl::OnRemoveChild(Control* child, Index position) { + CRU_UNUSED(child) + if (container_render_object_ != nullptr) { + container_render_object_->RemoveChild(position); + } +} +} // namespace cru::ui::controls diff --git a/src/ui/controls/Popup.cpp b/src/ui/controls/Popup.cpp new file mode 100644 index 00000000..f51f2b3b --- /dev/null +++ b/src/ui/controls/Popup.cpp @@ -0,0 +1,20 @@ +#include "cru/ui/controls/Popup.hpp" + +#include "cru/platform/gui/UiApplication.hpp" +#include "cru/ui/host/WindowHost.hpp" +#include "cru/ui/render/StackLayoutRenderObject.hpp" + +#include + +namespace cru::ui::controls { +Popup::Popup(Control* attached_control) : attached_control_(attached_control) { + render_object_ = std::make_unique(); + SetContainerRenderObject(render_object_.get()); + + window_host_ = std::make_unique( + this, host::CreateWindowParams( + nullptr, platform::gui::CreateWindowFlags::NoCaptionAndBorder)); +} + +Popup::~Popup() = default; +} // namespace cru::ui::controls -- cgit v1.2.3