diff options
author | crupest <crupest@outlook.com> | 2022-02-10 19:26:19 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-10 19:26:19 +0800 |
commit | b2622f654598f82a220a98daaa84fed9ce3b92b2 (patch) | |
tree | 544d5a9a52d7530bf54e888d3fabd79ff85bfdb7 /src/ui/controls | |
parent | b8863c403a44c1c7ac35f1a1da92bbf3c8858552 (diff) | |
download | cru-b2622f654598f82a220a98daaa84fed9ce3b92b2.tar.gz cru-b2622f654598f82a220a98daaa84fed9ce3b92b2.tar.bz2 cru-b2622f654598f82a220a98daaa84fed9ce3b92b2.zip |
...
Diffstat (limited to 'src/ui/controls')
-rw-r--r-- | src/ui/controls/Control.cpp | 10 | ||||
-rw-r--r-- | src/ui/controls/NoChildControl.cpp | 2 |
2 files changed, 8 insertions, 4 deletions
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 <memory> - 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; diff --git a/src/ui/controls/NoChildControl.cpp b/src/ui/controls/NoChildControl.cpp index 4a9002ed..382a5d18 100644 --- a/src/ui/controls/NoChildControl.cpp +++ b/src/ui/controls/NoChildControl.cpp @@ -5,4 +5,6 @@ void NoChildControl::ForEachChild( const std::function<void(Control*)>& callback) { CRU_UNUSED(callback); } + +void NoChildControl::RemoveChild(Control* child) { CRU_UNUSED(child); } } // namespace cru::ui::controls |