Kaydet (Commit) a73475ce authored tarafından Caolán McNamara's avatar Caolán McNamara

DockingWindow will need a timer after all

to update layout after initial show when
contents change

Change-Id: I8edbe84fa366cdb04dbfe5e479dc01cbf04dbf4c
üst 11d0c286
...@@ -247,6 +247,7 @@ private: ...@@ -247,6 +247,7 @@ private:
sal_Int32 mnDockRight; sal_Int32 mnDockRight;
sal_Int32 mnDockBottom; sal_Int32 mnDockBottom;
WinBits mnFloatBits; WinBits mnFloatBits;
Idle maLayoutIdle;
bool mbDockCanceled:1, bool mbDockCanceled:1,
mbDockPrevented:1, mbDockPrevented:1,
mbFloatPrevented:1, mbFloatPrevented:1,
...@@ -268,6 +269,7 @@ private: ...@@ -268,6 +269,7 @@ private:
SAL_DLLPRIVATE void ImplInitDockingWindowData(); SAL_DLLPRIVATE void ImplInitDockingWindowData();
SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox); SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, void* );
// Copy assignment is forbidden and not implemented. // Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE DockingWindow (const DockingWindow &); SAL_DLLPRIVATE DockingWindow (const DockingWindow &);
...@@ -291,6 +293,7 @@ public: ...@@ -291,6 +293,7 @@ public:
SAL_DLLPRIVATE bool ImplStartDocking( const Point& rPos ); SAL_DLLPRIVATE bool ImplStartDocking( const Point& rPos );
SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDefferedInit; } SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDefferedInit; }
SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
void doDeferredInit(WinBits nBits); void doDeferredInit(WinBits nBits);
protected: protected:
DockingWindow( WindowType nType ); DockingWindow( WindowType nType );
...@@ -364,6 +367,7 @@ public: ...@@ -364,6 +367,7 @@ public:
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE; virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
virtual OUString GetText() const SAL_OVERRIDE; virtual OUString GetText() const SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE;
virtual void queue_resize(StateChangedType eReason = StateChangedType::LAYOUT) SAL_OVERRIDE;
}; };
inline void DockingWindow::SetPin( bool bPin ) inline void DockingWindow::SetPin( bool bPin )
......
...@@ -329,6 +329,10 @@ void DockingWindow::ImplInitDockingWindowData() ...@@ -329,6 +329,10 @@ void DockingWindow::ImplInitDockingWindowData()
mbIsCalculatingInitialLayoutSize = false; mbIsCalculatingInitialLayoutSize = false;
mbInitialLayoutDone = false; mbInitialLayoutDone = false;
mpDialogParent = NULL; mpDialogParent = NULL;
//To-Do, reuse maResizeTimer
maLayoutIdle.SetPriority(VCL_IDLE_PRIORITY_RESIZE);
maLayoutIdle.SetIdleHdl( LINK( this, DockingWindow, ImplHandleLayoutTimerHdl ) );
} }
void DockingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) void DockingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
...@@ -1078,6 +1082,8 @@ bool DockingWindow::isLayoutEnabled() const ...@@ -1078,6 +1082,8 @@ bool DockingWindow::isLayoutEnabled() const
void DockingWindow::setOptimalLayoutSize() void DockingWindow::setOptimalLayoutSize()
{ {
maLayoutIdle.Stop();
//resize DockingWindow to fit requisition on initial show //resize DockingWindow to fit requisition on initial show
Window *pBox = GetWindow(WINDOW_FIRSTCHILD); Window *pBox = GetWindow(WINDOW_FIRSTCHILD);
...@@ -1121,4 +1127,30 @@ Size DockingWindow::GetOptimalSize() const ...@@ -1121,4 +1127,30 @@ Size DockingWindow::GetOptimalSize() const
return Window::CalcWindowSize(aSize); return Window::CalcWindowSize(aSize);
} }
void DockingWindow::queue_resize(StateChangedType /*eReason*/)
{
if (hasPendingLayout() || isCalculatingInitialLayoutSize())
return;
if (!isLayoutEnabled())
return;
WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
pWindowImpl->mnOptimalWidthCache = -1;
pWindowImpl->mnOptimalHeightCache = -1;
maLayoutIdle.Start();
}
IMPL_LINK(DockingWindow, ImplHandleLayoutTimerHdl, void*, EMPTYARG)
{
if (!isLayoutEnabled())
{
SAL_WARN("vcl.layout", "DockingWindow has become non-layout because extra children have been added directly to it.");
return 0;
}
Window *pBox = GetWindow(WINDOW_FIRSTCHILD);
assert(pBox);
setPosSizeOnContainee(GetSizePixel(), *pBox);
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment