Added context menu support.

This commit is contained in:
Thomas Weidenmueller 2004-01-16 02:14:19 +00:00 committed by Alexandre Julliard
parent f3957f52cd
commit 649643aad7
5 changed files with 38 additions and 0 deletions

View File

@ -102,6 +102,29 @@ BEGIN
END
END
IDR_POPUP_MENUS MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
MENUITEM "&Modify", ID_EDIT_MODIFY
MENUITEM "Modify Binary Data", ID_EDIT_MODIFY_BIN
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename", ID_EDIT_RENAME
END
POPUP ""
BEGIN
POPUP "&New"
BEGIN
MENUITEM "&Key", ID_EDIT_NEW_KEY
MENUITEM SEPARATOR
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
END
END
END
/*
* Dialog

View File

@ -346,6 +346,13 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
}
break;
case WM_CONTEXTMENU: {
POINTS pt = MAKEPOINTS(lParam);
int cnt = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
TrackPopupMenu(GetSubMenu(hPopupMenus, cnt == -1 ? PM_NEW : PM_MODIFYVALUE),
TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
break;
}
case WM_KEYDOWN:
if (wParam == VK_TAB) {
/*TODO: SetFocus(Globals.hDriveBar) */

View File

@ -42,6 +42,7 @@ HINSTANCE hInst;
HWND hFrameWnd;
HWND hStatusBar;
HMENU hMenuFrame;
HMENU hPopupMenus = 0;
UINT nClipboardFormat;
LPCTSTR strClipboardFormat = _T("TODO: SET CORRECT FORMAT");
@ -104,6 +105,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
hChildWndClass = hChildWndClass; /* warning eater */
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
hPopupMenus = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_POPUP_MENUS));
/* Initialize the Windows Common Controls DLL */
InitCommonControls();

View File

@ -32,6 +32,9 @@
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
#define PM_MODIFYVALUE 0
#define PM_NEW 1
extern HINSTANCE hInst;
/******************************************************************************/
@ -64,6 +67,7 @@ extern HINSTANCE hInst;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hStatusBar;
extern HMENU hPopupMenus;
extern HFONT hFont;
extern enum OPTION_FLAGS Options;

View File

@ -41,6 +41,7 @@
#define IDD_DIALOG2 132
#define IDB_CLOSED_FILE 133
#define IDB_ROOT 134
#define IDR_POPUP_MENUS 137
#define IDC_LICENSE_EDIT 1029
#define ID_REGISTRY_EXIT 32770
#define ID_FAVOURITES_ADDTOFAVOURITES 32772
@ -114,6 +115,7 @@
#define IDC_DWORD_DEC 32854
#define IDS_NEWKEY 32860
#define IDS_NEWVALUE 32861
#define ID_EDIT_MODIFY_BIN 32870
#define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001