aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/layout_control.hpp
blob: 187f0e0daba0407e2334cececad2a1de13d1086b (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, int position);

  void RemoveChild(int position);

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

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