aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/ContentControl.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-10 15:03:54 +0800
committercrupest <crupest@outlook.com>2020-11-10 15:03:54 +0800
commit460a45df8be4613053c6a097d9c699c70dbe1a2c (patch)
treedbd4141b27eb0cea9481fcd735a247e64b335f33 /src/ui/controls/ContentControl.cpp
parent141fbebbe604eac53d12e7de11f999044e286cb6 (diff)
downloadcru-460a45df8be4613053c6a097d9c699c70dbe1a2c.tar.gz
cru-460a45df8be4613053c6a097d9c699c70dbe1a2c.tar.bz2
cru-460a45df8be4613053c6a097d9c699c70dbe1a2c.zip
...
Diffstat (limited to 'src/ui/controls/ContentControl.cpp')
-rw-r--r--src/ui/controls/ContentControl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui/controls/ContentControl.cpp b/src/ui/controls/ContentControl.cpp
index 653882c0..8c6f0b00 100644
--- a/src/ui/controls/ContentControl.cpp
+++ b/src/ui/controls/ContentControl.cpp
@@ -19,7 +19,13 @@ void ContentControl::SetChild(Control* child) {
}
void ContentControl::OnChildChanged(Control* old_child, Control* new_child) {
- CRU_UNUSED(old_child)
- CRU_UNUSED(new_child)
+ if (container_render_object_) {
+ if (old_child) {
+ container_render_object_->RemoveChild(0);
+ }
+ if (new_child) {
+ container_render_object_->AddChild(new_child->GetRenderObject(), 0);
+ }
+ }
}
} // namespace cru::ui::controls