aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/Control.cpp10
-rw-r--r--src/ui/controls/NoChildControl.cpp2
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