[Libreoffice-commits] .: 2 commits - vcl/inc vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 8 07:42:30 PDT 2012
vcl/inc/vcl/scrbar.hxx | 2 ++
vcl/source/control/scrbar.cxx | 19 +++++++++++++++++++
vcl/source/window/builder.cxx | 2 +-
vcl/source/window/layout.cxx | 4 ++--
4 files changed, 24 insertions(+), 3 deletions(-)
New commits:
commit f52f89dc65c3b54215c094e7e93bf239b0a1ba13
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 8 15:40:49 2012 +0100
mark layout as clean before setting allocation
so that if setting the allocation makes the control
change its mind the dirty flag won't be unset in
this iteration, and will trigger a second one
Change-Id: Ia4bb37848495bc6115eb8b16ec7a390cd58bd84f
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 80daaab..97426b5 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -730,7 +730,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
{
pWindow->SetHelpId(m_sHelpRoot + id);
SAL_INFO("vcl.layout", "for " << name.getStr() <<
- ", created << " << pWindow << " child of " <<
+ ", created " << pWindow << " child of " <<
pParent << "(" << pWindow->mpWindowImpl->mpParent << "/" <<
pWindow->mpWindowImpl->mpRealParent << "/" <<
pWindow->mpWindowImpl->mpBorderWindow << ") with helpid " <<
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index debfcfb..8f05785 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -54,8 +54,8 @@ void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocati
Window::SetPosSizePixel(rAllocPos, rAllocation);
if (m_bLayoutDirty || bSizeChanged)
{
- setAllocation(rAllocation);
m_bLayoutDirty = false;
+ setAllocation(rAllocation);
}
}
@@ -81,8 +81,8 @@ void VclContainer::SetSizePixel(const Size& rAllocation)
Window::SetSizePixel(aAllocation);
if (m_bLayoutDirty || bSizeChanged)
{
- setAllocation(aAllocation);
m_bLayoutDirty = false;
+ setAllocation(aAllocation);
}
}
commit b790199b1d393eca11b803db9f9796341a0e58a5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 8 15:40:34 2012 +0100
Implement GetOptimalSize for scrollbars
Change-Id: I4f0f8fd1e103a2433c38b6c0d9148d34d3df2083
diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx
index 918f5e7..3d29c78 100644
--- a/vcl/inc/vcl/scrbar.hxx
+++ b/vcl/inc/vcl/scrbar.hxx
@@ -147,6 +147,8 @@ public:
const Link& GetScrollHdl() const { return maScrollHdl; }
void SetEndScrollHdl( const Link& rLink ) { maEndScrollHdl = rLink; }
const Link& GetEndScrollHdl() const { return maEndScrollHdl; }
+
+ virtual Size GetOptimalSize(WindowSizeType eType) const;
};
// ----------------
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 5851901..b5ff6c8 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -332,6 +332,8 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
Rectangle& maTrackRect = mpData->maTrackRect; // TODO: remove when maTrackRect is no longer in mpData
if ( mbCalcSize )
{
+ Size aOldSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+
const Rectangle aControlRegion( Point(0,0), aSize );
Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
@@ -422,6 +424,12 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
maThumbRect.SetEmpty();
mbCalcSize = sal_False;
+
+ Size aNewSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+ if (aOldSize != aNewSize)
+ {
+ queue_resize();
+ }
}
if ( mnThumbPixRange )
@@ -1500,6 +1508,17 @@ void ScrollBar::SetVisibleSize( long nNewSize )
}
}
+Size ScrollBar::GetOptimalSize(WindowSizeType) const
+{
+ Rectangle aCtrlRegion;
+ aCtrlRegion.Union(maBtn1Rect);
+ aCtrlRegion.Union(maBtn2Rect);
+ aCtrlRegion.Union(maPage1Rect);
+ aCtrlRegion.Union(maPage2Rect);
+ aCtrlRegion.Union(maThumbRect);
+ return aCtrlRegion.GetSize();
+}
+
// =======================================================================
void ScrollBarBox::ImplInit( Window* pParent, WinBits nStyle )
More information about the Libreoffice-commits
mailing list