]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
Add some new files for interface additions
[wxWidgets.git] / src / generic / treectlg.cpp
index c65b85bf946f3f383a69966488fb1c5e6e1187cd..e45f6f08f74d9b5bf0955331a65788c8d3034c09 100644 (file)
@@ -615,6 +615,8 @@ void wxGenericTreeCtrl::Init()
 
     m_imageListNormal =
     m_imageListState = (wxImageList *) NULL;
+    m_ownsImageListNormal = 
+    m_ownsImageListState = FALSE;
 
     m_dragCount = 0;
     m_isDragging = FALSE;
@@ -658,6 +660,8 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl()
     DeleteAllItems();
 
     delete m_renameTimer;
+    if (m_ownsImageListNormal) delete m_imageListNormal;
+    if (m_ownsImageListState) delete m_imageListState;
 }
 
 // -----------------------------------------------------------------------------
@@ -1629,7 +1633,10 @@ wxImageList *wxGenericTreeCtrl::GetStateImageList() const
 
 void wxGenericTreeCtrl::SetImageList(wxImageList *imageList)
 {
+    if (m_ownsImageListNormal) delete m_imageListNormal;
+
     m_imageListNormal = imageList;
+    m_ownsImageListNormal = FALSE;
 
     if ( !m_imageListNormal )
         return;
@@ -1656,7 +1663,21 @@ void wxGenericTreeCtrl::SetImageList(wxImageList *imageList)
 
 void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList)
 {
+    if (m_ownsImageListState) delete m_imageListState;
     m_imageListState = imageList;
+    m_ownsImageListState = FALSE;
+}
+
+void wxGenericTreeCtrl::AssignImageList(wxImageList *imageList)
+{
+    SetImageList(imageList);
+    m_ownsImageListNormal = TRUE;
+}
+
+void wxGenericTreeCtrl::AssignStateImageList(wxImageList *imageList)
+{
+    SetStateImageList(imageList);
+    m_ownsImageListState = TRUE;
 }
 
 // -----------------------------------------------------------------------------
@@ -2422,6 +2443,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
                      (flags & wxTREE_HITTEST_ONITEMLABEL) &&
                      HasFlag(wxTR_EDIT_LABELS) )
                 {
+                    if ( m_renameTimer->IsRunning() )
+                        m_renameTimer->Stop();
+
                     m_renameTimer->Start( 100, TRUE );
                 }