]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treelay.cpp
Add wxSizer::Detach so we can detach child sizers without deletion.
[wxWidgets.git] / src / generic / treelay.cpp
index 49769d5bd7e8776c28bee1c54127ecd35e2dd6f9..43aae86378cb86390976e20642f3d8cbad25b53c 100644 (file)
@@ -21,7 +21,8 @@
 #endif
 
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
+#include "wx/dc.h"
+#include "wx/event.h"
 #endif
 
 #if wxUSE_TREELAYOUT
@@ -269,7 +270,7 @@ void wxTreeLayoutStored::Initialize(int n)
     int i;
     for (i = 0; i < n; i++)
     {
-        m_nodes[i].m_name = "";
+        m_nodes[i].m_name = wxT("");
         m_nodes[i].m_active = FALSE;
         m_nodes[i].m_parentId = -1;
         m_nodes[i].m_x = 0;
@@ -299,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;
@@ -437,7 +464,7 @@ wxString wxTreeLayoutStored::HitTest(wxMouseEvent& event, wxDC& dc)
         }
     }
 
-    return wxString("");
+    return wxString( wxT("") );
 }
 
 #endif