diff options
Diffstat (limited to 'src/ui/window.cpp')
-rw-r--r-- | src/ui/window.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 2215826a..4a1bc108 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -147,6 +147,21 @@ render::RenderObject* Window::GetRenderObject() const { return render_object_.get(); } +void Window::Relayout() { this->render_object_->MeasureAndLayout(); } + +void Window::InvalidateLayout() { + if (!need_layout_) { + platform::native::IUiApplication::GetInstance()->InvokeLater( + [resolver = this->CreateResolver()] { + if (const auto window = resolver.Resolve()) { + window->Relayout(); + window->need_layout_ = false; + } + }); + need_layout_ = true; + } +} + bool Window::RequestFocusFor(Control* control) { assert(control != nullptr); // The control to request focus can't be null. // You can set it as the window. |