]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
define arrays of chartoo as the existing ones can't be used to store char values...
[wxWidgets.git] / src / generic / grid.cpp
index 623586fbe1a78a95a240169196f5f3d2c21f1286..a921b3817c8abc1f9b84fa0dacd225a8fe282fe7 100644 (file)
@@ -1341,7 +1341,19 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
     else
     {
         wxString cellval( grid->GetTable()->GetValue(row, col) );
-        m_startValue = !( !cellval || (cellval == wxT("0")) );
+
+        if ( cellval == ms_stringValues[false] )
+            m_startValue = false;
+        else if ( cellval == ms_stringValues[true] )
+            m_startValue = true;
+        else
+        {
+            // do not try to be smart here and convert it to true or false
+            // because we'll still overwrite it with something different and
+            // this risks to be very surprising for the user code, let them
+            // know about it
+            wxFAIL_MSG( _T("invalid value for a cell with bool editor!") );
+        }
     }
 
     CBox()->SetValue(m_startValue);
@@ -4151,7 +4163,7 @@ wxGrid::wxGrid( wxWindow *parent,
     m_rowMinHeights(GRID_HASH_SIZE)
 {
     Create();
-    SetBestFittingSize(size);
+    SetInitialSize(size);
 }
 
 bool wxGrid::Create(wxWindow *parent, wxWindowID id,
@@ -4166,7 +4178,7 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
     m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
 
     Create();
-    SetBestFittingSize(size);
+    SetInitialSize(size);
 
     return true;
 }
@@ -7696,10 +7708,10 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
-    for (j=topRow; j<bottomRow; j++)
+    for (j=topRow; j<=bottomRow; j++)
     {
         int colPos;
-        for (colPos=leftCol; colPos<rightCol; colPos++)
+        for (colPos=leftCol; colPos<=rightCol; colPos++)
         {
             i = GetColAt( colPos );
 
@@ -7724,9 +7736,9 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     int i, j, cell_rows, cell_cols;
     wxRect rect;
 
-    for (j=topRow; j<bottomRow; j++)
+    for (j=topRow; j<=bottomRow; j++)
     {
-        for (i=leftCol; i<rightCol; i++)
+        for (i=leftCol; i<=rightCol; i++)
         {
             GetCellSize( j, i, &cell_rows, &cell_cols );
             if ((cell_rows > 1) || (cell_cols > 1))