aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/window.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/window.cpp
parent9f6803884704e277fe49ed046344ddaa44a7fd19 (diff)
downloadcru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.gz
cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.tar.bz2
cru-42f9f6c0bce5b3bea05edf4e371539fe21ea1c5d.zip
...
Diffstat (limited to 'CruUI/ui/window.cpp')
-rw-r--r--CruUI/ui/window.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/CruUI/ui/window.cpp b/CruUI/ui/window.cpp
index fe37fc46..d43f2e77 100644
--- a/CruUI/ui/window.cpp
+++ b/CruUI/ui/window.cpp
@@ -91,7 +91,7 @@ namespace cru
else if (result != nullptr)
return; // find a ancestor of "control", just return
}
-
+
cache_invalid_controls_.insert(control);
if (cache_invalid_controls_.size() == 1) // when insert just now and not repeat to "InvokeLater".
@@ -105,7 +105,7 @@ namespace cru
control->CheckAndNotifyPositionChanged();
});
cache_invalid_controls_.clear(); // after update and notify, clear the set.
-
+
});
}
}
@@ -149,8 +149,8 @@ namespace cru
);
}
- Window::Window() : Control(true), layout_manager_(new WindowLayoutManager()), control_list_({ this }) {
- auto app = Application::GetInstance();
+ Window::Window() : Control(WindowConstructorTag{}, this), layout_manager_(new WindowLayoutManager()), control_list_({ this }) {
+ const auto app = Application::GetInstance();
hwnd_ = CreateWindowEx(0,
app->GetWindowManager()->GetGeneralWindowClass()->GetName(),
L"", WS_OVERLAPPEDWINDOW,
@@ -168,6 +168,9 @@ namespace cru
Window::~Window() {
Close();
+ TraverseDescendants([this](Control* control) {
+ control->OnDetachToWindow(this);
+ });
}
void Window::Close() {