diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-08 15:40:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-08 15:41:42 +0100 |
commit | b790199b1d393eca11b803db9f9796341a0e58a5 (patch) | |
tree | 8dfd1862bc0ba91c92c143c190d502498234c44b | |
parent | 2a7b3d83d682102eaf1c77d7e12e698db26fdd13 (diff) |
Implement GetOptimalSize for scrollbars
Change-Id: I4f0f8fd1e103a2433c38b6c0d9148d34d3df2083
-rw-r--r-- | vcl/inc/vcl/scrbar.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx index 918f5e7b17b2..3d29c78102d3 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 585190153df4..b5ff6c829a47 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 ) |