include/vcl/InterimItemWindow.hxx        |    3 +++
 vcl/source/control/InterimItemWindow.cxx |   15 +++++++++++++++
 2 files changed, 18 insertions(+)

New commits:
commit f689952f899d65939711ad9647d64e25d14bc73e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 25 11:50:02 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 26 16:08:39 2020 +0100

    add a way to invalidate the InterimItemWindow child contents
    
    Change-Id: Id7bbf6443f25eee7745123f127cd9d6424a684b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106599
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/InterimItemWindow.hxx 
b/include/vcl/InterimItemWindow.hxx
index d6b47d33cade..08860c50244a 100644
--- a/include/vcl/InterimItemWindow.hxx
+++ b/include/vcl/InterimItemWindow.hxx
@@ -22,6 +22,9 @@ public:
 
     virtual void Resize() override;
     virtual Size GetOptimalSize() const override;
+    // throw away cached size request of child so GetOptimalSize will
+    // fetch it anew
+    void InvalidateChildSizeCache();
     virtual void StateChanged(StateChangedType nStateChange) override;
     virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
     virtual void GetFocus() override;
diff --git a/vcl/source/control/InterimItemWindow.cxx 
b/vcl/source/control/InterimItemWindow.cxx
index 3ed1107bea87..97d64b617648 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -85,6 +85,21 @@ Size InterimItemWindow::GetOptimalSize() const
     return 
VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
 }
 
+void InterimItemWindow::InvalidateChildSizeCache()
+{
+    // find the bottom vcl::Window of the hierarchy and queue_resize on that
+    // one will invalidate all the size caches upwards
+    vcl::Window* pChild = GetWindow(GetWindowType::FirstChild);
+    while (true)
+    {
+        vcl::Window* pSubChild = pChild->GetWindow(GetWindowType::FirstChild);
+        if (!pSubChild)
+            break;
+        pChild = pSubChild;
+    }
+    pChild->queue_resize();
+}
+
 bool InterimItemWindow::ControlHasFocus() const
 {
     if (!m_pWidget)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to