patch adding DeselectXXX() functions from Roland Scholz <scholz@pb.izm.fhg.de>

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-01-02 15:35:46 +00:00
parent d3c7cfeba9
commit f7b4b3435b
2 changed files with 52 additions and 0 deletions

View File

@ -1314,6 +1314,12 @@ public:
bool IsSelection();
// ------ deselection
//
void DeselectRow( int row );
void DeselectCol( int col );
void DeselectCell( int row, int col );
void ClearSelection();
bool IsInSelection( int row, int col );

View File

@ -8275,6 +8275,52 @@ void wxGrid::SelectAll()
m_selection->SelectBlock( 0, 0, m_numRows-1, m_numCols-1 );
}
//
// ------ Cell, row and col deselection
//
void wxGrid::DeselectRow( int row )
{
if ( m_selection->GetSelectionMode() == wxGrid::wxGridSelectRows )
{
if ( m_selection->IsInSelection(row, 0 ) )
m_selection->ToggleCellSelection( row, 0);
}
else
{
int nCols = GetNumberCols();
for ( int i = 0; i < nCols ; i++ )
{
if ( m_selection->IsInSelection(row, i ) )
m_selection->ToggleCellSelection( row, i);
}
}
}
void wxGrid::DeselectCol( int col )
{
if ( m_selection->GetSelectionMode() == wxGrid::wxGridSelectColumns )
{
if ( m_selection->IsInSelection(0, col ) )
m_selection->ToggleCellSelection( 0, col);
}
else
{
int nRows = GetNumberRows();
for ( int i = 0; i < nRows ; i++ )
{
if ( m_selection->IsInSelection(i, col ) )
m_selection->ToggleCellSelection(i, col);
}
}
}
void wxGrid::DeselectCell( int row, int col )
{
if ( m_selection->IsInSelection(row, col) )
m_selection->ToggleCellSelection(row, col);
}
bool wxGrid::IsSelection()
{
return ( m_selection->IsSelection() ||