Modified keyboard and mouse handling wrt selecting blocks/cells.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2000-03-09 14:25:07 +00:00
parent 4bd87101b3
commit ca4f2b729c

View File

@@ -4243,13 +4243,22 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
if ( coords != wxGridNoCellCoords ) if ( coords != wxGridNoCellCoords )
{ {
if ( !IsSelection() ) if ( event.ControlDown() )
{ {
SelectBlock( coords, coords ); if ( m_selectingKeyboard == wxGridNoCellCoords)
} m_selectingKeyboard = coords;
else SelectBlock ( m_selectingKeyboard, coords );
{ }
SelectBlock( m_currentCellCoords, coords ); else
{
if ( !IsSelection() )
{
SelectBlock( coords, coords );
}
else
{
SelectBlock( m_currentCellCoords, coords );
}
} }
if (! IsVisible(coords)) if (! IsVisible(coords))
@@ -4363,15 +4372,20 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
} }
else else
{ {
m_selection->ToggleCellSelection( coords.GetRow(), if ( event.ControlDown() )
coords.GetCol(), {
event.ControlDown(), m_selection->ToggleCellSelection( coords.GetRow(),
event.ShiftDown(), coords.GetCol(),
event.AltDown(), event.ControlDown(),
event.MetaDown() ); event.ShiftDown(),
m_selectingTopLeft = wxGridNoCellCoords; event.AltDown(),
m_selectingBottomRight = wxGridNoCellCoords; event.MetaDown() );
SetCurrentCell( coords ); m_selectingTopLeft = wxGridNoCellCoords;
m_selectingBottomRight = wxGridNoCellCoords;
m_selectingKeyboard = coords;
}
else
SetCurrentCell( coords );
m_waitForSlowClick = TRUE; m_waitForSlowClick = TRUE;
} }
} }
@@ -6171,8 +6185,11 @@ bool wxGrid::MoveCursorUp( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
{
ClearSelection();
SetCurrentCell( m_currentCellCoords.GetRow() - 1, SetCurrentCell( m_currentCellCoords.GetRow() - 1,
m_currentCellCoords.GetCol() ); m_currentCellCoords.GetCol() );
}
return TRUE; return TRUE;
} }
@@ -6195,8 +6212,11 @@ bool wxGrid::MoveCursorDown( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
{
ClearSelection();
SetCurrentCell( m_currentCellCoords.GetRow() + 1, SetCurrentCell( m_currentCellCoords.GetRow() + 1,
m_currentCellCoords.GetCol() ); m_currentCellCoords.GetCol() );
}
return TRUE; return TRUE;
} }
@@ -6219,8 +6239,11 @@ bool wxGrid::MoveCursorLeft( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
{
ClearSelection();
SetCurrentCell( m_currentCellCoords.GetRow(), SetCurrentCell( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() - 1 ); m_currentCellCoords.GetCol() - 1 );
}
return TRUE; return TRUE;
} }
@@ -6244,8 +6267,11 @@ bool wxGrid::MoveCursorRight( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
SetCurrentCell( m_currentCellCoords.GetRow(), {
ClearSelection();
SetCurrentCell( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() + 1 ); m_currentCellCoords.GetCol() + 1 );
}
return TRUE; return TRUE;
} }
@@ -6366,8 +6392,10 @@ bool wxGrid::MoveCursorUpBlock( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
SetCurrentCell( row, col ); {
ClearSelection();
SetCurrentCell( row, col );
}
return TRUE; return TRUE;
} }
@@ -6427,7 +6455,10 @@ bool wxGrid::MoveCursorDownBlock( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
SetCurrentCell( row, col ); {
ClearSelection();
SetCurrentCell( row, col );
}
return TRUE; return TRUE;
} }
@@ -6488,7 +6519,10 @@ bool wxGrid::MoveCursorLeftBlock( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
SetCurrentCell( row, col ); {
ClearSelection();
SetCurrentCell( row, col );
}
return TRUE; return TRUE;
} }
@@ -6549,7 +6583,10 @@ bool wxGrid::MoveCursorRightBlock( bool expandSelection )
SelectBlock( m_currentCellCoords, m_selectingKeyboard ); SelectBlock( m_currentCellCoords, m_selectingKeyboard );
} }
else else
SetCurrentCell( row, col ); {
ClearSelection();
SetCurrentCell( row, col );
}
return TRUE; return TRUE;
} }