From 308cdd54083dde627be738820f798ad25e73c300 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 13 Feb 2022 19:13:15 +0800 Subject: ... --- src/ui/controls/CheckBox.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ui/controls/CheckBox.cpp') diff --git a/src/ui/controls/CheckBox.cpp b/src/ui/controls/CheckBox.cpp index ab8af2e8..d41d1cb6 100644 --- a/src/ui/controls/CheckBox.cpp +++ b/src/ui/controls/CheckBox.cpp @@ -1,10 +1,15 @@ #include "cru/ui/controls/CheckBox.h" +#include "cru/ui/helper/ClickDetector.h" #include "cru/ui/render/BorderRenderObject.h" namespace cru::ui::controls { CheckBox::CheckBox() - : container_render_object_(new render::BorderRenderObject()) { + : container_render_object_(new render::BorderRenderObject()), + click_detector_(this) { container_render_object_->SetAttachedControl(this); + + click_detector_.ClickEvent()->AddHandler( + [this](const helper::ClickEventArgs&) { Toggle(); }); } CheckBox::~CheckBox() {} -- cgit v1.2.3