aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/controls/CheckBox.h
blob: a892389b2bce94247cd32c1867f958e080e289e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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