From adca17ccaecda72c8dd1234f1a7b91a0d5aff564 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Jun 2015 12:23:28 +0000 Subject: another portion of dead genmenu services git-svn-id: http://svn.miranda-ng.org/main/trunk@14377 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_genmenu.inc | 64 +++++++++++--------------- include/m_genmenu.h | 105 +++++++++++++++++++------------------------ 2 files changed, 72 insertions(+), 97 deletions(-) (limited to 'include') diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index ff44d69a86..42e0d2c4bd 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -239,17 +239,6 @@ type ExecService:PAnsiChar;//called when processmenuitem called end; -//used in MO_BUILDMENU -type - PListParam = ^TListParam; - TListParam = record - rootlevel :int; - MenuObjectHandle:THANDLE; - wParam :WPARAM; - lParam :LPARAM; -end; - tagListParam = TListParam; - type PProcessCommandParam = ^TProcessCommandParam; TProcessCommandParam = record @@ -258,69 +247,70 @@ type lParam:LPARAM; end; -const { - wparam started hMenu - lparam ListParam* + Builds a menu from the menu object specified result hMenu } - MO_BUILDMENU:PAnsiChar = 'MO/BuildMenu'; + +function Menu_Build(parent:HMENU; menuObject:THANDLE; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; + external AppDLL name 'Menu_Build'; { - wparam=MenuItemHandle - lparam userdefined - returns TRUE if it processed the command, FALSE otherwise + Passes custom lParam to the ExecMenuService for the specified menu item + returns true if command is processed, false otherwise } - MO_PROCESSCOMMAND:PAnsiChar = 'MO/ProcessCommand'; + +function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdcall; + external AppDLL name 'Menu_ProcessCommand'; { if menu not known call this LOWORD(wparam) menuident (from WM_COMMAND message) - returns TRUE if it processed the command, FALSE otherwise - Service automatically find right menuobject and menuitem - and call MO_PROCESSCOMMAND + It automatically finds right menuobject and menuitem and calls Menu_ProcessCommand + returns true if command is processed, false otherwise } - MO_PROCESSCOMMANDBYMENUIDENT:PAnsiChar = 'MO/ProcessCommandByMenuIdent'; + +function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall; + external AppDLL name 'Menu_ProcessCommandById'; { - wparam=0; - lparam=PMenuParam; returns=MenuObjectHandle on success,-1 on failure } - MO_CREATENEWMENUOBJECT:PAnsiChar = 'MO/CreateNewMenuObject'; + +function Menu_AddObject(const name, displayName, checkService, execService:PAnsiChar) : THANDLE; stdcall; + external AppDLL name 'Menu_AddObject'; { - wparam=MenuObjectHandle - lparam=0 returns 0 on success,-1 on failure Note: you must free all ownerdata structures, before you call this service.MO_REMOVEMENUOBJECT NOT free it. } - MO_REMOVEMENUOBJECT:PAnsiChar = 'MO/RemoveMenuObject'; + +function Menu_RemoveObject(hMenuObject:THANDLE) : integer; stdcall; + external AppDLL name 'Menu_RemoveObject'; { - wparam=MenuItemHandle - lparam=0 returns 0 on success,-1 on failure. You must free ownerdata before this call. If MenuItemHandle is root all child will be removed too. } - MO_REMOVEMENUITEM:PAnsiChar = 'MO/RemoveMenuItem'; + +function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall; + external AppDLL name 'Menu_RemoveItem'; { - wparam=MenuObjectHandle - lparam=PMO_MenuItem return MenuItemHandle on success,-1 on failure - Service supports old menu items (without CMIF_ROOTPOPUP or - CMIF_CHILDPOPUP flag).For old menu items needed root will be created automatically. } - MO_ADDNEWMENUITEM:PAnsiChar = 'MO/AddNewMenuItem'; + +function Menu_AddItem(hMenuObject:THANDLE; var tmi:TMO_MenuItem) : integer; stdcall; + external AppDLL name 'Menu_AddItem'; { wparam MenuItemHandle returns ownerdata on success,NULL on failure Useful to get and free ownerdata before delete menu item. } +const MO_MENUITEMGETOWNERDATA:PAnsiChar = 'MO/MenuItemGetOwnerData'; { diff --git a/include/m_genmenu.h b/include/m_genmenu.h index a4c30fe509..dd7840e0b5 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -200,68 +200,60 @@ struct TMO_MenuItem /* This structure passed to CheckService. */ -typedef struct + +struct TCheckProcParam { void *MenuItemOwnerData; HGENMENU MenuItemHandle; - WPARAM wParam;//from ListParam.wParam when building menu - LPARAM lParam;//from ListParam.lParam when building menu -} - TCheckProcParam,*PCheckProcParam; - -//used in MO_BUILDMENU -typedef struct tagListParam -{ - int rootlevel; - HANDLE MenuObjectHandle; WPARAM wParam; LPARAM lParam; -} - ListParam,*lpListParam; +}; -typedef struct +struct ProcessCommandParam { HMENU menu; int ident; LPARAM lParam; -} - ProcessCommandParam,*lpProcessCommandParam; +}; -//wparam started hMenu -//lparam ListParam* -//result hMenu -#define MO_BUILDMENU "MO/BuildMenu" +///////////////////////////////////////////////////////////////////////////////////////// +// Builds a menu from menu object's description +// Returns hMenu on success or NULL on failure -//wparam=MenuItemHandle -//lparam userdefined -//returns TRUE if it processed the command, FALSE otherwise -#define MO_PROCESSCOMMAND "MO/ProcessCommand" +EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0); -//if menu not known call this -//LOWORD(wparam) menuident (from WM_COMMAND message) -//returns TRUE if it processed the command, FALSE otherwise -//Service automatically find right menuobject and menuitem -//and call MO_PROCESSCOMMAND -#define MO_PROCESSCOMMANDBYMENUIDENT "MO/ProcessCommandByMenuIdent" +///////////////////////////////////////////////////////////////////////////////////////// +// Passes custom lParam to the ExecMenuService for the specified menu item +// Returns TRUE if command was processed, FALSE otherwise -//wparam=MenuItemHandle -//lparam=0 -//returns 0 on success,-1 on failure. -//You must free ownerdata before this call. -//If MenuItemHandle is root all child will be removed too. -#define MO_REMOVEMENUITEM "MO/RemoveMenuItem" +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam); -//wparam=MenuObjectHandle -//lparam=PMO_MenuItem -//return MenuItemHandle on success,-1 on failure -//Service supports old menu items (without CMIF_ROOTPOPUP or -//CMIF_CHILDPOPUP flag).For old menu items needed root will be created -//automatically. -#define MO_ADDNEWMENUITEM "MO/AddNewMenuItem" +///////////////////////////////////////////////////////////////////////////////////////// +// if menu not known call this +// LOWORD(wparam) menuident (from WM_COMMAND message) +// It automatically finds right menuobject and menuitem and calls Menu_ProcessCommand +// returns TRUE if command was processed, FALSE otherwise + +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam); + +///////////////////////////////////////////////////////////////////////////////////////// +// Removes a menu item from genmenu +// Returns 0 on success,-1 on failure. +// You must free ownerdata before this call. +// If MenuItemHandle is root, all children will be removed too. + +EXTERN_C MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem); + +///////////////////////////////////////////////////////////////////////////////////////// +// Adds a menu item to genmenu +// Returns MenuItemHandle on success, or NULL on failure + +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pItem); //wparam MenuItemHandle //returns ownerdata on success,NULL on failure //Useful to get and free ownerdata before delete menu item. + #define MO_MENUITEMGETOWNERDATA "MO/MenuItemGetOwnerData" //wparam=MenuItemHandle @@ -281,6 +273,8 @@ typedef struct //this should be called in WM_KEYDOWN #define MO_PROCESSHOTKEYS "MO/ProcessHotKeys" +///////////////////////////////////////////////////////////////////////////////////////// +// Creates a new menu object // szName = unique menu object identifier // szDisplayName = menu display name (auto-translated by core) // szCheckService = this service called when module build menu(MO_BUILDMENU). @@ -289,26 +283,17 @@ typedef struct // szExecService = this service called when user select menu item. // Service called with params wparam = ownerdata; lparam = lParam from MO_PROCESSCOMMAND // -// returns = MenuObjectHandle on success,-1 on failure +// returns = MenuObjectHandle on success, NULL on failure -struct TMenuParam -{ - int cbSize; - LPCSTR name, CheckService, ExecService; -}; +EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService); -__forceinline HANDLE MO_CreateMenuObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService) -{ - TMenuParam param = { sizeof(param), szName, szCheckService, szExecService }; - return (HANDLE)CallService("MO/CreateNewMenuObject", (WPARAM)szDisplayName, (LPARAM)¶m); -} +///////////////////////////////////////////////////////////////////////////////////////// +// Removes the whole menu object with all submenus +// returns 0 on success, nonzero on failure +// Note: you must free all ownerdata structures, before you +// call this function. Menu_RemoveObject DOES NOT free it. -//wparam=MenuObjectHandle -//lparam=0 -//returns 0 on success,-1 on failure -//Note: you must free all ownerdata structures, before you -//call this service.MO_REMOVEMENUOBJECT NOT free it. -#define MO_REMOVEMENUOBJECT "MO/RemoveMenuObject" +EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject); ///////////////////////////////////////////////////////////////////////////////////////// // tunes the whold menu object -- cgit v1.2.3