]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
recommit after mac binary lapsus
[wxWidgets.git] / src / msw / treectrl.cpp
index 8727b16fa10f6e85e4b6c8932eb8f3918ccd38c6..bffbc684393ee343f72de82afcd7c7d27c88ee4f 100644 (file)
@@ -322,6 +322,8 @@ public:
 
 private:
     wxTreeItemData *m_data;
+
+    DECLARE_NO_COPY_CLASS(wxVirtualNode)
 };
 
 #ifdef __VISUALC__
@@ -360,6 +362,8 @@ private:
     bool Traverse(const wxTreeItemId& root, bool recursively);
 
     const wxTreeCtrl *m_tree;
+
+    DECLARE_NO_COPY_CLASS(wxTreeTraversal)
 };
 
 // internal class for getting the selected items
@@ -487,6 +491,8 @@ private:
 
     // the real client data
     wxTreeItemData *m_data;
+
+    DECLARE_NO_COPY_CLASS(wxTreeItemIndirectData)
 };
 
 // ----------------------------------------------------------------------------
@@ -2092,13 +2098,23 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
                     }
                     else // normal click
                     {
-                        // clear the selection and then let the default handler
-                        // do the job
-                        UnselectAll();
-
-                        // prevent the click from starting in-place editing
-                        // when there was no selection in the control
-                        TreeView_SelectItem(GetHwnd(), 0);
+                        // avoid doing anything if we click on the only
+                        // currently selected item
+                        wxArrayTreeItemIds selections;
+                        size_t count = GetSelections(selections);
+                        if ( count == 0 ||
+                                count > 1 ||
+                                    HITEM(selections[0]) != htItem )
+                        {
+                            // clear the previously selected items
+                            UnselectAll();
+
+                            // prevent the click from starting in-place editing
+                            // which should only happen if we click on the
+                            // already selected item (and nothing else is
+                            // selected)
+                            TreeView_SelectItem(GetHwnd(), 0);
+                        }
 
                         // reset on any click without Shift
                         m_htSelStart = 0;