aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/layout_control.hpp
blob: e1856403495678bbd6a8e89744e7c8432d9bbf90 (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
#pragma once
#include "control.hpp"

namespace cru::ui {
class LayoutControl : public Control {
 protected:
  LayoutControl() = default;

 public:
  LayoutControl(const LayoutControl& other) = delete;
  LayoutControl(LayoutControl&& other) = delete;
  LayoutControl& operator=(const LayoutControl& other) = delete;
  LayoutControl& operator=(LayoutControl&& other) = delete;
  ~LayoutControl() override;

  const std::vector<Control*>& GetChildren() const override final {
    return children_;
  }

  void AddChild(Control* control, Index position);

  void RemoveChild(Index position);

 protected:
  virtual void OnAddChild(Control* child, Index position);
  virtual void OnRemoveChild(Control* child, Index position);

 private:
  std::vector<Control*> children_;
};
}  // namespace cru::ui