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

Implement GetOptimalSize for scrollbars

Change-Id: I4f0f8fd1e103a2433c38b6c0d9148d34d3df2083
üst 2a7b3d83
......@@ -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;
};
// ----------------
......
......@@ -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 )
......
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