[ros-diffs] [gbrunmar] 29384: Added context menu on right click in treeviews

gbrunmar at svn.reactos.org gbrunmar at svn.reactos.org
Wed Oct 3 21:45:40 CEST 2007


Author: gbrunmar
Date: Wed Oct  3 23:45:39 2007
New Revision: 29384

URL: http://svn.reactos.org/svn/reactos?rev=29384&view=rev
Log:
Added context menu on right click in treeviews

Modified:
    trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
    trunk/reactos/dll/win32/comctl32/treeview.c

Modified: trunk/reactos/dll/win32/comctl32/comctl32_ros.diff
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl32_ros.diff?rev=29384&r1=29383&r2=29384&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32_ros.diff (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32_ros.diff Wed Oct  3 23:45:39 2007
@@ -172,3 +172,26 @@
      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;
+ }
+ 

Modified: trunk/reactos/dll/win32/comctl32/treeview.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/treeview.c?rev=29384&r1=29383&r2=29384&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/treeview.c (original)
+++ trunk/reactos/dll/win32/comctl32/treeview.c Wed Oct  3 23:45:39 2007
@@ -4158,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;
 }
 




More information about the Ros-diffs mailing list