diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/dialog.h | 8 | ||||
-rw-r--r-- | src/test/dialog.rc | 19 | ||||
-rw-r--r-- | src/test/w32dtst.cpp | 26 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/test/dialog.h b/src/test/dialog.h index 5b08673..7123816 100644 --- a/src/test/dialog.h +++ b/src/test/dialog.h @@ -11,3 +11,11 @@ #define IDDIRTXT 11 #define IDDIRBUT 12 #define IDCOMBO 13 +#define IDMENU 14 +#define IDMENUFILE 15 +#define IDMENULOAD 16 +#define IDMENUSAVE 17 +#define IDMENUQUIT 18 +#define IDMENUTEST 19 +#define IDMENUTESTITEM1 20 +#define IDMENUTESTITEM2 21 diff --git a/src/test/dialog.rc b/src/test/dialog.rc index d280453..ed3508e 100644 --- a/src/test/dialog.rc +++ b/src/test/dialog.rc @@ -5,6 +5,7 @@ TESTDLG DIALOG 10, 10, 500, 300 STYLE WS_POPUP | WS_BORDER CAPTION "Test Dialog" FONT 8,"MS Shell Dlg" + MENU IDMENU { PUSHBUTTON "Try Me!", IDBUTTON, 10, 10, 150, 18 AUTOCHECKBOX "Check", IDCHECK, 10,30,150,18 @@ -21,3 +22,21 @@ TESTDLG DIALOG 10, 10, 500, 300 LTEXT "Text:", IDSTATIC1, 210, 10, 35, 12 EDITTEXT IDTEXT, 250, 10, 100, 100, ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN } + +IDMENU MENU +{ + POPUP "File" + { + MENUITEM "Load", IDMENULOAD + MENUITEM "Save", IDMENUSAVE + MENUITEM "Quit", IDMENUQUIT + } + POPUP "Test" + { + MENUITEM "Test Item 1", IDMENUTESTITEM1 + POPUP "Sub" + { + MENUITEM "Test Item 2", IDMENUTESTITEM2 + } + } +} diff --git a/src/test/w32dtst.cpp b/src/test/w32dtst.cpp index 0e09ea2..75b5b44 100644 --- a/src/test/w32dtst.cpp +++ b/src/test/w32dtst.cpp @@ -59,6 +59,9 @@ public: (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnComboDbl)); m_combo.OnTextChanged (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnComboTxt)); + + SetMenuProc + (this,static_cast<W32DLib::W32DLibCallback>(&Test::OnMenu)); } virtual ~Test() @@ -201,6 +204,25 @@ private: std::cout << ":GetText=" << m_text.GetText() << std::endl; return TRUE; } + + BOOL OnMenu(UINT msg, WPARAM wp, LPARAM lp) + { + int cmd=LOWORD(wp); + + std::cout << "Menu command " << cmd << std::endl; + + switch(cmd) + { + case IDMENUQUIT: + Dialog::Close(IDCANCEL); + break; + + default: + break; + } + + return TRUE; + } }; int WINAPI WinMain (HINSTANCE hInstance, @@ -217,6 +239,10 @@ int WINAPI WinMain (HINSTANCE hInstance, { std::cout << "res=IDOK" << std::endl; } + else if (i==IDCANCEL) + { + std::cout << "res=IDCANCEL" << std::endl; + } else { std::cout << "res=" << i << std::endl; |