From c89c550677f40d8b2010de442053cba81ba06d96 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jun 2015 19:18:09 +0000 Subject: Menu_CreateRoot - new helper for creating submenus git-svn-id: http://svn.miranda-ng.org/main/trunk@14403 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_app.lib | Bin 60914 -> 61138 bytes bin10/lib/mir_app64.lib | Bin 59250 -> 59450 bytes bin12/lib/mir_app.lib | Bin 60914 -> 61138 bytes bin12/lib/mir_app64.lib | Bin 59250 -> 59450 bytes include/m_genmenu.h | 8 +++++++- src/mir_app/src/genmenu.cpp | 24 +++++++++++++++++++++--- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 8 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index 69e2c28ccd..211cb51642 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index cd9a03738f..7c056aa6a6 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index 69e2c28ccd..211cb51642 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index cd9a03738f..7c056aa6a6 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 1d97fa6dcf..3aa06a6544 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -70,10 +70,16 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam); ///////////////////////////////////////////////////////////////////////////////////////// // Adds a menu item to genmenu -// Returns MenuItemHandle on success, or NULL on failure +// Returns HGENMENU on success, or NULL on failure EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pItem); +///////////////////////////////////////////////////////////////////////////////////////// +// Adds new submenu +// Returns HGENMENU on success, or NULL on failure + +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(HGENMENU hRoot, LPCTSTR ptszName, int position, HANDLE hIcoLib = NULL, int hLang = hLangpack); + ///////////////////////////////////////////////////////////////////////////////////////// // process a WM_DRAWITEM message for user context menus v0.1.1.0+ // wParam, lParam, return value as for WM_MEASUREITEM diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index 7eac996704..ae4b414d15 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -651,9 +651,27 @@ static int GetNextObjectMenuItemId() } ///////////////////////////////////////////////////////////////////////////////////////// -// wparam = MenuObjectHandle -// lparam = PMO_MenuItem -// return MenuItemHandle +// Adds new submenu +// Returns a handle to the newly created root item or NULL + +MIR_APP_DLL(HGENMENU) Menu_CreateRoot(HGENMENU hRoot, LPCTSTR ptszName, int position, HANDLE hIcoLib, int hLang) +{ + if (hRoot == NULL) + return NULL; + + TMO_MenuItem tmi = { 0 }; + tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + tmi.hIcolibItem = hIcoLib; + tmi.root = hRoot; + tmi.hLangpack = hLang; + tmi.name.t = (TCHAR*)ptszName; + tmi.position = position; + return Menu_AddItem(hRoot->owner, &tmi); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Adds new menu item +// Returns a handle to the newly created item or NULL MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pmi) { diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 4b2e9ec4fe..dd9455a4bc 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -220,3 +220,4 @@ Menu_DrawItem @217 Menu_MeasureItem @218 Menu_EnableItem @219 Menu_SetChecked @220 +Menu_CreateRoot @221 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index bb17f0e413..6f0ce211bd 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -220,3 +220,4 @@ Menu_DrawItem @217 Menu_MeasureItem @218 Menu_EnableItem @219 Menu_SetChecked @220 +Menu_CreateRoot @221 -- cgit v1.2.3