diff options
author | crupest <crupest@outlook.com> | 2022-02-12 22:21:47 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-02-12 22:21:47 +0800 |
commit | 614c9d27ff0aa8eeff663469979af191c07792e3 (patch) | |
tree | 08905333656e2a9e473d65f16bfc4819ea19624e /include/cru/ui/controls/CheckBox.h | |
parent | 0f91e36d49cbdadedce96009954810bffd614359 (diff) | |
download | cru-614c9d27ff0aa8eeff663469979af191c07792e3.tar.gz cru-614c9d27ff0aa8eeff663469979af191c07792e3.tar.bz2 cru-614c9d27ff0aa8eeff663469979af191c07792e3.zip |
...
Diffstat (limited to 'include/cru/ui/controls/CheckBox.h')
-rw-r--r-- | include/cru/ui/controls/CheckBox.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/cru/ui/controls/CheckBox.h b/include/cru/ui/controls/CheckBox.h new file mode 100644 index 00000000..a892389b --- /dev/null +++ b/include/cru/ui/controls/CheckBox.h @@ -0,0 +1,32 @@ +#pragma once +#include "IBorderControl.h" +#include "ICheckableControl.h" +#include "NoChildControl.h" +#include "cru/ui/render/BorderRenderObject.h" + +namespace cru::ui::controls { +class CRU_UI_API CheckBox : public NoChildControl, + public virtual IBorderControl, + public virtual ICheckableControl { + public: + CheckBox(); + ~CheckBox() override; + + render::RenderObject* GetRenderObject() const override { + return container_render_object_.get(); + } + + bool IsChecked() const override { return checked_; } + void SetChecked(bool checked) override; + + IEvent<bool>* CheckedChangeEvent() override { return &checked_change_event_; } + + void ApplyBorderStyle(const style::ApplyBorderStyleInfo& style) override; + + private: + bool checked_ = false; + Event<bool> checked_change_event_; + + std::unique_ptr<render::BorderRenderObject> container_render_object_; +}; +} // namespace cru::ui::controls |