mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[RAPPS] Show listview context menu when the keyboard menu button/Shift+F10 is pressed (#5620)
This commit is contained in:
parent
0197a5bcae
commit
163f3407c8
3 changed files with 31 additions and 13 deletions
|
@ -1569,15 +1569,6 @@ CApplicationView::ProcessWindowMessage(
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
{
|
||||
if (((LPNMLISTVIEW)lParam)->iItem != -1)
|
||||
{
|
||||
ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
|
||||
|
@ -1613,6 +1604,30 @@ CApplicationView::ProcessWindowMessage(
|
|||
OnCommand(wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
bool kbd = -1 == (int)(INT_PTR)lParam;
|
||||
if ((HWND)wParam == m_ListView->m_hWnd)
|
||||
{
|
||||
int item = m_ListView->GetNextItem(-1, LVNI_FOCUSED | LVNI_SELECTED);
|
||||
if (item != -1)
|
||||
{
|
||||
POINT *ppt = NULL, pt;
|
||||
if (kbd)
|
||||
{
|
||||
RECT r;
|
||||
ListView_GetItemRect((HWND)wParam, item, &r, LVIR_LABEL);
|
||||
pt.x = r.left + (r.right - r.left) / 2;
|
||||
pt.y = r.top + (r.bottom - r.top) / 2;
|
||||
::ClientToScreen((HWND)wParam, ppt = &pt);
|
||||
}
|
||||
ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL, ppt);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ ErrorFromHResult(HRESULT hr)
|
|||
VOID
|
||||
CopyTextToClipboard(LPCWSTR lpszText);
|
||||
VOID
|
||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem);
|
||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point = NULL);
|
||||
BOOL
|
||||
StartProcess(const CStringW &Path, BOOL Wait);
|
||||
BOOL
|
||||
|
|
|
@ -40,7 +40,7 @@ CopyTextToClipboard(LPCWSTR lpszText)
|
|||
}
|
||||
|
||||
VOID
|
||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
|
||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point)
|
||||
{
|
||||
HMENU hMenu = NULL;
|
||||
HMENU hPopupMenu;
|
||||
|
@ -68,10 +68,13 @@ ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
|
|||
SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
|
||||
}
|
||||
|
||||
GetCursorPos(&pt);
|
||||
if (!Point)
|
||||
{
|
||||
GetCursorPos(Point = &pt);
|
||||
}
|
||||
|
||||
SetForegroundWindow(hwnd);
|
||||
TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hwndOwner, NULL);
|
||||
TrackPopupMenu(hPopupMenu, 0, Point->x, Point->y, 0, hwndOwner, NULL);
|
||||
|
||||
if (hMenu)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue