]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
added support for several new events in wxCalendarCtrl: clicking on week
[wxWidgets.git] / src / msw / treectrl.cpp
index a350654153a8635d06943ca954d22750077baaa6..a470179ed7543ce82ae45b30967d845aeb6f8dc0 100644 (file)
@@ -230,9 +230,7 @@ private:
 // macros
 // ----------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
-#endif
 
 // ----------------------------------------------------------------------------
 // variables
@@ -1054,6 +1052,30 @@ wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent,
     return DoInsertItem(parent, idPrevious, text, image, selectedImage, data);
 }
 
+wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent,
+                                    size_t index,
+                                    const wxString& text,
+                                    int image, int selectedImage,
+                                    wxTreeItemData *data)
+{
+    // find the item from index
+    long cookie;
+    wxTreeItemId idPrev, idCur = GetFirstChild(parent, cookie);
+    while ( index != 0 && idCur.IsOk() )
+    {
+        index--;
+
+        idPrev = idCur;
+        idCur = GetNextChild(parent, cookie);
+    }
+
+    // assert, not check: if the index is invalid, we will append the item
+    // to the end
+    wxASSERT_MSG( index == 0, _T("bad index in wxTreeCtrl::InsertItem") );
+
+    return DoInsertItem(parent, idPrev, text, image, selectedImage, data);
+}
+
 wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent,
                                     const wxString& text,
                                     int image, int selectedImage,
@@ -1570,7 +1592,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             }
             break;
 
-#ifdef NM_CUSTOMDRAW
+#if defined(_WIN32_IE) && _WIN32_IE >= 0x300
         case NM_CUSTOMDRAW:
             {
                 LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)lParam;
@@ -1665,7 +1687,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
                 }
             }
             break;
-#endif // NM_CUSTOMDRAW
+#endif // _WIN32_IE >= 0x300
 
         default:
             return wxControl::MSWOnNotify(idCtrl, lParam, result);