Added context menu on right click in treeviews
authorGregor Brunmar <gbrunmar.ros@gmail.com>
Wed, 3 Oct 2007 19:45:39 +0000 (19:45 +0000)
committerGregor Brunmar <gbrunmar.ros@gmail.com>
Wed, 3 Oct 2007 19:45:39 +0000 (19:45 +0000)
svn path=/trunk/; revision=29384

reactos/dll/win32/comctl32/comctl32_ros.diff
reactos/dll/win32/comctl32/treeview.c

index 344d972..cd77929 100644 (file)
@@ -172,3 +172,26 @@ Index: treeview.c
      if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
        infoPtr->cdmode =
            TREEVIEW_SendCustomDrawNotify(infoPtr, CDDS_POSTPAINT, hdc, rect);
+@@ -4160,6 +4158,22 @@
+ static LRESULT
+ TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt)
+ {
++    TVHITTESTINFO ht;
++
++    ht.pt = *pPt;
++
++    TREEVIEW_HitTest(infoPtr, &ht);
++
++    if (ht.hItem)
++    {
++        /* Change to screen coordinate for WM_CONTEXTMENU */
++        ClientToScreen(infoPtr->hwnd, &ht.pt);
++
++        /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
++        SendMessageW(infoPtr->hwnd, WM_CONTEXTMENU,
++            (WPARAM)infoPtr->hwnd, MAKELPARAM(ht.pt.x, ht.pt.y));
++    }
++
+     return 0;
+ }
index 1b960a6..937bd0e 100644 (file)
@@ -4158,6 +4158,22 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
 static LRESULT
 TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt)
 {
+    TVHITTESTINFO ht;
+
+    ht.pt = *pPt;
+
+    TREEVIEW_HitTest(infoPtr, &ht);
+
+    if (ht.hItem)
+    {
+        /* Change to screen coordinate for WM_CONTEXTMENU */
+        ClientToScreen(infoPtr->hwnd, &ht.pt);
+
+        /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
+        SendMessageW(infoPtr->hwnd, WM_CONTEXTMENU,
+            (WPARAM)infoPtr->hwnd, MAKELPARAM(ht.pt.x, ht.pt.y));
+    }
+
     return 0;
 }