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:
sal_Int32 mnDockRight;
sal_Int32 mnDockBottom;
WinBits mnFloatBits;
Idle maLayoutIdle;
bool mbDockCanceled:1,
mbDockPrevented:1,
mbFloatPrevented:1,
......@@ -268,6 +269,7 @@ private:
SAL_DLLPRIVATE void ImplInitDockingWindowData();
SAL_DLLPRIVATE void setPosSizeOnContainee(Size aSize, Window &rBox);
DECL_DLLPRIVATE_LINK( ImplHandleLayoutTimerHdl, void* );
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE DockingWindow (const DockingWindow &);
......@@ -291,6 +293,7 @@ public:
SAL_DLLPRIVATE bool ImplStartDocking( const Point& rPos );
SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDefferedInit; }
SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
void doDeferredInit(WinBits nBits);
protected:
DockingWindow( WindowType nType );
......@@ -361,9 +364,10 @@ public:
void SetOutputSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
Size GetOutputSizePixel() const;
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
virtual OUString GetText() 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 )
......
......@@ -329,6 +329,10 @@ void DockingWindow::ImplInitDockingWindowData()
mbIsCalculatingInitialLayoutSize = false;
mbInitialLayoutDone = false;
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 )
......@@ -1078,6 +1082,8 @@ bool DockingWindow::isLayoutEnabled() const
void DockingWindow::setOptimalLayoutSize()
{
maLayoutIdle.Stop();
//resize DockingWindow to fit requisition on initial show
Window *pBox = GetWindow(WINDOW_FIRSTCHILD);
......@@ -1121,4 +1127,30 @@ Size DockingWindow::GetOptimalSize() const
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: */
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