]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
patches for wxSTIPPLE_MASK_OPAQUE from Klass Holwerda
[wxWidgets.git] / src / msw / treectrl.cpp
index a470179ed7543ce82ae45b30967d845aeb6f8dc0..d328e047c7ebe6bc6e02992b395072315780f130 100644 (file)
     #define TVIS_FOCUSED            0x0001
 #endif
 
+#ifndef TV_FIRST
+    #define TV_FIRST                0x1100
+#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
+
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
@@ -139,6 +149,8 @@ public:
         return TRUE;
     }
 
+    size_t GetCount() const { return m_selections.GetCount(); }
+
 private:
     wxArrayTreeItemIds& m_selections;
 };
@@ -484,6 +496,30 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item,
     return counter.GetCount() - 1;
 }
 
+// ----------------------------------------------------------------------------
+// control colours
+// ----------------------------------------------------------------------------
+
+bool wxTreeCtrl::SetBackgroundColour(const wxColour &colour)
+{
+    if ( !wxWindowBase::SetBackgroundColour(colour) )
+        return FALSE;
+
+    SendMessage(GetHwnd(), TVM_SETBKCOLOR, 0, colour.GetPixel());
+
+    return TRUE;
+}
+
+bool wxTreeCtrl::SetForegroundColour(const wxColour &colour)
+{
+    if ( !wxWindowBase::SetForegroundColour(colour) )
+        return FALSE;
+
+    SendMessage(GetHwnd(), TVM_SETTEXTCOLOR, 0, colour.GetPixel());
+
+    return TRUE;
+}
+
 // ----------------------------------------------------------------------------
 // Item access
 // ----------------------------------------------------------------------------
@@ -944,7 +980,7 @@ size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const
 {
     TraverseSelections selector(this, selections);
 
-    return selections.GetCount();
+    return selector.GetCount();
 }
 
 // ----------------------------------------------------------------------------