]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
remove wxSOCKET_MAX_EVENT, it is not really necessary and results in gcc warnings...
[wxWidgets.git] / src / generic / datavgen.cpp
index 3f3a3052cdfce32e9d589b8bbeffb48b632872f6..388cd1b52ff26b154decd61de44674e9b2ac6eee 100644 (file)
@@ -91,7 +91,7 @@ public:
 protected:
     // implement/override wxHeaderCtrl functions by forwarding them to the main
     // control
-    virtual wxHeaderColumn& GetColumn(unsigned int idx)
+    virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
     {
         return *(GetOwner()->GetColumn(idx));
     }
@@ -2805,7 +2805,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event )
     {
         case WXK_RETURN:
         {
-            if (m_currentRow > 0)
+            if (m_currentRow >= 0)
             {
                 wxWindow *parent = GetParent();
                 wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, parent->GetId());
@@ -3038,6 +3038,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
             // select single line
             SelectAllRows( false );
             SelectRow( m_lineSelectSingleOnUp, true );
+            SendSelectionChangedEvent( GetItemByRow(m_lineSelectSingleOnUp) );
         }
 
         //Process the event of user clicking the expander
@@ -3523,18 +3524,33 @@ int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
 void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
 {
     wxDataViewSelection selection(wxDataViewSelectionCmp);
+
+    wxDataViewItem last_parent;
+
     int len = sel.GetCount();
     for( int i = 0; i < len; i ++ )
     {
-        int row = m_clientArea->GetRowByItem( sel[i] );
+        wxDataViewItem item = sel[i];
+        wxDataViewItem parent = GetModel()->GetParent( item );
+        if (parent)
+        {
+            if (parent != last_parent)
+                ExpandAncestors(item);
+        }
+        
+        last_parent = parent;
+        int row = m_clientArea->GetRowByItem( item );
         if( row >= 0 )
             selection.Add( static_cast<unsigned int>(row) );
     }
+    
     m_clientArea->SetSelections( selection );
 }
 
 void wxDataViewCtrl::Select( const wxDataViewItem & item )
 {
+    ExpandAncestors( item );
+    
     int row = m_clientArea->GetRowByItem( item );
     if( row >= 0 )
     {
@@ -3658,6 +3674,10 @@ void wxDataViewCtrl::EnsureVisible( int row, int column )
 
 void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn * column )
 {
+    ExpandAncestors( item );
+  
+    m_clientArea->RecalculateDisplay();
+
     int row = m_clientArea->GetRowByItem(item);
     if( row >= 0 )
     {