diff options
author | crupest <crupest@outlook.com> | 2018-09-13 23:11:52 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-13 23:11:52 +0800 |
commit | 42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d (patch) | |
tree | 53ddeb189912572fc45faaf1dffaad9a0e373d26 /CruUI/ui/control.cpp | |
parent | 9f6803884704e277fe49ed046344ddaa44a7fd19 (diff) | |
download | cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.gz cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.bz2 cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.zip |
...
Diffstat (limited to 'CruUI/ui/control.cpp')
-rw-r--r-- | CruUI/ui/control.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/CruUI/ui/control.cpp b/CruUI/ui/control.cpp index 41693ed8..4d9f0593 100644 --- a/CruUI/ui/control.cpp +++ b/CruUI/ui/control.cpp @@ -28,6 +28,11 @@ namespace cru { } + Control::Control(WindowConstructorTag, Window* window) : Control(true) + { + window_ = window; + } + Control::~Control() { ForeachChild([](auto control) @@ -275,7 +280,7 @@ namespace cru { void Control::OnAddChild(Control* child) { - if (auto window = dynamic_cast<Window*>(GetAncestor())) + if (auto window = GetWindow()) { child->TraverseDescendants([window](Control* control) { control->OnAttachToWindow(window); @@ -287,7 +292,7 @@ namespace cru { void Control::OnRemoveChild(Control* child) { - if (auto window = dynamic_cast<Window*>(GetAncestor())) + if (auto window = GetWindow()) { child->TraverseDescendants([window](Control* control) { control->OnDetachToWindow(window); |