]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
xti additions / changes, trying to reduce dependencies
[wxWidgets.git] / src / msw / treectrl.cpp
index a9ab74859356067adb0264ff50585f2d37c23540..3b3d3e33b97ce36fd4fce96b29a84a87a10a5b9a 100644 (file)
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "treectrl.h"
 #endif
 
 #include "wx/msw/treectrl.h"
 #include "wx/msw/dragimag.h"
 
-#ifdef __GNUWIN32_OLD__
-    #include "wx/msw/gnuwin32/extra.h"
-#endif
-
-#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
-    #include <commctrl.h>
-#endif
-
-// Bug in headers, sometimes
-#ifndef TVIS_FOCUSED
-    #define TVIS_FOCUSED            0x0001
-#endif
-
-#ifndef TV_FIRST
-    #define TV_FIRST                0x1100
-#endif
-
-#ifndef TVS_CHECKBOXES
-    #define TVS_CHECKBOXES          0x0100
-#endif
-
-#ifndef TVS_FULLROWSELECT
-    #define TVS_FULLROWSELECT       0x1000
-#endif
-
-// old headers might miss these messages (comctl32.dll 4.71+ only)
-#ifndef TVM_SETBKCOLOR
-    #define TVM_SETBKCOLOR          (TV_FIRST + 29)
-    #define TVM_SETTEXTCOLOR        (TV_FIRST + 30)
-#endif
+// include <commctrl.h> "properly"
+#include "wx/msw/wrapcctl.h"
 
 // macros to hide the cast ugliness
 // --------------------------------
@@ -398,6 +370,8 @@ public:
 
 private:
     wxArrayTreeItemIds& m_selections;
+
+    DECLARE_NO_COPY_CLASS(TraverseSelections)
 };
 
 // internal class for counting tree items
@@ -425,6 +399,8 @@ public:
 
 private:
     size_t m_count;
+
+    DECLARE_NO_COPY_CLASS(TraverseCounter)
 };
 
 // ----------------------------------------------------------------------------
@@ -494,7 +470,19 @@ private:
 // wxWin macros
 // ----------------------------------------------------------------------------
 
+#if wxUSE_EXTENDED_RTTI
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxTreeCtrl, wxControl,"wx/treectrl.h")
+
+WX_BEGIN_PROPERTIES_TABLE(wxTreeCtrl)
+WX_END_PROPERTIES_TABLE()
+
+WX_BEGIN_HANDLERS_TABLE(wxTreeCtrl)
+WX_END_HANDLERS_TABLE()
+
+WX_CONSTRUCTOR_5( wxTreeCtrl , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) 
+#else
 IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl)
+#endif
 
 // ----------------------------------------------------------------------------
 // constants
@@ -1015,7 +1003,8 @@ void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image,
         case wxTreeItemIcon_Normal:
             {
                 const int imageNormalOld = GetItemImage(item);
-                const int imageSelOld = GetItemSelectedImage(item);
+                const int imageSelOld =
+                    GetItemImage(item, wxTreeItemIcon_Selected);
 
                 // always set the normal image
                 imageNormal = image;
@@ -1040,7 +1029,7 @@ void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image,
                 // the wxTreeItemIndirectData GetItemXXXImage() will use it to
                 // get the images
                 imageNormal = GetItemImage(item);
-                imageSel = GetItemSelectedImage(item);
+                imageSel = GetItemImage(item, wxTreeItemIcon_Selected);
 
                 // if it doesn't have it yet, add it
                 wxTreeItemIndirectData *data = new
@@ -1772,10 +1761,12 @@ void wxTreeCtrl::Toggle(const wxTreeItemId& item)
     DoExpand(item, TVE_TOGGLE);
 }
 
+#if WXWIN_COMPATIBILITY_2_4
 void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action)
 {
     DoExpand(item, action);
 }
+#endif
 
 void wxTreeCtrl::Unselect()
 {
@@ -2536,7 +2527,9 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             }
             break;
 
-#if defined(_WIN32_IE) && _WIN32_IE >= 0x300 && !wxUSE_COMCTL32_SAFELY && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) )
+            // instead of explicitly checking for _WIN32_IE, check if the
+            // required symbols are available in the headers
+#if defined(CDDS_PREPAINT) && !wxUSE_COMCTL32_SAFELY
         case NM_CUSTOMDRAW:
             {
                 LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)lParam;
@@ -2631,7 +2624,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
 
             // we always process it
             return true;
-#endif // _WIN32_IE >= 0x300
+#endif // have owner drawn support in headers
 
         case NM_CLICK:
             {