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

@@ -4242,6 +4242,14 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
} }
if ( coords != wxGridNoCellCoords ) if ( coords != wxGridNoCellCoords )
{
if ( event.ControlDown() )
{
if ( m_selectingKeyboard == wxGridNoCellCoords)
m_selectingKeyboard = coords;
SelectBlock ( m_selectingKeyboard, coords );
}
else
{ {
if ( !IsSelection() ) if ( !IsSelection() )
{ {
@@ -4251,6 +4259,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
{ {
SelectBlock( m_currentCellCoords, coords ); SelectBlock( m_currentCellCoords, coords );
} }
}
if (! IsVisible(coords)) if (! IsVisible(coords))
{ {
@@ -4362,6 +4371,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
m_waitForSlowClick = FALSE; m_waitForSlowClick = FALSE;
} }
else else
{
if ( event.ControlDown() )
{ {
m_selection->ToggleCellSelection( coords.GetRow(), m_selection->ToggleCellSelection( coords.GetRow(),
coords.GetCol(), coords.GetCol(),
@@ -4371,6 +4382,9 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
event.MetaDown() ); event.MetaDown() );
m_selectingTopLeft = wxGridNoCellCoords; m_selectingTopLeft = wxGridNoCellCoords;
m_selectingBottomRight = wxGridNoCellCoords; m_selectingBottomRight = wxGridNoCellCoords;
m_selectingKeyboard = coords;
}
else
SetCurrentCell( coords ); 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
{
ClearSelection();
SetCurrentCell( m_currentCellCoords.GetRow(), 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
{
ClearSelection();
SetCurrentCell( row, col ); 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
{
ClearSelection();
SetCurrentCell( row, col ); 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
{
ClearSelection();
SetCurrentCell( row, col ); 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
{
ClearSelection();
SetCurrentCell( row, col ); SetCurrentCell( row, col );
}
return TRUE; return TRUE;
} }