make sure we add the correct wx-border pixels to native controls when calculating best size

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-05-27 14:14:11 +00:00
parent 10a99f20aa
commit b91dd98ff1

View File

@@ -2055,41 +2055,46 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
wxSize wxWindowMac::DoGetBestSize() const
{
if ( m_peer == NULL || m_macIsUserPane || IsTopLevel() )
return wxWindowBase::DoGetBestSize() ;
Rect bestsize = { 0 , 0 , 0 , 0 } ;
int bestWidth, bestHeight ;
m_peer->GetBestRect( &bestsize ) ;
if ( EmptyRect( &bestsize ) )
{
bestsize.left =
bestsize.top = 0 ;
bestsize.right =
bestsize.bottom = 16 ;
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
bestsize.bottom = 16 ;
}
#if wxUSE_SPINBTN
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
bestsize.bottom = 24 ;
}
#endif
else
{
// return wxWindowBase::DoGetBestSize() ;
}
return wxWindowBase::DoGetBestSize() ;
}
else
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
int bestWidth, bestHeight ;
bestWidth = bestsize.right - bestsize.left ;
bestHeight = bestsize.bottom - bestsize.top ;
if ( bestHeight < 10 )
bestHeight = 13 ;
m_peer->GetBestRect( &bestsize ) ;
if ( EmptyRect( &bestsize ) )
{
bestsize.left =
bestsize.top = 0 ;
bestsize.right =
bestsize.bottom = 16 ;
return wxSize(bestWidth, bestHeight);
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
bestsize.bottom = 16 ;
}
#if wxUSE_SPINBTN
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
bestsize.bottom = 24 ;
}
#endif
else
{
// return wxWindowBase::DoGetBestSize() ;
}
}
// wx-borders are being drawn outside the native control
bestWidth = bestsize.right - bestsize.left + MacGetLeftBorderSize() +
MacGetRightBorderSize();
bestHeight = bestsize.bottom - bestsize.top + MacGetTopBorderSize() +
MacGetBottomBorderSize();
if ( bestHeight < 10 )
bestHeight = 13 ;
return wxSize(bestWidth, bestHeight);
}
}
// set the size of the window: if the dimensions are positive, just use them,