Avoid painting generic wxDataViewCtrl if it has no columns.

The code in wxDataViewMainWindow::OnPaint() relied on having at least the
first column and didn't work for a completely empty control. Just don't paint
it at all in this case as it's unnecessary anyhow.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-12-14 19:17:12 +00:00
parent 46fa86f720
commit f03c22f9b3

View File

@ -1565,6 +1565,13 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
// compute which columns needs to be redrawn
unsigned int cols = GetOwner()->GetColumnCount();
if ( !cols )
{
// we assume that we have at least one column below and painting an
// empty control is unnecessary anyhow
return;
}
unsigned int col_start = 0;
unsigned int x_start;
for (x_start = 0; col_start < cols; col_start++)