aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-13 23:11:52 +0800
committercrupest <crupest@outlook.com>2018-09-13 23:11:52 +0800
commit42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d (patch)
tree53ddeb189912572fc45faaf1dffaad9a0e373d26 /CruUI/ui/control.cpp
parent9f6803884704e277fe49ed046344ddaa44a7fd19 (diff)
downloadcru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.gz
cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.bz2
cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.zip
...
Diffstat (limited to 'CruUI/ui/control.cpp')
-rw-r--r--CruUI/ui/control.cpp9
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);