From 7d654422993a6b883214a10ef80bf22c3b711ae5 Mon Sep 17 00:00:00 2001 From: Gregor Brunmar Date: Wed, 3 Oct 2007 19:45:39 +0000 Subject: [PATCH] Added context menu on right click in treeviews svn path=/trunk/; revision=29384 --- reactos/dll/win32/comctl32/comctl32_ros.diff | 23 ++++++++++++++++++++ reactos/dll/win32/comctl32/treeview.c | 16 ++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff index 344d972cd24..cd77929ecba 100644 --- a/reactos/dll/win32/comctl32/comctl32_ros.diff +++ b/reactos/dll/win32/comctl32/comctl32_ros.diff @@ -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; + } + diff --git a/reactos/dll/win32/comctl32/treeview.c b/reactos/dll/win32/comctl32/treeview.c index 1b960a6b91c..937bd0ee938 100644 --- a/reactos/dll/win32/comctl32/treeview.c +++ b/reactos/dll/win32/comctl32/treeview.c @@ -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; }