aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ContentControl.cpp
blob: 19b1b06fcbae61894fdfff35aa65432e4235c07a (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
#include "cru/ui/ContentControl.hpp"

#include "cru/ui/Window.hpp"

namespace cru::ui {
Control* ContentControl::GetChild() const {
  if (GetChildren().empty()) return nullptr;
  return GetChildren()[0];
}

void ContentControl::SetChild(Control* child) {
  Control* old_child = nullptr;
  if (!GetChildren().empty()) {
    old_child = GetChildren()[0];
    this->RemoveChild(0);
  }
  if (child) {
    this->AddChild(child, 0);
  }
  OnChildChanged(old_child, child);
}

void ContentControl::OnChildChanged(Control* old_child, Control* new_child) {
  CRU_UNUSED(old_child)
  CRU_UNUSED(new_child)
}
}  // namespace cru::ui