From 3b875091c445b7465b9bd044914318989a94d2ad Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 21 Nov 2025 21:43:42 +0800 Subject: Clean codes. Remove member function const. --- include/cru/ui/controls/CheckBox.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include/cru/ui/controls/CheckBox.h') diff --git a/include/cru/ui/controls/CheckBox.h b/include/cru/ui/controls/CheckBox.h index 6f4eae2e..2e4685d5 100644 --- a/include/cru/ui/controls/CheckBox.h +++ b/include/cru/ui/controls/CheckBox.h @@ -12,20 +12,16 @@ class CRU_UI_API CheckBox : public Control, public virtual ICheckableControl, public virtual IClickableControl { public: - static constexpr std::string_view kControlType = "CheckBox"; + static constexpr auto kControlName = "CheckBox"; CheckBox(); ~CheckBox() override; - std::string GetControlType() const override { - return std::string(kControlType); + render::RenderObject* GetRenderObject() override { + return &container_render_object_; } - render::RenderObject* GetRenderObject() const override { - return container_render_object_.get(); - } - - bool IsChecked() const override { return checked_; } + bool IsChecked() override { return checked_; } void SetChecked(bool checked) override; void Toggle() { SetChecked(!checked_); } @@ -41,11 +37,15 @@ class CRU_UI_API CheckBox : public Control, return click_detector_.StateChangeEvent(); } + IEvent* ClickEvent() override { + return click_detector_.ClickEvent(); + } + private: - bool checked_ = false; + bool checked_; Event checked_change_event_; - std::unique_ptr container_render_object_; + render::BorderRenderObject container_render_object_; helper::ClickDetector click_detector_; }; -- cgit v1.2.3