Correct minor bishaviours in Expand() and Collapse()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59379 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-03-06 19:32:07 +00:00
parent d2ee27fe25
commit 7d83595849

View File

@@ -2957,10 +2957,13 @@ void wxDataViewMainWindow::OnExpanding( unsigned int row )
}
else
{
#if 0
// Why should we select the next row here???
SelectRow( row, false );
SelectRow( row + 1, true );
ChangeCurrentRow( row + 1 );
SendSelectionChangedEvent( GetItemByRow(row+1));
#endif
}
}
else
@@ -2974,9 +2977,14 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row)
return;
wxDataViewTreeNode *node = GetTreeNodeByRow(row);
if( node != NULL )
if (!node)
return;
if( !node->HasChildren())
{
wxDataViewTreeNode * nd = node;
delete node;
return;
}
if( node->HasChildren() && node->IsOpen() )
{
@@ -3035,7 +3043,7 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row)
m_count = -1;
UpdateDisplay();
SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,nd->GetItem());
SendExpanderEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,node->GetItem());
}
else
{
@@ -3052,9 +3060,6 @@ void wxDataViewMainWindow::OnCollapsing(unsigned int row)
}
}
}
if( !nd->HasChildren())
delete nd;
}
}
wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item )
@@ -4313,6 +4318,7 @@ void wxDataViewCtrl::Expand( const wxDataViewItem & item )
void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
{
int row = m_clientArea->GetRowByItem( item );
wxPrintf( "row %d\n", row );
if (row != -1)
m_clientArea->Collapse(row);
}