Return the kind of cells span from wxGrid::GetCellSize().

Behaviour of GetCellSize() may be very surprising for the unwary as it can
return negative or null "size" of the cell.

Add CellSpan return value to allow the caller to check what kind of cell are
we dealing with easier.

Also document the new return value as well as the function (and matching
SetCellSize()) itself carefully as its behaviour is far from obvious.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-12-27 19:40:41 +00:00
parent 653351d1cc
commit ea99e8e31e
3 changed files with 120 additions and 2 deletions

View File

@@ -7139,11 +7139,21 @@ bool wxGrid::GetCellOverflow( int row, int col ) const
return allow;
}
void wxGrid::GetCellSize( int row, int col, int *num_rows, int *num_cols ) const
wxGrid::CellSpan
wxGrid::GetCellSize( int row, int col, int *num_rows, int *num_cols ) const
{
wxGridCellAttr *attr = GetCellAttr(row, col);
attr->GetSize( num_rows, num_cols );
attr->DecRef();
if ( *num_rows == 1 && *num_cols == 1 )
return CellSpan_None; // just a normal cell
if ( *num_rows < 0 || *num_cols < 0 )
return CellSpan_Inside; // covered by a multi-span cell
// this cell spans multiple cells to its right/bottom
return CellSpan_Main;
}
wxGridCellRenderer* wxGrid::GetCellRenderer(int row, int col) const