]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct wxDataViewCtrl::IsExpanded and add test for it
authorRobert Roebling <robert@roebling.de>
Wed, 17 Dec 2008 22:26:40 +0000 (22:26 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 17 Dec 2008 22:26:40 +0000 (22:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/dataview/dataview.cpp
src/gtk/dataview.cpp
src/osx/carbon/dataview.cpp

index b72a7e5251176c9a53df4fc1968bbfdaa827e4e5..fe45436b30758ce0cfaef3d1b65efe4a5e9e5cb3 100644 (file)
@@ -1026,6 +1026,9 @@ void MyFrame::OnActivated( wxDataViewEvent &event )
 
     wxString title = m_music_model->GetTitle( event.GetItem() );
     wxLogMessage(wxT("wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, Item: %s"), title );
+    
+    if (m_musicCtrl->IsExpanded( event.GetItem() ))
+    wxLogMessage(wxT("Item: %s is expanded"), title );
 }
 
 void MyFrame::OnSelectionChanged( wxDataViewEvent &event )
index 75849f7fab6e73ecae1a964a5074a7f198966c6b..dc998edd3380305c95b7f9df66698452e4e3b276 100644 (file)
@@ -4018,8 +4018,10 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
     GtkTreeIter iter;
     iter.user_data = item.GetID();
     GtkTreePath *path = m_internal->get_path( &iter );
-    gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path );
+    bool res = gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path );
     gtk_tree_path_free( path );
+    
+    return res;
 }
 
 wxDataViewItem wxDataViewCtrl::GetSelection() const
index 4da4cb3efb4cb5dc790e3bb24a5d17265dce0b11..11ba3ce936dbc5a9145571491a71845501be77b5 100644 (file)
@@ -1210,8 +1210,13 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
   {
     wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(m_peer));
 
-    // TODO ???
-    // This doesn't seem to be supported
+    DataBrowserItemState state = 0;
+    OSStatus err = ::GetDataBrowserItemState( 
+       MacDataViewListCtrlPtr->GetControlRef(), 
+       reinterpret_cast<DataBrowserItemID>(item.GetID()),
+       &state );
+    if ((err == 0) && (state & kDataBrowserContainerIsOpen))
+       return true;
   }
   return false;
 }