aboutsummaryrefslogtreecommitdiff
path: root/src/ui/control.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/control.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/control.cpp')
-rw-r--r--src/ui/control.cpp10
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)