include/vcl/InterimItemWindow.hxx        |    8 ++++++++
 vcl/source/control/InterimItemWindow.cxx |   25 ++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 60259499f4cf2785dd12cfb2f4e678e5fe6e0fd6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Jul 24 11:39:18 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Jul 24 14:56:16 2020 +0200

    add Idle layout timer to InterimItemWindow
    
    and queue_resize trigger so if its size doesn't change, but its
    children's size change that they get re-layed out
    
    Change-Id: Ia118547d1eb6e7a87b91f80b54917cd43e3bd8e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99367
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/InterimItemWindow.hxx 
b/include/vcl/InterimItemWindow.hxx
index 882a01f9bd5f..4f8f9ece2848 100644
--- a/include/vcl/InterimItemWindow.hxx
+++ b/include/vcl/InterimItemWindow.hxx
@@ -11,6 +11,7 @@
 
 #include <vcl/dllapi.h>
 #include <vcl/ctrl.hxx>
+#include <vcl/idle.hxx>
 #include <vcl/weld.hxx>
 
 class VCL_DLLPUBLIC InterimItemWindow : public Control
@@ -22,6 +23,7 @@ public:
     virtual void Resize() override;
     virtual Size GetOptimalSize() const override;
     virtual void StateChanged(StateChangedType nStateChange) override;
+    virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
     virtual void GetFocus() override;
 
     bool ControlHasFocus() const;
@@ -44,6 +46,12 @@ protected:
     weld::Widget* m_pWidget;
 
 private:
+    Idle m_aLayoutIdle;
+
+    void StartIdleLayout();
+
+    DECL_LINK(DoResize, Timer*, void);
+
     virtual void ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& 
rPos) override;
 };
 
diff --git a/vcl/source/control/InterimItemWindow.cxx 
b/vcl/source/control/InterimItemWindow.cxx
index 8b815815fbfb..e32bf52eb907 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -15,6 +15,10 @@ InterimItemWindow::InterimItemWindow(vcl::Window* pParent, 
const OUString& rUIXM
     : Control(pParent, WB_TABSTOP | WB_DIALOGCONTROL)
     , m_pWidget(nullptr) // inheritors are expected to call InitControlBase
 {
+    m_aLayoutIdle.SetPriority(TaskPriority::RESIZE);
+    m_aLayoutIdle.SetInvokeHandler(LINK(this, InterimItemWindow, DoResize));
+    m_aLayoutIdle.SetDebugName("InterimItemWindow m_aLayoutIdle");
+
     m_xVclContentArea = VclPtr<VclVBox>::Create(this);
     m_xVclContentArea->Show();
     m_xBuilder.reset(
@@ -42,10 +46,29 @@ void InterimItemWindow::dispose()
     m_xBuilder.reset();
     m_xVclContentArea.disposeAndClear();
 
+    m_aLayoutIdle.Stop();
+
     Control::dispose();
 }
 
-void InterimItemWindow::Resize()
+void InterimItemWindow::StartIdleLayout()
+{
+    if (!m_xVclContentArea)
+        return;
+    if (m_aLayoutIdle.IsActive())
+        return;
+    m_aLayoutIdle.Start();
+}
+
+void InterimItemWindow::queue_resize(StateChangedType eReason)
+{
+    Control::queue_resize(eReason);
+    StartIdleLayout();
+}
+
+void InterimItemWindow::Resize() { StartIdleLayout(); }
+
+IMPL_LINK_NOARG(InterimItemWindow, DoResize, Timer*, void)
 {
     vcl::Window* pChild = GetWindow(GetWindowType::FirstChild);
     assert(pChild);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to