From 7a564d98db0b7c7be5b3bfac955cb88998a472ac Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 29 Mar 2022 12:24:06 +0800 Subject: ... --- include/cru/ui/controls/Control.h | 4 ++++ include/cru/ui/controls/TextHostControlService.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h index 8c9f11d3..38a9a86b 100644 --- a/include/cru/ui/controls/Control.h +++ b/include/cru/ui/controls/Control.h @@ -23,6 +23,8 @@ class CRU_UI_API Control : public Object, public DeleteLaterImpl { friend class RootControl; + CRU_DEFINE_CLASS_LOG_TAG(u"Control") + protected: Control(); @@ -174,6 +176,8 @@ class CRU_UI_API Control : public Object, protected: virtual void OnMouseHoverChange(bool newHover) { CRU_UNUSED(newHover) } + void OnPrepareDelete() override; + private: void OnParentChangedCore(Control* old_parent, Control* new_parent); void OnWindowHostChangedCore(host::WindowHost* old_host, diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h index dec9b3e0..ae86e1e9 100644 --- a/include/cru/ui/controls/TextHostControlService.h +++ b/include/cru/ui/controls/TextHostControlService.h @@ -3,6 +3,7 @@ #include "cru/platform/gui/InputMethod.h" #include "cru/platform/gui/TimerHelper.h" #include "cru/platform/gui/UiApplication.h" +#include "cru/ui/DeleteLater.h" #include "cru/ui/controls/Control.h" #include "cru/ui/helper/ShortcutHub.h" @@ -217,6 +218,6 @@ class CRU_UI_API TextHostControlService : public Object { bool mouse_move_selecting_ = false; bool context_menu_dirty_ = true; - std::unique_ptr context_menu_; + DeleteLaterPtr context_menu_; }; } // namespace cru::ui::controls -- cgit v1.2.3