X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c5c1ea964817e562d1c4b0d89b3937fce28c3f10..01b56a96aeb7f02bab9e28dcb797ae4f99c09662:/src/generic/grid.cpp?ds=sidebyside diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b39338c470..7b99052966 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1127,11 +1127,14 @@ IMPLEMENT_DYNAMIC_CLASS( wxGridStringTable, wxGridTableBase ) wxGridStringTable::wxGridStringTable() : wxGridTableBase() { + m_numCols = 0; } wxGridStringTable::wxGridStringTable( int numRows, int numCols ) : wxGridTableBase() { + m_numCols = numCols; + m_data.Alloc( numRows ); wxArrayString sa; @@ -1141,23 +1144,6 @@ wxGridStringTable::wxGridStringTable( int numRows, int numCols ) m_data.Add( sa, numRows ); } -wxGridStringTable::~wxGridStringTable() -{ -} - -int wxGridStringTable::GetNumberRows() -{ - return m_data.GetCount(); -} - -int wxGridStringTable::GetNumberCols() -{ - if ( m_data.GetCount() > 0 ) - return m_data[0].GetCount(); - else - return 0; -} - wxString wxGridStringTable::GetValue( int row, int col ) { wxCHECK_MSG( (row < GetNumberRows()) && (col < GetNumberCols()), @@ -1327,6 +1313,8 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) } } + m_numCols += numCols; + if ( GetView() ) { wxGridTableMessage msg( this, @@ -1351,6 +1339,8 @@ bool wxGridStringTable::AppendCols( size_t numCols ) m_data[row].Add( wxEmptyString, numCols ); } + m_numCols += numCols; + if ( GetView() ) { wxGridTableMessage msg( this, @@ -1404,16 +1394,23 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) m_colLabels.RemoveAt( colID, nToRm ); } - for ( row = 0; row < curNumRows; row++ ) + if ( numCols >= curNumCols ) { - if ( numCols >= curNumCols ) + for ( row = 0; row < curNumRows; row++ ) { m_data[row].Clear(); } - else + + m_numCols = 0; + } + else // something will be left + { + for ( row = 0; row < curNumRows; row++ ) { m_data[row].RemoveAt( colID, numCols ); } + + m_numCols -= numCols; } if ( GetView() ) @@ -4204,7 +4201,7 @@ wxGrid::SendGridSizeEvent(wxEventType type, // +1 if the event was processed (but not vetoed) // 0 if the event wasn't handled int -wxGrid::SendEvent(wxEventType type, +wxGrid::SendEvent(const wxEventType type, int row, int col, const wxMouseEvent& mouseEv) {