// View at runtime. Is there anything in the implmentation that would
// prevent this?
- // At least, you now have to copy with m_selection
+ // At least, you now have to cope with m_selection
wxFAIL_MSG( wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") );
return FALSE;
}
m_selection->SelectBlock( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol(),
coords.GetRow(),
- coords.GetCol() );
+ coords.GetCol(),
+ event.ControlDown(),
+ event.ShiftDown(),
+ event.AltDown(),
+ event.MetaDown() );
}
else if ( XToEdgeOfCol(x) < 0 &&
YToEdgeOfRow(y) < 0 )
else
{
m_selection->ToggleCellSelection( coords.GetRow(),
- coords.GetCol() );
+ coords.GetCol(),
+ event.ControlDown(),
+ event.ShiftDown(),
+ event.AltDown(),
+ event.MetaDown() );
m_selectingTopLeft = wxGridNoCellCoords;
m_selectingBottomRight = wxGridNoCellCoords;
SetCurrentCell( coords );
m_selectingTopLeft.GetCol(),
m_selectingBottomRight.GetRow(),
m_selectingBottomRight.GetCol(),
- & event );
+ event.ControlDown(),
+ event.ShiftDown(),
+ event.AltDown(),
+ event.MetaDown() );
m_selectingTopLeft = wxGridNoCellCoords;
m_selectingBottomRight = wxGridNoCellCoords;
}
type,
this,
row, col,
- false,
+ FALSE,
mouseEv.GetX(), mouseEv.GetY(),
mouseEv.ControlDown(),
mouseEv.ShiftDown(),
// try local handlers
//
+ if ( !event.ShiftDown() &&
+ m_selectingKeyboard != wxGridNoCellCoords )
+ {
+ m_selection->SelectBlock( m_selectingTopLeft.GetRow(),
+ m_selectingTopLeft.GetCol(),
+ m_selectingBottomRight.GetRow(),
+ m_selectingBottomRight.GetCol(),
+ event.ControlDown(),
+ event.ShiftDown(),
+ event.AltDown(),
+ event.MetaDown() );
+ m_selectingTopLeft = wxGridNoCellCoords;
+ m_selectingBottomRight = wxGridNoCellCoords;
+ m_selectingKeyboard = wxGridNoCellCoords;
+ }
+
switch ( event.KeyCode() )
{
case WXK_UP:
MovePageDown();
break;
-#if 0
+#if 1
case WXK_SPACE:
if ( !IsEditable() )
{
#else
case WXK_SPACE:
m_selection->ToggleCellSelection( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
+ m_currentCellCoords.GetCol(),
+ event.ControlDown(),
+ event.ShiftDown(),
+ event.AltDown(),
+ event.MetaDown() );
break;
#endif
m_inOnKeyDown = FALSE;
}
-
void wxGrid::OnEraseBackground(wxEraseEvent&)
{
}
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetRow() > 0 )
{
- if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
-
MakeCellVisible( m_currentCellCoords.GetRow() - 1,
- m_currentCellCoords.GetCol() );
-
- SetCurrentCell( m_currentCellCoords.GetRow() - 1,
- m_currentCellCoords.GetCol() );
-
+ m_currentCellCoords.GetCol() );
if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
+ {
+ if ( m_selectingKeyboard == wxGridNoCellCoords )
+ m_selectingKeyboard = m_currentCellCoords;
+ m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() - 1 );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( m_currentCellCoords.GetRow() - 1,
+ m_currentCellCoords.GetCol() );
return TRUE;
}
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetRow() < m_numRows-1 )
{
- if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
-
MakeCellVisible( m_currentCellCoords.GetRow() + 1,
- m_currentCellCoords.GetCol() );
-
- SetCurrentCell( m_currentCellCoords.GetRow() + 1,
- m_currentCellCoords.GetCol() );
-
+ m_currentCellCoords.GetCol() );
if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
+ {
+ if ( m_selectingKeyboard == wxGridNoCellCoords )
+ m_selectingKeyboard = m_currentCellCoords;
+ m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( m_currentCellCoords.GetRow() + 1,
+ m_currentCellCoords.GetCol() );
return TRUE;
}
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetCol() > 0 )
{
- if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
-
MakeCellVisible( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() - 1 );
-
- SetCurrentCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() - 1 );
-
+ m_currentCellCoords.GetCol() - 1 );
if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
+ {
+ if ( m_selectingKeyboard == wxGridNoCellCoords )
+ m_selectingKeyboard = m_currentCellCoords;
+ m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() - 1 );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() - 1 );
return TRUE;
}
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetCol() < m_numCols - 1 )
{
- if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
-
MakeCellVisible( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() + 1 );
- SetCurrentCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() + 1 );
-
if ( expandSelection )
- m_selection->SelectCell( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol() );
+ {
+ if ( m_selectingKeyboard == wxGridNoCellCoords )
+ m_selectingKeyboard = m_currentCellCoords;
+ m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() + 1 );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() + 1 );
return TRUE;
}
MakeCellVisible( row, col );
if ( expandSelection )
- m_selection->SelectBlock( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol(),
- row, col );
- SetCurrentCell( row, col );
+ {
+ m_selectingKeyboard = wxGridCellCoords( row, col );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( row, col );
return TRUE;
}
MakeCellVisible( row, col );
if ( expandSelection )
- m_selection->SelectBlock( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol(),
- row, col );
- SetCurrentCell( row, col );
+ {
+ m_selectingKeyboard = wxGridCellCoords( row, col );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( row, col );
return TRUE;
}
MakeCellVisible( row, col );
if ( expandSelection )
- m_selection->SelectBlock( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol(),
- row, col );
- SetCurrentCell( row, col );
+ {
+ m_selectingKeyboard = wxGridCellCoords( row, col );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( row, col );
return TRUE;
}
MakeCellVisible( row, col );
if ( expandSelection )
- m_selection->SelectBlock( m_currentCellCoords.GetRow(),
- m_currentCellCoords.GetCol(),
- row, col );
- SetCurrentCell( row, col );
+ {
+ m_selectingKeyboard = wxGridCellCoords( row, col );
+ SelectBlock( m_currentCellCoords, m_selectingKeyboard );
+ }
+ else
+ SetCurrentCell( row, col );
return TRUE;
}