+ wxCHECK_MSG( node != NULL, false, "item not found" );
+ wxCHECK_MSG( node->GetChildren().Index( item.GetID() ) != wxNOT_FOUND, false, "item not found" );
+
+ int sub = -1;
+ node->GetChildren().Remove( item.GetID() );
+ //Manuplate selection
+ if( m_selection.GetCount() > 1 )
+ {
+ m_selection.Empty();
+ }
+ bool isContainer = false;
+ wxDataViewTreeNodes nds = node->GetNodes();
+ for (size_t i = 0; i < nds.GetCount(); i ++)
+ {
+ if (nds[i]->GetItem() == item)
+ {
+ isContainer = true;
+ break;
+ }
+ }
+ if( isContainer )
+ {
+ wxDataViewTreeNode * n = NULL;
+ wxDataViewTreeNodes nodes = node->GetNodes();
+ int len = nodes.GetCount();
+ for( int i = 0 ; i < len; i ++)
+ {
+ if( nodes[i]->GetItem() == item )
+ {
+ n = nodes[i];
+ break;
+ }
+ }
+
+ wxCHECK_MSG( n != NULL, false, "item not found" );
+
+ node->GetNodes().Remove( n );
+ sub -= n->GetSubTreeCount();
+ DestroyTreeHelper(n);
+ }
+ //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() )
+ m_currentRow = m_count - 1;
+
+ UpdateDisplay();
+
+ return true;
+}
+
+bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item)
+{
+ SortPrepare();
+ g_model->Resort();
+
+ //Send event
+ wxWindow *parent = GetParent();
+ wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
+ le.SetEventObject(parent);
+ le.SetModel(GetOwner()->GetModel());
+ le.SetItem(item);
+ parent->GetEventHandler()->ProcessEvent(le);
+
+ return true;
+}
+
+bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned int col )
+{
+ // NOTE: to be valid, we cannot use e.g. INT_MAX - 1
+/*#define MAX_VIRTUAL_WIDTH 100000
+
+ wxRect rect( 0, row*m_lineHeight, MAX_VIRTUAL_WIDTH, m_lineHeight );
+ m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
+ Refresh( true, &rect );
+
+ return true;
+*/
+ SortPrepare();
+ g_model->Resort();
+
+ //Send event
+ wxWindow *parent = GetParent();
+ wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, parent->GetId());
+ le.SetEventObject(parent);
+ le.SetModel(GetOwner()->GetModel());
+ le.SetItem(item);
+ le.SetColumn(col);
+ le.SetDataViewColumn(GetOwner()->GetColumn(col));
+ parent->GetEventHandler()->ProcessEvent(le);