From 6315e654ce0be2d2cc148e9ff80f611ac1176348 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Thu, 6 Nov 2025 17:27:10 +0800 Subject: Refactor Event. --- include/cru/ui/controls/Button.h | 2 +- include/cru/ui/controls/IconButton.h | 5 +++-- include/cru/ui/controls/RootControl.h | 2 +- include/cru/ui/controls/TextHostControlService.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/Button.h b/include/cru/ui/controls/Button.h index 3c01be32..e8fa50f1 100644 --- a/include/cru/ui/controls/Button.h +++ b/include/cru/ui/controls/Button.h @@ -33,7 +33,7 @@ class CRU_UI_API Button : public SingleChildControl, return click_detector_.StateChangeEvent(); } - IEvent* ClickEvent() { + IEvent* ClickEvent() { return click_detector_.ClickEvent(); } diff --git a/include/cru/ui/controls/IconButton.h b/include/cru/ui/controls/IconButton.h index 9e7572e0..e52d2a26 100644 --- a/include/cru/ui/controls/IconButton.h +++ b/include/cru/ui/controls/IconButton.h @@ -39,7 +39,7 @@ class CRU_UI_API IconButton : public NoChildControl, return click_detector_.StateChangeEvent(); } - IEvent* ClickEvent() { + IEvent* ClickEvent() { return click_detector_.ClickEvent(); } @@ -87,7 +87,8 @@ class CRU_UI_API IconButton : public NoChildControl, void SetIconWithSvgPathDataString(std::string_view icon_svg_path_data_string, const Rect& view_port); void SetIconWithSvgPathDataStringResourceKey( - std::string_view icon_svg_path_data_string_resource_key, const Rect& view_port); + std::string_view icon_svg_path_data_string_resource_key, + const Rect& view_port); std::shared_ptr GetContentBrush() const override { return GetIconFillBrush(); diff --git a/include/cru/ui/controls/RootControl.h b/include/cru/ui/controls/RootControl.h index 5fa8090e..e662b655 100644 --- a/include/cru/ui/controls/RootControl.h +++ b/include/cru/ui/controls/RootControl.h @@ -28,7 +28,7 @@ class CRU_UI_API RootControl Control* attached_control_; - EventRevokerListGuard + EventHandlerRevokerListGuard gain_focus_on_create_and_destroy_when_lose_focus_event_guard_; }; } // namespace cru::ui::controls diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h index 529225a7..a9f4f22b 100644 --- a/include/cru/ui/controls/TextHostControlService.h +++ b/include/cru/ui/controls/TextHostControlService.h @@ -187,8 +187,8 @@ class CRU_UI_API TextHostControlService : public Object { Event text_change_event_; - EventRevokerListGuard event_guard_; - EventRevokerListGuard input_method_context_event_guard_; + EventHandlerRevokerListGuard event_guard_; + EventHandlerRevokerListGuard input_method_context_event_guard_; std::string text_; TextRange selection_; -- cgit v1.2.3