]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
Readded fix to adjust size of rectangles with transparent outline
[wxWidgets.git] / src / generic / grid.cpp
index 58efa2ce3daa9af8f7c692834c2a0320028f3a7b..1c7a6320f010ab14bddd7b26d0464495411185a1 100644 (file)
@@ -1354,117 +1354,6 @@ void wxGridStringTable::SetColLabelValue( int col, const wxString& value )
 
 
 //////////////////////////////////////////////////////////////////////
-
-IMPLEMENT_DYNAMIC_CLASS( wxGridTextCtrl, wxTextCtrl )
-
-BEGIN_EVENT_TABLE( wxGridTextCtrl, wxTextCtrl )
-    EVT_KEY_DOWN( wxGridTextCtrl::OnKeyDown )
-END_EVENT_TABLE()
-
-
-wxGridTextCtrl::wxGridTextCtrl( wxWindow *par,
-                                wxGrid *grid,
-                                bool isCellControl,
-                                wxWindowID id,
-                                const wxString& value,
-                                const wxPoint& pos,
-                                const wxSize& size,
-                                long style )
-        : wxTextCtrl( par, id, value, pos, size, style )
-{
-    m_grid = grid;
-    m_isCellControl = isCellControl;
-}
-
-
-void wxGridTextCtrl::OnKeyDown( wxKeyEvent& event )
-{
-    switch ( event.KeyCode() )
-    {
-#if 0
-        case WXK_ESCAPE:
-            m_grid->SetEditControlValue( startValue );
-            SetInsertionPointEnd();
-            break;
-#else
-        case WXK_ESCAPE:
-            m_grid->EnableCellEditControl( FALSE );
-#endif
-        case WXK_UP:
-        case WXK_DOWN:
-        case WXK_LEFT:
-        case WXK_RIGHT:
-        case WXK_PRIOR:
-        case WXK_NEXT:
-        case WXK_SPACE:
-            if ( m_isCellControl )
-            {
-                // send the event to the parent grid, skipping the
-                // event if nothing happens
-                //
-                event.Skip( m_grid->ProcessEvent( event ) );
-            }
-            else
-            {
-                // default text control response within the top edit
-                // control
-                //
-                event.Skip();
-            }
-            break;
-
-        case WXK_RETURN:
-            if ( m_isCellControl )
-            {
-                if ( !m_grid->ProcessEvent( event ) )
-                {
-#if defined(__WXMOTIF__) || defined(__WXGTK__)
-                    // wxMotif needs a little extra help...
-                    //
-                    int pos = GetInsertionPoint();
-                    wxString s( GetValue() );
-                    s = s.Left(pos) + "\n" + s.Mid(pos);
-                    SetValue(s);
-                    SetInsertionPoint( pos );
-#else
-                    // the other ports can handle a Return key press
-                    //
-                    event.Skip();
-#endif
-                }
-            }
-            break;
-        case WXK_HOME:
-        case WXK_END:
-            if ( m_isCellControl )
-            {
-                // send the event to the parent grid, skipping the
-                // event if nothing happens
-                //
-                event.Skip( m_grid->ProcessEvent( event ) );
-            }
-            else
-            {
-                // default text control response within the top edit
-                // control
-                //
-                event.Skip();
-            }
-            break;
-
-        default:
-            event.Skip();
-    }
-}
-
-void wxGridTextCtrl::SetStartValue( const wxString& s )
-{
-    startValue = s;
-    wxTextCtrl::SetValue(s);
-}
-
-
-
 //////////////////////////////////////////////////////////////////////
 
 IMPLEMENT_DYNAMIC_CLASS( wxGridRowLabelWindow, wxWindow )
@@ -1695,7 +1584,6 @@ void wxGridWindow::OnEraseBackground(wxEraseEvent&)
 
 //////////////////////////////////////////////////////////////////////
 
-#define ID_EDIT_TIMER 1001
 
 IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
 
@@ -1704,7 +1592,6 @@ BEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow )
     EVT_SIZE( wxGrid::OnSize )
     EVT_KEY_DOWN( wxGrid::OnKeyDown )
     EVT_ERASE_BACKGROUND( wxGrid::OnEraseBackground )
-    EVT_TIMER( ID_EDIT_TIMER, wxGrid::OnEditTimer )
 END_EVENT_TABLE()
 
 wxGrid::wxGrid( wxWindow *parent,
@@ -1734,7 +1621,6 @@ wxGrid::~wxGrid()
 
     if (m_ownTable)
         delete m_table;
-    delete m_editTimer;
 }
 
 
@@ -1745,7 +1631,7 @@ wxGrid::~wxGrid()
 void wxGrid::Create()
 {
     m_created = FALSE;    // set to TRUE by CreateGrid
-    m_displayed = FALSE;  // set to TRUE by OnPaint
+    m_displayed = TRUE; // FALSE;  // set to TRUE by OnPaint
 
     m_table        = (wxGridTableBase *) NULL;
     m_ownTable     = FALSE;
@@ -1816,6 +1702,11 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership )
 {
     if ( m_created )
     {
+        // RD: Actually, this should probably be allowed.  I think it would be
+        // nice to be able to switch multiple Tables in and out of a single
+        // View at runtime.  Is there anything in the implmentation that would
+        // prevent this?
+
         wxFAIL_MSG( wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") );
         return FALSE;
     }
@@ -1924,7 +1815,6 @@ void wxGrid::Init()
     m_isDragging = FALSE;
     m_startDragPos = wxDefaultPosition;
 
-    m_editTimer = new wxTimer( this, ID_EDIT_TIMER );
     m_waitForSlowClick = FALSE;
 
     m_rowResizeCursor = wxCursor( wxCURSOR_SIZENS );
@@ -2897,10 +2787,10 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                     if (m_waitForSlowClick && coords == m_currentCellCoords) {
                         EnableCellEditControl(TRUE);
                         ShowCellEditControl();
+                        m_waitForSlowClick = FALSE;
                     }
                     else {
                         SetCurrentCell( coords );
-                        m_editTimer->Start( 1500, TRUE );
                         m_waitForSlowClick = TRUE;
                     }
                 }
@@ -3663,11 +3553,6 @@ void wxGrid::OnEraseBackground(wxEraseEvent&)
 { }
 
 
-void wxGrid::OnEditTimer(wxTimerEvent&)
-{
-    m_waitForSlowClick = FALSE;
-}
-
 
 
 void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
@@ -3687,7 +3572,7 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
 
         // Clear the old current cell highlight
         wxRect r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords);
-       m_currentCellCoords = coords;   // Otherwise refresh redraws the hilit!
+       m_currentCellCoords = coords;   // Otherwise refresh redraws the highlight!
         m_gridWin->Refresh( FALSE, &r );
     }
 
@@ -3697,13 +3582,9 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
 
     if ( m_displayed )
     {
-#if 0
-        ShowCellEditControl();
-#else
         wxClientDC dc(m_gridWin);
         PrepareDC(dc);
         DrawCellHighlight(dc);
-#endif
 
         if ( IsSelection() )
         {
@@ -3820,7 +3701,6 @@ void wxGrid::DrawCellHighlight( wxDC& dc )
 
     dc.SetPen(wxPen(m_gridLineColour, 3, wxSOLID));
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
-    //dc.SetLogicalFunction(wxINVERT);
 
     dc.DrawRectangle(rect);
 }
@@ -4267,6 +4147,8 @@ void wxGrid::HideCellEditControl()
 
 void wxGrid::SetEditControlValue( const wxString& value )
 {
+    // RD: The new Editors get the value from the table themselves now.  This
+    // method can probably be removed...
 }