Added overloaded AddChild from contributor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2002-05-12 18:43:46 +00:00
parent 449d48f9e1
commit c42a918295
2 changed files with 27 additions and 0 deletions

View File

@ -131,6 +131,7 @@ public:
virtual long GetClientData(long id) const;
virtual long AddChild(const wxString& name, const wxString& parent = "");
virtual long AddChild(const wxString& name, long parent);
virtual long NameToId(const wxString& name);
// Data members

View File

@ -300,6 +300,32 @@ long wxTreeLayoutStored::AddChild(const wxString& name, const wxString& parent)
return -1;
}
long wxTreeLayoutStored::AddChild(const wxString& name, long parent)
{
if (m_num < (m_maxNodes -1 ) && parent < m_num)
{
long i = -1;
if (parent != -1)
{
i = parent;
}
else
{
m_parentNode = m_num;
}
m_nodes[m_num].m_parentId = i;
m_nodes[m_num].m_name = name;
m_nodes[m_num].m_x = m_nodes[m_num].m_y = 0;
m_nodes[m_num].m_clientData = 0;
m_num ++;
return (m_num - 1);
}
else
return -1;
}
long wxTreeLayoutStored::NameToId(const wxString& name)
{
long i;