]> git.saurik.com Git - wxWidgets.git/commitdiff
Added overloaded AddChild from contributor
authorJulian Smart <julian@anthemion.co.uk>
Sun, 12 May 2002 18:43:46 +0000 (18:43 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 12 May 2002 18:43:46 +0000 (18:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/treelay.h
src/generic/treelay.cpp

index 9113f78f8a3239876a5aede8218b694042cec3cf..875b4a0129341ea2ce77e56f0151ae9e568d46b2 100644 (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
index fa5db2eceae911c21d4f21a26652b0ce08e2e1c8..701a0f14b7c977ee153f3bd5be407d4ef80a582c 100644 (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;