From 177765d0d9d74525a9db9e756f614636828ea980 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 29 Sep 2018 11:13:31 +0800 Subject: Fix relayout system. --- src/ui/control.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui/control.cpp') 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) -- cgit v1.2.3