]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
no_rtti fix was not having correct eval order
[wxWidgets.git] / src / generic / grid.cpp
index 5e2fdb358ca9945c8091f27e1e420668c038bfea..47190211460c7e982582c7540dd204315a7c9a30 100644 (file)
@@ -552,7 +552,7 @@ void wxGridCellEditor::HandleReturn(wxKeyEvent& event)
 bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
 {
     // accept the simple key presses, not anything with Ctrl/Alt/Meta
 bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
 {
     // accept the simple key presses, not anything with Ctrl/Alt/Meta
-    return !(event.ControlDown() || event.AltDown());
+    return !(event.ControlDown() || event.AltDown() || event.GetKeyCode() == WXK_SHIFT);
 }
 
 void wxGridCellEditor::StartingKey(wxKeyEvent& event)
 }
 
 void wxGridCellEditor::StartingKey(wxKeyEvent& event)
@@ -1597,18 +1597,18 @@ void wxGridCellRenderer::Draw(wxGrid& grid,
     // grey out fields if the grid is disabled
     if( grid.IsEnabled() )
     {
     // grey out fields if the grid is disabled
     if( grid.IsEnabled() )
     {
-      if ( isSelected )
-      {
-          dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) );
-      }
-      else
-      {
-          dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
-      }
+        if ( isSelected )
+        {
+            dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) );
+        }
+        else
+        {
+            dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
+        }
     }
     else
     {
     }
     else
     {
-      dc.SetBrush(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
+        dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
     }
 
     dc.SetPen( *wxTRANSPARENT_PEN );
     }
 
     dc.SetPen( *wxTRANSPARENT_PEN );
@@ -1644,8 +1644,8 @@ void wxGridCellStringRenderer::SetTextColoursAndFont(wxGrid& grid,
     }
     else
     {
     }
     else
     {
-      dc.SetTextBackground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE));
-      dc.SetTextForeground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_GRAYTEXT));
+      dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+      dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
     }
 
     dc.SetFont( attr.GetFont() );
     }
 
     dc.SetFont( attr.GetFont() );
@@ -1932,7 +1932,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
     else
     {
         wxString tmp = params.BeforeFirst(_T(','));
     else
     {
         wxString tmp = params.BeforeFirst(_T(','));
-        if ( !!tmp )
+        if ( !tmp.empty() )
         {
             long width;
             if ( tmp.ToLong(&width) )
         {
             long width;
             if ( tmp.ToLong(&width) )
@@ -1946,7 +1946,7 @@ void wxGridCellFloatRenderer::SetParameters(const wxString& params)
 
         }
                 tmp = params.AfterFirst(_T(','));
 
         }
                 tmp = params.AfterFirst(_T(','));
-                if ( !!tmp )
+                if ( !tmp.empty() )
                 {
                     long precision;
             if ( tmp.ToLong(&precision) )
                 {
                     long precision;
             if ( tmp.ToLong(&precision) )
@@ -2431,7 +2431,9 @@ void wxGridCellAttrData::UpdateAttrRows( size_t pos, int numRows )
                 else
                 {
                     // ...or remove the attribute
                 else
                 {
                     // ...or remove the attribute
-                    m_attrs.RemoveAt((size_t)n);
+                    // No need to DecRef the attribute itself since this is
+                    // done be wxGridCellWithAttr's destructor!
+                    m_attrs.RemoveAt(n);
                     n--; count--;
                 }
             }
                     n--; count--;
                 }
             }
@@ -2464,7 +2466,9 @@ void wxGridCellAttrData::UpdateAttrCols( size_t pos, int numCols )
                 else
                 {
                     // ...or remove the attribute
                 else
                 {
                     // ...or remove the attribute
-                    m_attrs.RemoveAt((size_t)n);
+                    // No need to DecRef the attribute itself since this is
+                    // done be wxGridCellWithAttr's destructor!
+                    m_attrs.RemoveAt(n);
                     n--; count--;
                 }
             }
                     n--; count--;
                 }
             }
