diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-21 21:43:42 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-21 21:43:42 +0800 |
| commit | 3b875091c445b7465b9bd044914318989a94d2ad (patch) | |
| tree | a358aebb488ec1ddc86bf87b8038bacd5d7515cb /include/cru/ui/controls/CheckBox.h | |
| parent | 3cda35dbcbbe1e3854b880169c0efa0fc7a79264 (diff) | |
| download | cru-3b875091c445b7465b9bd044914318989a94d2ad.tar.gz cru-3b875091c445b7465b9bd044914318989a94d2ad.tar.bz2 cru-3b875091c445b7465b9bd044914318989a94d2ad.zip | |
Clean codes. Remove member function const.
Diffstat (limited to 'include/cru/ui/controls/CheckBox.h')
| -rw-r--r-- | include/cru/ui/controls/CheckBox.h | 20 |
1 files changed, 10 insertions, 10 deletions
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<const helper::ClickEventArgs&>* ClickEvent() override { + return click_detector_.ClickEvent(); + } + private: - bool checked_ = false; + bool checked_; Event<bool> checked_change_event_; - std::unique_ptr<render::BorderRenderObject> container_render_object_; + render::BorderRenderObject container_render_object_; helper::ClickDetector click_detector_; }; |
