+ g_model = GetOwner()->GetModel();
+
+ wxDataViewTreeNode * node;
+ wxDataViewItem parent_item = g_model->GetParent( item );
+ node = FindNode(parent_item);
+
+ if( node == NULL || node->GetChildren().Index( item.GetID() ) == wxNOT_FOUND )
+ {
+ return false;
+ }
+
+ int sub = -1;
+ node->GetChildren().Remove( item.GetID() );
+ if( GetOwner()->GetModel()->IsContainer( item ) )
+ {
+ wxDataViewTreeNode * n ;
+ wxDataViewTreeNodes nodes = node->GetNodes();
+ int len = nodes.GetCount();
+ for( int i = 0 ; i < len; i ++)
+ {
+ if( nodes[i]->GetItem() == item )
+ {
+ n = nodes[i];
+ break;
+ }
+ }
+ node->GetNodes().Remove( n );
+ sub -= n->GetSubTreeCount();
+ DestroyTreeHelper(n);
+ }
+
+ if( node->GetChildrenNumber() == 0)
+ node->SetHasChildren( false );
+
+ //Make the row number invalid and get a new valid one when user call GetRowCount
+ m_count = -1;
+ node->ChangeSubTreeCount(sub);
+ //Change the current row to the last row if the current exceed the max row number
+ if( m_currentRow > GetRowCount() )
+ m_currentRow = m_count - 1;
+