- dc.BeginDrawing();
- grid->SetGridClippingRegion(& dc);
- grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
- grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
- grid->HighlightCell(& dc);
- dc.DestroyClippingRegion();
- dc.EndDrawing();
-
- grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
-
-// grid->DrawCellText();
- }
+ if (!m_editInPlace) {
+ wxClientDC dc(grid);
+
+ dc.BeginDrawing();
+ grid->SetGridClippingRegion(& dc);
+ grid->DrawCellBackground(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
+ grid->DrawCellValue(& dc, &grid->GetCurrentRect(), grid->GetCursorRow(), grid->GetCursorColumn());
+ grid->HighlightCell(& dc, TRUE);
+ dc.DestroyClippingRegion();
+ dc.EndDrawing();
+ }
+
+ //grid->OnCellChange(grid->GetCursorRow(), grid->GetCursorColumn());
+ wxGridEvent g_evt(GetId(), wxEVT_GRID_CELL_CHANGE, grid,
+ grid->GetCursorRow(), grid->GetCursorColumn());
+ GetEventHandler()->ProcessEvent(g_evt);
+
+ // grid->DrawCellText();
+ }
+ }
+}
+
+void wxGenericGrid::OnTextEnter(wxCommandEvent& WXUNUSED(ev) )
+{
+ // move the cursor down the current row (if possible)
+ // when the enter key has been pressed
+ //
+ if ( m_editable )
+ {
+ if ( GetCursorRow() < GetRows()-1 )
+ {
+ wxClientDC dc( this );
+ dc.BeginDrawing();
+ OnSelectCellImplementation(& dc,
+ GetCursorRow()+1,
+ GetCursorColumn() );
+ dc.EndDrawing();
+ }
+ }
+}
+
+void wxGenericGrid::OnTextInPlace(wxCommandEvent& ev )
+{
+ if ( m_editable )
+ {
+ wxGenericGrid *grid = this;
+ wxGridCell *cell = grid->GetCell(grid->GetCursorRow(), grid->GetCursorColumn());
+ if (cell && grid->CurrentCellVisible())
+ {
+ m_inOnTextInPlace = TRUE;
+ grid->GetTextItem()->SetValue( m_inPlaceTextItem->GetValue() );
+ OnText( ev );
+ m_inOnTextInPlace = FALSE;
+ }
+ }
+}
+
+void wxGenericGrid::OnTextInPlaceEnter(wxCommandEvent& WXUNUSED(ev) )
+{
+ // move the cursor down the current row (if possible)
+ // when the enter key has been pressed
+ //
+ if ( m_editable )
+ {
+ if ( GetCursorRow() < GetRows()-1 )
+ {
+ wxClientDC dc( this );
+ dc.BeginDrawing();
+ OnSelectCellImplementation(& dc,
+ GetCursorRow()+1,
+ GetCursorColumn() );
+ dc.EndDrawing();
+ }
+ }