diff options
author | crupest <crupest@outlook.com> | 2018-09-29 11:13:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-29 11:13:31 +0800 |
commit | 177765d0d9d74525a9db9e756f614636828ea980 (patch) | |
tree | 50c67f028f18486dc4a7656c82eff31cac86ec71 /src/ui/control.cpp | |
parent | b0b5a481c9b0460f275887b15e8edecc34e99186 (diff) | |
download | cru-177765d0d9d74525a9db9e756f614636828ea980.tar.gz cru-177765d0d9d74525a9db9e756f614636828ea980.tar.bz2 cru-177765d0d9d74525a9db9e756f614636828ea980.zip |
Fix relayout system.
Diffstat (limited to 'src/ui/control.cpp')
-rw-r--r-- | src/ui/control.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/control.cpp b/src/ui/control.cpp index 8aec8640..81cfe9b1 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -242,10 +242,10 @@ namespace cru { return window->GetFocusControl() == this; } - void Control::Relayout() + void Control::InvalidateLayout() { - OnMeasure(GetSize()); - OnLayout(Rect(GetPositionRelative(), GetSize())); + if (const auto window = GetWindow()) + LayoutManager::GetInstance()->InvalidateWindowLayout(window); } void Control::Measure(const Size& available_size) @@ -278,8 +278,8 @@ namespace cru { control->OnAttachToWindow(window); }); window->RefreshControlList(); + InvalidateLayout(); } - Relayout(); } void Control::OnRemoveChild(Control* child) @@ -290,8 +290,8 @@ namespace cru { control->OnDetachToWindow(window); }); window->RefreshControlList(); + InvalidateLayout(); } - Relayout(); } void Control::OnAttachToWindow(Window* window) |