aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/Popup.cpp5
-rw-r--r--src/ui/controls/Window.cpp15
2 files changed, 10 insertions, 10 deletions
diff --git a/src/ui/controls/Popup.cpp b/src/ui/controls/Popup.cpp
index f51f2b3b..982aee38 100644
--- a/src/ui/controls/Popup.cpp
+++ b/src/ui/controls/Popup.cpp
@@ -9,11 +9,10 @@
namespace cru::ui::controls {
Popup::Popup(Control* attached_control) : attached_control_(attached_control) {
render_object_ = std::make_unique<render::StackLayoutRenderObject>();
+ render_object_->SetAttachedControl(this);
SetContainerRenderObject(render_object_.get());
- window_host_ = std::make_unique<host::WindowHost>(
- this, host::CreateWindowParams(
- nullptr, platform::gui::CreateWindowFlags::NoCaptionAndBorder));
+ window_host_ = std::make_unique<host::WindowHost>(this);
}
Popup::~Popup() = default;
diff --git a/src/ui/controls/Window.cpp b/src/ui/controls/Window.cpp
index 7ce40dfe..b302cb62 100644
--- a/src/ui/controls/Window.cpp
+++ b/src/ui/controls/Window.cpp
@@ -1,6 +1,7 @@
#include "cru/ui/controls/Window.hpp"
#include "cru/common/Base.hpp"
+#include "cru/platform/gui/Base.hpp"
#include "cru/ui/host/WindowHost.hpp"
#include "cru/ui/render/Base.hpp"
#include "cru/ui/render/StackLayoutRenderObject.hpp"
@@ -10,6 +11,7 @@ Window* Window::CreateOverlapped() { return new Window(); }
Window::Window() : render_object_(new render::StackLayoutRenderObject()) {
render_object_->SetAttachedControl(this);
+ SetContainerRenderObject(render_object_.get());
window_host_ = std::make_unique<host::WindowHost>(this);
}
@@ -21,12 +23,11 @@ render::RenderObject* Window::GetRenderObject() const {
return render_object_.get();
}
-void Window::OnAddChild(Control* child, Index position) {
- render_object_->AddChild(child->GetRenderObject(), position);
-}
-
-void Window::OnRemoveChild(Control* child, Index position) {
- CRU_UNUSED(child);
- render_object_->RemoveChild(position);
+void Window::Show(bool create) {
+ platform::gui::INativeWindow* native_window =
+ create ? window_host_->CreateNativeWindow().get()
+ : window_host_->GetNativeWindow();
+ if (!native_window) return;
+ native_window->SetVisible(true);
}
} // namespace cru::ui::controls