mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:56:26 +00:00
[DEVMGR]
Add the 'add hardware' option for the maun menu or if the root node is selected svn path=/trunk/; revision=68343
This commit is contained in:
parent
b5e1b529b3
commit
8fdb754153
3 changed files with 16 additions and 5 deletions
|
@ -168,7 +168,7 @@ CDeviceView::OnContextMenu(
|
||||||
HMENU hContextMenu = CreatePopupMenu();
|
HMENU hContextMenu = CreatePopupMenu();
|
||||||
|
|
||||||
// Add the actions for this node
|
// Add the actions for this node
|
||||||
BuildActionMenuForNode(hContextMenu, Node);
|
BuildActionMenuForNode(hContextMenu, Node, false);
|
||||||
|
|
||||||
INT xPos = GET_X_LPARAM(lParam);
|
INT xPos = GET_X_LPARAM(lParam);
|
||||||
INT yPos = GET_Y_LPARAM(lParam);
|
INT yPos = GET_Y_LPARAM(lParam);
|
||||||
|
@ -279,7 +279,7 @@ CDeviceView::CreateActionMenu(
|
||||||
CNode *Node = GetSelectedNode();
|
CNode *Node = GetSelectedNode();
|
||||||
if (Node)
|
if (Node)
|
||||||
{
|
{
|
||||||
BuildActionMenuForNode(OwnerMenu, Node);
|
BuildActionMenuForNode(OwnerMenu, Node, MainMenu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,8 @@ CDeviceView::InsertIntoTreeView(
|
||||||
void
|
void
|
||||||
CDeviceView::BuildActionMenuForNode(
|
CDeviceView::BuildActionMenuForNode(
|
||||||
_In_ HMENU OwnerMenu,
|
_In_ HMENU OwnerMenu,
|
||||||
_In_ CNode *Node
|
_In_ CNode *Node,
|
||||||
|
_In_ bool MainMenu
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create a seperator structure
|
// Create a seperator structure
|
||||||
|
@ -843,6 +844,15 @@ CDeviceView::BuildActionMenuForNode(
|
||||||
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
|
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
if ((Node->GetNodeType() == RootNode) || (MainMenu == true))
|
||||||
|
{
|
||||||
|
String.LoadStringW(g_hInstance, IDS_MENU_ADD);
|
||||||
|
MenuItemInfo.wID = IDC_ADD_HARDWARE;
|
||||||
|
MenuItemInfo.dwTypeData = String.GetBuffer();
|
||||||
|
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
if (Node->HasProperties())
|
if (Node->HasProperties())
|
||||||
{
|
{
|
||||||
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
|
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
|
||||||
|
|
|
@ -134,7 +134,8 @@ private:
|
||||||
|
|
||||||
void BuildActionMenuForNode(
|
void BuildActionMenuForNode(
|
||||||
_In_ HMENU OwnerMenu,
|
_In_ HMENU OwnerMenu,
|
||||||
_In_ CNode *Node
|
_In_ CNode *Node,
|
||||||
|
_In_ bool MainMenu
|
||||||
);
|
);
|
||||||
|
|
||||||
HTREEITEM RecurseFindDevice(
|
HTREEITEM RecurseFindDevice(
|
||||||
|
|
|
@ -596,9 +596,9 @@ CMainWindow::OnCommand(WPARAM wParam,
|
||||||
HMENU hMenu = CreatePopupMenu();
|
HMENU hMenu = CreatePopupMenu();
|
||||||
m_DeviceView->CreateActionMenu(hMenu, true);
|
m_DeviceView->CreateActionMenu(hMenu, true);
|
||||||
|
|
||||||
|
// Calculate where to put the menu
|
||||||
RECT rc;
|
RECT rc;
|
||||||
GetMenuItemRect(m_hMainWnd, m_hMenu, 1, &rc);
|
GetMenuItemRect(m_hMainWnd, m_hMenu, 1, &rc);
|
||||||
|
|
||||||
LONG Height = rc.bottom - rc.top;
|
LONG Height = rc.bottom - rc.top;
|
||||||
|
|
||||||
// Display the menu
|
// Display the menu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue