wxGridCellEditor* editor = attr->GetEditor(this, row, col);
wxString newval;
- bool changed = editor->EndEdit(oldval, &newval);
+ bool changed = editor->EndEdit(row, col, this, oldval, &newval);
if ( changed && SendEvent(wxEVT_GRID_CELL_CHANGING, newval) != -1 )
{
rect.width += GetColWidth(i);
for (i=row; i < row + cell_rows; i++)
rect.height += GetRowHeight(i);
- }
- // if grid lines are enabled, then the area of the cell is a bit smaller
- if (m_gridLinesEnabled)
- {
- rect.width -= 1;
- rect.height -= 1;
+ // if grid lines are enabled, then the area of the cell is a bit smaller
+ if (m_gridLinesEnabled)
+ {
+ rect.width -= 1;
+ rect.height -= 1;
+ }
}
return rect;
m_selectedBlockBottomRight =
m_selectedBlockCorner = wxGridNoCellCoords;
- Refresh( false, &r1 );
- Refresh( false, &r2 );
+ if ( !r1.IsEmpty() )
+ RefreshRect(r1, false);
+ if ( !r2.IsEmpty() )
+ RefreshRect(r2, false);
if ( m_selection )
m_selection->ClearSelection();
return resultRect;
}
+void wxGrid::DoSetSizes(const wxGridSizesInfo& sizeInfo,
+ const wxGridOperations& oper)
+{
+ BeginBatch();
+ oper.SetDefaultLineSize(this, sizeInfo.m_sizeDefault, true);
+ const int numLines = oper.GetNumberOfLines(this);
+ for ( int i = 0; i < numLines; i++ )
+ {
+ int size = sizeInfo.GetSize(i);
+ if ( size != sizeInfo.m_sizeDefault)
+ oper.SetLineSize(this, i, size);
+ }
+ EndBatch();
+}
+
+void wxGrid::SetColSizes(const wxGridSizesInfo& sizeInfo)
+{
+ DoSetSizes(sizeInfo, wxGridColumnOperations());
+}
+
+void wxGrid::SetRowSizes(const wxGridSizesInfo& sizeInfo)
+{
+ DoSetSizes(sizeInfo, wxGridRowOperations());
+}
+
+wxGridSizesInfo::wxGridSizesInfo(int defSize, const wxArrayInt& allSizes)
+{
+ m_sizeDefault = defSize;
+ for ( size_t i = 0; i < allSizes.size(); i++ )
+ {
+ if ( allSizes[i] != defSize )
+ m_customSizes[i] = allSizes[i];
+ }
+}
+
+int wxGridSizesInfo::GetSize(unsigned pos) const
+{
+ wxUnsignedToIntHashMap::const_iterator it = m_customSizes.find(pos);
+
+ return it == m_customSizes.end() ? m_sizeDefault : it->second;
+}
+
// ----------------------------------------------------------------------------
// drop target
// ----------------------------------------------------------------------------