@@ -2562,8 +2566,9 @@ void wxGridRowOrColAttrData::UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols
                     rowOrCol += numRowsOrCols;
                 else
                 {
                     rowOrCol += numRowsOrCols;
                 else
                 {
-                    m_rowsOrCols.RemoveAt((size_t)n);
-                    m_attrs.RemoveAt((size_t)n);
+                    m_rowsOrCols.RemoveAt(n);
+                    m_attrs[n]->DecRef();
+                    m_attrs.RemoveAt(n);
                     n--; count--;
                 }
             }
                     n--; count--;
                 }
             }
@@ -3653,7 +3658,7 @@ void wxGridCornerLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) )
     rect.SetY( 1 );
     rect.SetWidth( client_width - 2 );
     rect.SetHeight( client_height - 2 );
     rect.SetY( 1 );
     rect.SetWidth( client_width - 2 );
     rect.SetHeight( client_height - 2 );
-    
+
     wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
 #else
     dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
     wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
 #else
     dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
@@ -7220,9 +7225,9 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row )
     rect.SetY( GetRowTop(row) + 1 );
     rect.SetWidth( m_rowLabelWidth - 2 );
     rect.SetHeight( GetRowHeight(row) - 2 );
     rect.SetY( GetRowTop(row) + 1 );
     rect.SetWidth( m_rowLabelWidth - 2 );
     rect.SetHeight( GetRowHeight(row) - 2 );
-    
+
     CalcScrolledPosition( 0, rect.y, NULL, &rect.y );
     CalcScrolledPosition( 0, rect.y, NULL, &rect.y );
-    
+
     wxWindowDC *win_dc = (wxWindowDC*) &dc;
 
     wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
     wxWindowDC *win_dc = (wxWindowDC*) &dc;
 
     wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
@@ -7277,14 +7282,14 @@ void wxGrid::DrawColLabel( wxDC& dc, int col )
         return;
 
     int colLeft = GetColLeft(col);
         return;
 
     int colLeft = GetColLeft(col);
-    
+
     wxRect rect;
 #ifdef __WXGTK__
     rect.SetX( colLeft + 1 );
     rect.SetY( 1 );
     rect.SetWidth( GetColWidth(col) - 2 );
     rect.SetHeight( m_colLabelHeight - 2 );
     wxRect rect;
 #ifdef __WXGTK__
     rect.SetX( colLeft + 1 );
     rect.SetY( 1 );
     rect.SetWidth( GetColWidth(col) - 2 );
     rect.SetHeight( m_colLabelHeight - 2 );
-    
+
     wxWindowDC *win_dc = (wxWindowDC*) &dc;
 
     wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
     wxWindowDC *win_dc = (wxWindowDC*) &dc;
 
     wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
@@ -7519,6 +7524,16 @@ void wxGrid::ForceRefresh()
     EndBatch();
 }
 
     EndBatch();
 }
 
+bool wxGrid::Enable(bool enable)
+{
+    if ( !wxScrolledWindow::Enable(enable) )
+        return false;
+
+    // redraw in the new state
+    m_gridWin->Refresh();
+
+    return true;
+}
 
 //
 // ------ Edit control functions
 
 //
 // ------ Edit control functions
@@ -10181,7 +10196,7 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
     }
     else
     {
     }
     else
     {
-        rect = wxRect( 0, 0, 0, 0 );
+        rect = wxRect(0,0,0,0);
     }
 
     cellRect = CellToRect( bottomRight );
     }
 
     cellRect = CellToRect( bottomRight );
@@ -10256,7 +10271,7 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
     m_gridWin->GetClientSize( &cw, &ch );
 
     if (right < 0 || bottom < 0 || left > cw || top > ch)
     m_gridWin->GetClientSize( &cw, &ch );
 
     if (right < 0 || bottom < 0 || left > cw || top > ch)
-        return wxRect( 0, 0, 0, 0);
+        return wxRect(0,0,0,0);
 
     rect.SetLeft( wxMax(0, left) );
     rect.SetTop( wxMax(0, top) );
 
     rect.SetLeft( wxMax(0, left) );
     rect.SetTop( wxMax(0, top) );