Added wxDataViewModel::GetChildren() (removed GetSibling() and GetFirstChild())

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-08-31 09:44:59 +00:00
parent b04fcede8f
commit 74fe973bba
5 changed files with 37 additions and 68 deletions

View File

@@ -307,29 +307,14 @@ bool wxDataViewIndexListModel::IsContainer( const wxDataViewItem &item ) const
return false;
}
wxDataViewItem wxDataViewIndexListModel::GetFirstChild( const wxDataViewItem &parent ) const
unsigned int wxDataViewIndexListModel::GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const
{
if (!parent.IsOk())
{
if (m_hash.GetCount() == 0)
return wxDataViewItem(0);
if (item.IsOk())
return 0;
return wxDataViewItem( m_hash[0]);
}
return wxDataViewItem(0);
}
wxDataViewItem wxDataViewIndexListModel::GetNextSibling( const wxDataViewItem &item ) const
{
if (!item.IsOk())
return wxDataViewItem(0);
int pos = m_hash.Index( item.GetID() );
if ((pos == wxNOT_FOUND) || (pos == (int) (m_hash.GetCount()-1)))
return wxDataViewItem(0);
return wxDataViewItem( m_hash[pos+1] );
children = m_hash;
return m_hash.GetCount();
}
//-----------------------------------------------------------------------------

View File

@@ -2380,17 +2380,19 @@ void wxDataViewCtrlInternal::BuildBranch( wxGtkTreeModelNode *node )
{
if (node->GetChildCount() == 0)
{
wxDataViewItem child = m_wx_model->GetFirstChild( node->GetItem() );
while (child.IsOk())
wxDataViewItemArray children;
unsigned int count = m_wx_model->GetChildren( node->GetItem(), children );
unsigned int pos;
for (pos = 0; pos < count; pos++)
{
wxDataViewItem child = children[pos];
if (m_wx_model->IsContainer( child ))
node->AddNode( new wxGtkTreeModelNode( node, child, this ) );
else
node->AddLeave( child.GetID() );
// Don't send any events here
child = m_wx_model->GetNextSibling( child );
}
}
}