Fixed bug that made adding a child to a branch (that was previously made empty) impossible

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-04-05 13:40:55 +00:00
parent 2ddfe921f8
commit d2c1ee8a7a

View File

@@ -2458,11 +2458,6 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
//Make the row number invalid and get a new valid one when user call GetRowCount
m_count = -1;
node->ChangeSubTreeCount(sub);
if( node->GetChildrenNumber() == 0)
{
node->GetParent()->GetNodes().Remove( node );
delete node;
}
//Change the current row to the last row if the current exceed the max row number
if( m_currentRow > GetRowCount() )
@@ -3157,22 +3152,28 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item
}
wxDataViewTreeNodes nodes = node->GetNodes();
unsigned int i = 0;
for (; i < nodes.GetCount(); i ++)
unsigned int i;
bool found = false;
for (i = 0; i < nodes.GetCount(); i ++)
{
if (nodes[i]->GetItem() == (**iter))
{
if (nodes[i]->GetItem() == item)
return nodes[i];
node = nodes[i];
found = true;
break;
}
}
if (i == nodes.GetCount())
if (!found)
return NULL;
}
else
return NULL;
}
return node;
return NULL;
}
void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column )