]> git.saurik.com Git - wxWidgets.git/commitdiff
patch adding DeselectXXX() functions from Roland Scholz <scholz@pb.izm.fhg.de>
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Jan 2001 15:35:46 +0000 (15:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Jan 2001 15:35:46 +0000 (15:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp

index 21ad06b098d4d4c724819726bb03e6fe3e1da52f..2f8296cec44067b047eaf83b3d28c35fff570621 100644 (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 );
index 0dae989bc83365c81efc067c6868f0869b8e8453..7b2b3b3f43da3ead66d8d949de141ff94c39b776 100644 (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() ||