]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treelay.cpp
Applied patch [ 578052 ] Doc/View and recursion problems
[wxWidgets.git] / src / generic / treelay.cpp
index 44ab82d2331d1f8c86a3280c9bb9f7921f10dfbc..701a0f14b7c977ee153f3bd5be407d4ef80a582c 100644 (file)
@@ -21,6 +21,8 @@
 #endif
 
 #ifndef WX_PRECOMP
+#include "wx/dc.h"
+#include "wx/event.h"
 #endif
 
 #if wxUSE_TREELAYOUT
@@ -298,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;