aboutsummaryrefslogtreecommitdiff
path: root/src/ui/window.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@outlook.com>2018-09-29 03:27:37 +0000
committerYuqian Yang <crupest@outlook.com>2018-09-29 03:27:37 +0000
commit81e171fde553d02b572653a5e763cb74ce9d331a (patch)
tree50c67f028f18486dc4a7656c82eff31cac86ec71 /src/ui/window.cpp
parentb0b5a481c9b0460f275887b15e8edecc34e99186 (diff)
parent177765d0d9d74525a9db9e756f614636828ea980 (diff)
downloadcru-81e171fde553d02b572653a5e763cb74ce9d331a.tar.gz
cru-81e171fde553d02b572653a5e763cb74ce9d331a.tar.bz2
cru-81e171fde553d02b572653a5e763cb74ce9d331a.zip
Merge branch '8-fix-relayout' into 'master'
Resolve "Fix Relayout." Closes #8 See merge request crupest/CruUI!10
Diffstat (limited to 'src/ui/window.cpp')
-rw-r--r--src/ui/window.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 34a54512..39528550 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -352,6 +352,12 @@ namespace cru
}
+ void Window::Relayout()
+ {
+ OnMeasure(GetSize());
+ OnLayout(Rect(Point::Zero(), GetSize()));
+ }
+
void Window::RefreshControlList() {
control_list_.clear();
TraverseDescendants([this](Control* control) {
@@ -456,6 +462,16 @@ namespace cru
return ::PeekMessageW(&msg, hwnd_, message, message, PM_NOREMOVE) != 0;
}
+ Size Window::OnMeasure(const Size& available_size)
+ {
+ ForeachChild([available_size](Control* control)
+ {
+ control->Measure(available_size);
+ });
+
+ return available_size;
+ }
+
void Window::OnDestroyInternal() {
Application::GetInstance()->GetWindowManager()->UnregisterWindow(hwnd_);
hwnd_ = nullptr;