From b2622f654598f82a220a98daaa84fed9ce3b92b2 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 10 Feb 2022 19:26:19 +0800 Subject: ... --- src/ui/controls/Control.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ui/controls/Control.cpp') diff --git a/src/ui/controls/Control.cpp b/src/ui/controls/Control.cpp index df71f660..ba43b2b8 100644 --- a/src/ui/controls/Control.cpp +++ b/src/ui/controls/Control.cpp @@ -1,15 +1,11 @@ #include "cru/ui/controls/Control.h" -#include "cru/common/Base.h" #include "cru/platform/gui/Cursor.h" #include "cru/platform/gui/UiApplication.h" -#include "cru/ui/Base.h" #include "cru/ui/host/WindowHost.h" #include "cru/ui/render/RenderObject.h" #include "cru/ui/style/StyleRuleSet.h" -#include - namespace cru::ui::controls { using platform::gui::ICursor; using platform::gui::IUiApplication; @@ -48,6 +44,12 @@ void Control::SetParent(Control* parent) { OnParentChanged(old_parent, parent); } +void Control::RemoveFromParent() { + if (parent_) { + parent_->RemoveChild(this); + } +} + bool Control::HasFocus() { auto host = GetWindowHost(); if (host == nullptr) return false; -- cgit v1.2.3