]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
Removed #pragma implementation "appbase.h" which caused duplicate symbols
[wxWidgets.git] / src / generic / grid.cpp
index 541cfcf47b8d338a12a215b54e42560497412a41..c8e79066cdea648267d3ec661c80add202ffaf19 100644 (file)
@@ -602,6 +602,8 @@ void wxGridTextCtrl::OnKeyDown( wxKeyEvent& ev )
         case WXK_DOWN:
         case WXK_LEFT:
         case WXK_RIGHT:
         case WXK_DOWN:
         case WXK_LEFT:
         case WXK_RIGHT:
+        case WXK_PRIOR:
+        case WXK_NEXT:
         case WXK_RETURN:
             if ( m_isCellControl )
             {
         case WXK_RETURN:
             if ( m_isCellControl )
             {
@@ -805,10 +807,9 @@ void wxGrid::Init()
                                          wxGRID_CELLCTRL,
                                          "",
                                          wxPoint(1,1),
                                          wxGRID_CELLCTRL,
                                          "",
                                          wxPoint(1,1),
-                                         wxSize(1,1),
-                                         wxNO_BORDER
+                                         wxSize(1,1)
 #ifdef __WXMSW__
 #ifdef __WXMSW__
-                                         | wxTE_MULTILINE | wxTE_NO_VSCROLL
+                                         , wxTE_MULTILINE | wxTE_NO_VSCROLL
 #endif
                                          );
                                          
 #endif
                                          );
                                          
@@ -1964,6 +1965,12 @@ void wxGrid::OnGridScroll( wxScrollEvent& ev )
 
 void wxGrid::SelectCell( const wxGridCellCoords& coords )
 {
 
 void wxGrid::SelectCell( const wxGridCellCoords& coords )
 {
+    if ( SendEvent( EVT_GRID_SELECT_CELL, coords.GetRow(), coords.GetCol() ) )
+    {
+        // the event has been intercepted - do nothing
+        return;
+    }
+
     wxClientDC dc( this );
 
     if ( m_currentCellCoords != wxGridNoCellCoords )
     wxClientDC dc( this );
 
     if ( m_currentCellCoords != wxGridNoCellCoords )
@@ -3035,13 +3042,13 @@ void wxGrid::DrawCellHighlight( wxDC& dc, int row, int col )
         y = m_rowBottoms[row] - m_rowHeights[row];
         if ( y >= ch ) return;
 
         y = m_rowBottoms[row] - m_rowHeights[row];
         if ( y >= ch ) return;
 
-        dc.SetLogicalFunction( wxXOR );
+        dc.SetLogicalFunction( wxINVERT );
         dc.SetPen( wxPen(GetCellHighlightColour(), 2, wxSOLID) );
         dc.SetBrush( *wxTRANSPARENT_BRUSH );
 
         dc.SetPen( wxPen(GetCellHighlightColour(), 2, wxSOLID) );
         dc.SetBrush( *wxTRANSPARENT_BRUSH );
 
-        dc.DrawRectangle( x, y,
-                          m_colWidths[col] + 2,
-                          m_rowHeights[row] + 2 );
+        dc.DrawRectangle( x-2, y-2,
+                          m_colWidths[col] + 6,
+                          m_rowHeights[row] + 6 );
 
         dc.SetLogicalFunction( wxCOPY );
     }
 
         dc.SetLogicalFunction( wxCOPY );
     }
@@ -3076,7 +3083,8 @@ void wxGrid::DrawCell( int row, int col )
 //
 void wxGrid::HideCurrentCellHighlight( wxDC& dc )
 {
 //
 void wxGrid::HideCurrentCellHighlight( wxDC& dc )
 {
-    if ( m_currentCellHighlighted  &&
+    if ( !m_cellEditCtrlEnabled  &&
+         m_currentCellHighlighted  &&
          m_currentCellCoords != wxGridNoCellCoords )
     {
         DrawCellHighlight( dc, m_currentCellCoords );
          m_currentCellCoords != wxGridNoCellCoords )
     {
         DrawCellHighlight( dc, m_currentCellCoords );
@@ -3089,7 +3097,8 @@ void wxGrid::HideCurrentCellHighlight( wxDC& dc )
 //
 void wxGrid::ShowCurrentCellHighlight( wxDC& dc )
 {
 //
 void wxGrid::ShowCurrentCellHighlight( wxDC& dc )
 {
-    if ( !m_currentCellHighlighted  &&
+    if ( !m_cellEditCtrlEnabled  &&
+         !m_currentCellHighlighted  &&
          m_currentCellCoords != wxGridNoCellCoords )
     {
         DrawCellHighlight( dc, m_currentCellCoords );
          m_currentCellCoords != wxGridNoCellCoords )
     {
         DrawCellHighlight( dc, m_currentCellCoords );
@@ -3587,6 +3596,9 @@ void wxGrid::EnableCellEditControl( bool enable )
     if ( m_cellEditCtrl &&
          enable != m_cellEditCtrlEnabled )
     {
     if ( m_cellEditCtrl &&
          enable != m_cellEditCtrlEnabled )
     {
+        wxClientDC dc( this );
+        
+        HideCurrentCellHighlight( dc );
         HideCellEditControl();
         SaveEditControlValue();
         
         HideCellEditControl();
         SaveEditControlValue();
         
@@ -3594,6 +3606,7 @@ void wxGrid::EnableCellEditControl( bool enable )
 
         SetEditControlValue();
         ShowCellEditControl();
 
         SetEditControlValue();
         ShowCellEditControl();
+        ShowCurrentCellHighlight( dc );
     }
 }
 
     }
 }