return better fitting size from DoGetBestSize() for grids with few rows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60046 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-04-06 22:11:48 +00:00
parent 4f64fde785
commit 916533c0dc

View File

@@ -825,11 +825,17 @@ void wxPropertyGrid::SetExtraStyle( long exStyle )
// returns the best acceptable minimal size
wxSize wxPropertyGrid::DoGetBestSize() const
{
int hei = 15;
if ( m_lineHeight > hei )
hei = m_lineHeight;
wxSize sz = wxSize( 60, hei+40 );
int lineHeight = wxMax(15, m_lineHeight);
// don't make the grid too tall (limit height to 10 items) but don't
// make it too small neither
int numLines = wxMin
(
wxMax(m_pState->m_properties->GetChildCount(), 3),
10
);
const wxSize sz = wxSize(60, lineHeight*numLines + 40);
CacheBestSize(sz);
return sz;
}