mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 10:58:30 +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;
|
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())
|
else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
|
||||||
|
@ -1613,6 +1604,30 @@ CApplicationView::ProcessWindowMessage(
|
||||||
OnCommand(wParam, lParam);
|
OnCommand(wParam, lParam);
|
||||||
}
|
}
|
||||||
break;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ ErrorFromHResult(HRESULT hr)
|
||||||
VOID
|
VOID
|
||||||
CopyTextToClipboard(LPCWSTR lpszText);
|
CopyTextToClipboard(LPCWSTR lpszText);
|
||||||
VOID
|
VOID
|
||||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem);
|
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point = NULL);
|
||||||
BOOL
|
BOOL
|
||||||
StartProcess(const CStringW &Path, BOOL Wait);
|
StartProcess(const CStringW &Path, BOOL Wait);
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -40,7 +40,7 @@ CopyTextToClipboard(LPCWSTR lpszText)
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
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 hMenu = NULL;
|
||||||
HMENU hPopupMenu;
|
HMENU hPopupMenu;
|
||||||
|
@ -68,10 +68,13 @@ ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
|
||||||
SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
|
SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCursorPos(&pt);
|
if (!Point)
|
||||||
|
{
|
||||||
|
GetCursorPos(Point = &pt);
|
||||||
|
}
|
||||||
|
|
||||||
SetForegroundWindow(hwnd);
|
SetForegroundWindow(hwnd);
|
||||||
TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hwndOwner, NULL);
|
TrackPopupMenu(hPopupMenu, 0, Point->x, Point->y, 0, hwndOwner, NULL);
|
||||||
|
|
||||||
if (hMenu)
|
if (hMenu)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue