diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-30 14:44:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-30 16:09:56 +0100 |
commit | a48cf78fab4a283ef43c091e8c324c968377f9db (patch) | |
tree | 53e1317b48d82d7df1c7ace695eaa6391aa45079 /svx | |
parent | dbd6ae7dfdd292f049bbed5beb659f99e963c47b (diff) |
merge queue_layout and queue_resize
so that any window derived class, and not just dialogs, can trigger layouting
of their children. Merge together the handful of hacked-up impls of this.
Do that then for the sidebar PanelLayout so that when the label of the custom
animation frame changes that the frame allocates enough space for the new label
to display fully
Change-Id: I9a95f6c3f60cd6cea47656e66cb9ffcc154a3a5a
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx index 003ca3e1ecf3..e31c75b2619b 100644 --- a/svx/source/sidebar/PanelLayout.cxx +++ b/svx/source/sidebar/PanelLayout.cxx @@ -12,9 +12,18 @@ PanelLayout::PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame) : Control(pParent) + , m_bInClose(false) { SetStyle(GetStyle() | WB_DIALOGCONTROL); m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame); + m_aPanelLayoutTimer.SetTimeout(50); + m_aPanelLayoutTimer.SetTimeoutHdl( LINK( this, PanelLayout, ImplHandlePanelLayoutTimerHdl ) ); +} + +PanelLayout::~PanelLayout() +{ + m_bInClose = true; + m_aPanelLayoutTimer.Stop(); } Size PanelLayout::GetOptimalSize() const @@ -25,6 +34,30 @@ Size PanelLayout::GetOptimalSize() const return Control::GetOptimalSize(); } +bool PanelLayout::hasPanelPendingLayout() const +{ + return m_aPanelLayoutTimer.IsActive(); +} + +void PanelLayout::queue_resize() +{ + if (m_bInClose) + return; + if (hasPanelPendingLayout()) + return; + if (!isLayoutEnabled(this)) + return; + m_aPanelLayoutTimer.Start(); +} + +IMPL_LINK( PanelLayout, ImplHandlePanelLayoutTimerHdl, void*, EMPTYARG ) +{ + Window *pChild = GetWindow(WINDOW_FIRSTCHILD); + assert(pChild); + VclContainer::setLayoutAllocation(*pChild, Point(0, 0), GetSizePixel()); + return 0; +} + void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags) { bool bCanHandleSmallerWidth = false; |