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:
		@@ -825,11 +825,17 @@ void wxPropertyGrid::SetExtraStyle( long exStyle )
 | 
				
			|||||||
// returns the best acceptable minimal size
 | 
					// returns the best acceptable minimal size
 | 
				
			||||||
wxSize wxPropertyGrid::DoGetBestSize() const
 | 
					wxSize wxPropertyGrid::DoGetBestSize() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int hei = 15;
 | 
					    int lineHeight = wxMax(15, m_lineHeight);
 | 
				
			||||||
    if ( m_lineHeight > hei )
 | 
					 | 
				
			||||||
        hei = m_lineHeight;
 | 
					 | 
				
			||||||
    wxSize sz = wxSize( 60, hei+40 );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 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);
 | 
					    CacheBestSize(sz);
 | 
				
			||||||
    return sz;
 | 
					    return sz;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user