]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
Implement wxWindowDC::Clear()
[wxWidgets.git] / src / generic / grid.cpp
index 511bed5c935016481e9c6984b8504de19d674d7f..068d735b617fa0188c905625fc73e07bdbb5cccb 100644 (file)
@@ -3913,14 +3913,19 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
 {
     if ( m_created )
     {
-        if (m_ownTable) 
-            delete m_table; 
+        // stop all processing 
+        m_created = FALSE; 
+
+        if (m_ownTable)
+        {
+            wxGridTableBase *t=m_table;
+            m_table=0;
+            delete t; 
+        }
         delete m_selection; 
  
-        // stop all processing 
         m_table=0; 
         m_selection=0; 
-        m_created = FALSE; 
         m_numRows=0; 
         m_numCols=0; 
     }
@@ -5770,7 +5775,6 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
             DisableCellEditControl();
 
         bool done = m_table->InsertRows( pos, numRows );
-        m_numRows = m_table->GetNumberRows();
         return done;
 
         // the table will have sent the results of the insert row
@@ -5793,7 +5797,6 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) )
     if ( m_table )
     {
         bool done = m_table && m_table->AppendRows( numRows );
-        m_numRows = m_table->GetNumberRows();
         return done;
         // the table will have sent the results of the append row
         // operation to this view object as a grid table message
@@ -5818,7 +5821,6 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
             DisableCellEditControl();
 
         bool done = m_table->DeleteRows( pos, numRows );
-        m_numRows = m_table->GetNumberRows();
         return done;
         // the table will have sent the results of the delete row
         // operation to this view object as a grid table message
@@ -5843,7 +5845,6 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) )
             DisableCellEditControl();
 
         bool done = m_table->InsertCols( pos, numCols );
-        m_numCols = m_table->GetNumberCols();
         return done;
         // the table will have sent the results of the insert col
         // operation to this view object as a grid table message
@@ -5865,7 +5866,6 @@ bool wxGrid::AppendCols( int numCols, bool WXUNUSED(updateLabels) )
     if ( m_table )
     {
         bool done = m_table->AppendCols( numCols );
-        m_numCols = m_table->GetNumberCols();
         return done;
         // the table will have sent the results of the append col
         // operation to this view object as a grid table message
@@ -5890,7 +5890,6 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) )
             DisableCellEditControl();
 
         bool done = m_table->DeleteCols( pos, numCols );
-        m_numCols = m_table->GetNumberCols();
         return done;
         // the table will have sent the results of the delete col
         // operation to this view object as a grid table message
@@ -9378,27 +9377,27 @@ void wxGrid::SetColSize( int col, int width )
 void wxGrid::SetColMinimalWidth( int col, int width )
 {
     if (width > GetColMinimalAcceptableWidth()) {
-        m_colMinWidths.Put(col, width);
+        m_colMinWidths[col] = width;
     }
 }
 
 void wxGrid::SetRowMinimalHeight( int row, int width )
 {
     if (width > GetRowMinimalAcceptableHeight()) {
-       m_rowMinHeights.Put(row, width);
+       m_rowMinHeights[row] = width;
     }
 }
 
 int wxGrid::GetColMinimalWidth(int col) const
 {
-    long value = m_colMinWidths.Get(col);
-    return value != wxNOT_FOUND ? (int)value : m_minAcceptableColWidth;
+    wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(col);
+    return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth;
 }
 
 int wxGrid::GetRowMinimalHeight(int row) const
 {
-    long value = m_rowMinHeights.Get(row);
-    return value != wxNOT_FOUND ? (int)value : m_minAcceptableRowHeight;
+    wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(row);
+    return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight;
 }
 
 void wxGrid::SetColMinimalAcceptableWidth( int width )