+void wxGrid::SetCellOverflow( int row, int col, bool allow )
+{
+ if ( CanHaveAttributes() )
+ {
+ wxGridCellAttr *attr = GetOrCreateCellAttr(row, col);
+ attr->SetOverflow(allow);
+ attr->DecRef();
+ }
+}
+
+void wxGrid::SetCellSize( int row, int col, int num_rows, int num_cols )
+{
+ if ( CanHaveAttributes() )
+ {
+ int cell_rows, cell_cols;
+
+ wxGridCellAttr *attr = GetOrCreateCellAttr(row, col);
+ attr->GetSize(&cell_rows, &cell_cols);
+ attr->SetSize(num_rows, num_cols);
+ attr->DecRef();
+
+ // Cannot set the size of a cell to 0 or negative values
+ // While it is perfectly legal to do that, this function cannot
+ // handle all the possibilies, do it by hand by getting the CellAttr.
+ // You can only set the size of a cell to 1,1 or greater with this fn
+ wxASSERT_MSG( !((cell_rows < 1) || (cell_cols < 1)),
+ wxT("wxGrid::SetCellSize setting cell size that is already part of another cell"));
+ wxASSERT_MSG( !((num_rows < 1) || (num_cols < 1)),
+ wxT("wxGrid::SetCellSize setting cell size to < 1"));
+
+ // if this was already a multicell then "turn off" the other cells first
+ if ((cell_rows > 1) || (cell_rows > 1))
+ {
+ int i, j;
+ for (j=row; j<row+cell_rows; j++)
+ {
+ for (i=col; i<col+cell_cols; i++)
+ {
+ if ((i != col) || (j != row))
+ {
+ wxGridCellAttr *attr_stub = GetOrCreateCellAttr(j, i);
+ attr_stub->SetSize( 1, 1 );
+ attr_stub->DecRef();
+ }
+ }
+ }
+ }
+
+ // mark the cells that will be covered by this cell to
+ // negative or zero values to point back at this cell
+ if (((num_rows > 1) || (num_cols > 1)) && (num_rows >= 1) && (num_cols >= 1))
+ {
+ int i, j;
+ for (j=row; j<row+num_rows; j++)
+ {
+ for (i=col; i<col+num_cols; i++)
+ {
+ if ((i != col) || (j != row))
+ {
+ wxGridCellAttr *attr_stub = GetOrCreateCellAttr(j, i);
+ attr_stub->SetSize( row-j, col-i );
+ attr_stub->DecRef();
+ }
+ }
+ }
+ }
+ }
+}
+