mirror of
https://github.com/reactos/reactos.git
synced 2024-09-12 22:02:18 +00:00
[DEVMGMT_NEW]
show popupmenu on right click (not finished yet) svn path=/trunk/; revision=67979
This commit is contained in:
parent
54294b0fb1
commit
19d0becca8
|
@ -53,6 +53,8 @@ CDeviceView::~CDeviceView(void)
|
||||||
{
|
{
|
||||||
delete m_Devices;
|
delete m_Devices;
|
||||||
m_Devices = NULL;
|
m_Devices = NULL;
|
||||||
|
|
||||||
|
DestroyMenu(m_hShortcutMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
@ -64,6 +66,14 @@ CDeviceView::Initialize()
|
||||||
bSuccess = m_Devices->Initialize();
|
bSuccess = m_Devices->Initialize();
|
||||||
if (bSuccess == FALSE) return FALSE;
|
if (bSuccess == FALSE) return FALSE;
|
||||||
|
|
||||||
|
/* Create Popup Menu */
|
||||||
|
m_hShortcutMenu = LoadMenu(g_hInstance,
|
||||||
|
MAKEINTRESOURCE(IDR_POPUP));
|
||||||
|
m_hShortcutMenu = GetSubMenu(m_hShortcutMenu,
|
||||||
|
0);
|
||||||
|
SetMenuDefaultItem(m_hShortcutMenu, IDC_PROP, FALSE);
|
||||||
|
|
||||||
|
|
||||||
/* Create the main treeview */
|
/* Create the main treeview */
|
||||||
m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
|
m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
|
||||||
WC_TREEVIEW,
|
WC_TREEVIEW,
|
||||||
|
@ -102,6 +112,36 @@ CDeviceView::Uninitialize()
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
CDeviceView::ShowContextMenu(
|
||||||
|
_In_ INT xPos,
|
||||||
|
_In_ INT yPos)
|
||||||
|
{
|
||||||
|
HTREEITEM hSelected;
|
||||||
|
POINT pt;
|
||||||
|
RECT rc;
|
||||||
|
|
||||||
|
hSelected = TreeView_GetSelection(m_hTreeView);
|
||||||
|
|
||||||
|
if (TreeView_GetItemRect(m_hTreeView,
|
||||||
|
hSelected,
|
||||||
|
&rc,
|
||||||
|
TRUE))
|
||||||
|
{
|
||||||
|
if (GetCursorPos(&pt) &&
|
||||||
|
ScreenToClient(m_hTreeView, &pt) &&
|
||||||
|
PtInRect(&rc, pt))
|
||||||
|
{
|
||||||
|
TrackPopupMenuEx(m_hShortcutMenu,
|
||||||
|
TPM_RIGHTBUTTON,
|
||||||
|
xPos,
|
||||||
|
yPos,
|
||||||
|
m_hMainWnd,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CDeviceView::Size(
|
CDeviceView::Size(
|
||||||
_In_ INT x,
|
_In_ INT x,
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CDeviceView : public CDevices
|
||||||
HWND m_hMainWnd;
|
HWND m_hMainWnd;
|
||||||
HWND m_hTreeView;
|
HWND m_hTreeView;
|
||||||
HWND m_hPropertyDialog;
|
HWND m_hPropertyDialog;
|
||||||
HWND m_hShortcutMenu;
|
HMENU m_hShortcutMenu;
|
||||||
ListDevices m_ListDevices;
|
ListDevices m_ListDevices;
|
||||||
|
|
||||||
HIMAGELIST m_ImageList;
|
HIMAGELIST m_ImageList;
|
||||||
|
@ -34,6 +34,11 @@ public:
|
||||||
BOOL Initialize();
|
BOOL Initialize();
|
||||||
BOOL Uninitialize();
|
BOOL Uninitialize();
|
||||||
|
|
||||||
|
VOID ShowContextMenu(
|
||||||
|
_In_ INT xPos,
|
||||||
|
_In_ INT yPos
|
||||||
|
);
|
||||||
|
|
||||||
VOID Size(
|
VOID Size(
|
||||||
_In_ INT x,
|
_In_ INT x,
|
||||||
_In_ INT y,
|
_In_ INT y,
|
||||||
|
|
|
@ -449,6 +449,10 @@ CMainWindow::OnNotify(LPARAM lParam)
|
||||||
LRESULT
|
LRESULT
|
||||||
CMainWindow::OnContext(LPARAM lParam)
|
CMainWindow::OnContext(LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
INT xPos = GET_X_LPARAM(lParam);
|
||||||
|
INT yPos = GET_Y_LPARAM(lParam);
|
||||||
|
|
||||||
|
m_DeviceView->ShowContextMenu(xPos, yPos);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue