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

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
üst dbd6ae7d
......@@ -186,7 +186,7 @@ private:
VectorOfNodes LoadNodes( Module* pModule, const OUString& rExtensionId );
void InsertNodes( const VectorOfNodes& rNodeList );
virtual void queue_layout();
virtual void queue_resize();
void SetPaneSize(Window *pPane);
protected:
......
......@@ -930,7 +930,7 @@ bool OfaTreeOptionsDialog::hasTreePendingLayout() const
return maTreeLayoutTimer.IsActive();
}
void OfaTreeOptionsDialog::queue_layout()
void OfaTreeOptionsDialog::queue_resize()
{
if (hasTreePendingLayout())
return;
......
......@@ -263,7 +263,7 @@ public:
virtual void ActivatePage();
virtual long DeactivatePage();
virtual void queue_layout();
virtual void queue_resize();
sal_Bool ShowPrevPage();
sal_Bool ShowNextPage();
......
......@@ -14,19 +14,28 @@
#include <vcl/builder.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/timer.hxx>
#include <com/sun/star/frame/XFrame.hpp>
/// This class is the base for the Widget Layout-based sidebar panels.
class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
{
private:
Timer m_aPanelLayoutTimer;
bool m_bInClose;
bool hasPanelPendingLayout() const;
DECL_DLLPRIVATE_LINK( ImplHandlePanelLayoutTimerHdl, void* );
public:
PanelLayout(Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame);
virtual ~PanelLayout() {}
virtual ~PanelLayout();
virtual Size GetOptimalSize() const;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL);
virtual void queue_resize();
};
#endif
......
......@@ -104,7 +104,7 @@ public:
bool isLayoutEnabled() const;
void setOptimalLayoutSize();
bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
virtual void queue_layout();
virtual void queue_resize();
virtual bool set_property(const OString &rKey, const OString &rValue);
VclButtonBox* get_action_area();
VclBox* get_content_area();
......
......@@ -39,6 +39,8 @@ public:
{
m_bLayoutDirty = true;
}
virtual void queue_resize();
protected:
//these are the two that need to be implemented by
//containers, figure out how much space you want...
......
......@@ -201,6 +201,8 @@ public:
{
mbLayoutDirty = true;
}
virtual void queue_resize();
};
#endif // _SV_TABCTRL_HXX
......
......@@ -1074,7 +1074,7 @@ public:
*
* akin to gtk_widget_queue_resize
*/
void queue_resize();
virtual void queue_resize();
/*
* Sets the "width-request" property
......
......@@ -119,7 +119,7 @@ bool WizardDialog::hasWizardPendingLayout() const
return maWizardLayoutTimer.IsActive();
}
void WizardDialog::queue_layout()
void WizardDialog::queue_resize()
{
if (hasWizardPendingLayout())
return;
......
......@@ -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;
......
......@@ -2361,4 +2361,10 @@ Size TabControl::GetOptimalSize() const
return calculateRequisition();
}
void TabControl::queue_resize()
{
markLayoutDirty();
Window::queue_resize();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1254,7 +1254,7 @@ IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG )
return 0;
}
void Dialog::queue_layout()
void Dialog::queue_resize()
{
if (hasPendingLayout() || isCalculatingInitialLayoutSize())
return;
......@@ -1267,7 +1267,7 @@ void Dialog::queue_layout()
void Dialog::Resize()
{
queue_layout();
queue_resize();
}
bool Dialog::set_property(const OString &rKey, const OString &rValue)
......
......@@ -156,6 +156,12 @@ void VclContainer::SetSizePixel(const Size& rAllocation)
}
}
void VclContainer::queue_resize()
{
markLayoutDirty();
Window::queue_resize();
}
void VclBox::accumulateMaxes(const Size &rChildSize, Size &rSize) const
{
long nSecondaryChildDimension = getSecondaryDimension(rChildSize);
......
......@@ -1732,34 +1732,20 @@ namespace
{
bool bSomeoneCares = false;
Dialog *pDialog = NULL;
Window *pWindow = pOrigWindow;
while (pWindow)
Window *pWindow = pOrigWindow->GetParent();
if (pWindow)
{
if (isContainerWindow(*pWindow))
{
VclContainer *pContainer = static_cast<VclContainer*>(pWindow);
pContainer->markLayoutDirty();
bSomeoneCares = true;
}
else if (pWindow->GetType() == WINDOW_TABCONTROL)
{
TabControl *pTabControl = static_cast<TabControl*>(pWindow);
pTabControl->markLayoutDirty();
bSomeoneCares = true;
}
else if (pWindow->IsDialog())
{
pDialog = dynamic_cast<Dialog*>(pWindow);
break;
}
pWindow = pWindow->GetParent();
pWindow->queue_resize();
}
if (pDialog && pDialog != pOrigWindow)
pDialog->queue_layout();
return bSomeoneCares;
}
}
......
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