From 65e6aa9b5468f26485a236a46fcb18541e1acf1a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Jun 2015 15:22:06 +0000 Subject: rest of genmenu api died git-svn-id: http://svn.miranda-ng.org/main/trunk@14382 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_genmenu.inc | 100 +++--------------------------- include/delphi/m_helpers.inc | 14 ----- include/m_clist.h | 12 ---- include/m_genmenu.h | 144 +++++++++++-------------------------------- 4 files changed, 45 insertions(+), 225 deletions(-) (limited to 'include') diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index 42e0d2c4bd..400abdf6ec 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -86,29 +86,6 @@ plugin may add different menu items with some service. (pszPopupName=(AnsiChar *)hMenuItem - for make child of popup) } -const -{ - builds the SubGroup menu - wParam=lParam=0 - returns a HMENU identifying the menu. -} - MS_CLIST_MENUBUILDSUBGROUP:PAnsiChar = 'CList/MenuBuildSubGroup'; - -{ - add a new item to the SubGroup menus - wParam=lpGroupMenuParam, params to call when exec menuitem - lParam=(LPARAM)(CLISTMENUITEM*)&mi -} - MS_CLIST_ADDSUBGROUPMENUITEM:PAnsiChar = 'CList/AddSubGroupMenuItem'; - -{ - the SubGroup menu is about to be built - wParam=lParam=0 -} - ME_CLIST_PREBUILDSUBGROUPMENU:PAnsiChar = 'CList/PreBuildSubGroupMenu'; - -// SubGroup MENU - // Group MENU type PGroupMenuParam = ^TGroupMenuParam; @@ -118,34 +95,13 @@ type end; const -{ - builds the Group menu - wParam=lParam=0 - returns a HMENU identifying the menu. -} - MS_CLIST_MENUBUILDGROUP:PAnsiChar = 'CList/MenuBuildGroup'; - -{ - add a new item to the Group menus - wParam=lpGroupMenuParam, params to call when exec menuitem - lParam=(LPARAM)(CLISTMENUITEM*)&mi -} - MS_CLIST_ADDGROUPMENUITEM:PAnsiChar = 'CList/AddGroupMenuItem'; - { the Group menu is about to be built wParam=lParam=0 } ME_CLIST_PREBUILDGROUPMENU:PAnsiChar = 'CList/PreBuildGroupMenu'; - // TRAY MENU -{ - builds the tray menu - wParam=lParam=0 - returns a HMENU identifying the menu. -} - MS_CLIST_MENUBUILDTRAY:PAnsiChar = 'CList/MenuBuildTray'; { add a new item to the tray menus @@ -168,20 +124,6 @@ const } ME_CLIST_PREBUILDSTATUSMENU:PAnsiChar = 'CList/PreBuildStatusMenu'; -{ - add a new item to the status menu - wParam=0 - lParam=(LPARAM)(CLISTMENUITEM*)&mi -} -//!! MS_CLIST_ADDSTATUSMENUITEM = 'CList/AddStatusMenuItem'; // defined in m_clist.inc - -{ - builds the main menu - wParam=lParam=0 - returns a HMENU identifying the menu. -} - MS_CLIST_MENUBUILDMAIN:PAnsiChar = 'CList/MenuBuildMain'; - { the main menu is about to be built wParam=lParam=0 @@ -306,33 +248,25 @@ function Menu_AddItem(hMenuObject:THANDLE; var tmi:TMO_MenuItem) : integer; stdc 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'; + +function Menu_GetItemData(hMenuItem:HGENMENU) : pointer; stdcall; + external AppDLL name 'Menu_GetItemData'; { - wparam MenuItemHandle - lparam PMO_MenuItem returns 0 on success,-1 on failure } - MO_MODIFYMENUITEM:PAnsiChar = 'MO/ModifyMenuItem'; -{ - wparam=MenuItemHandle - lparam=PMO_MenuItem - returns 0 and filled PMO_MenuItem structure on success and -1 on failure -} - MO_GETMENUITEM:PAnsiChar = 'MO/GetMenuItem'; +function Menu_GetItemInfo(hMenuItem:HGENMENU; var mi:TMO_MenuItem) : integer; stdcall; + external AppDLL name 'Menu_GetItemInfo'; { - wparam=MenuItemHandle - lparam=0 returns a menu handle on success or NULL on failure } - MO_GETDEFAULTMENUITEM:PAnsiChar = 'MO/GetDefaultMenuItem'; + +function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; + external AppDLL name 'Menu_GetDefaultItem'; { wparam=MenuObjectHandle @@ -340,23 +274,9 @@ const returns TRUE if it processed the command, FALSE otherwise this should be called in WM_KEYDOWN } - MO_PROCESSHOTKEYS:PAnsiChar = 'MO/ProcessHotKeys'; - -{ - process a WM_DRAWITEM message - wparam=0 - lparam=LPDRAWITEMSTRUCT - returns TRUE if it processed the command, FALSE otherwise -} - MO_DRAWMENUITEM:PAnsiChar = 'MO/DrawMenuItem'; -{ - process a WM_MEASUREITEM message - wparam=0 - lparam=LPMEASUREITEMSTRUCT - returns TRUE if it processed the command, FALSE otherwise -} - MO_MEASUREMENUITEM:PAnsiChar = 'MO/MeasureMenuItem'; +function Menu_ProcessHotKey(hMenuObject:THANDLE; vKey:DWORD) : integer; stdcall; + external AppDLL name 'Menu_ProcessHotKey'; { sets an option for the whole menu object diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index a005f5c9ec..1d68b6501e 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -57,8 +57,6 @@ function Menu_AddMainMenuItem (mi:PCLISTMENUITEM):HGENMENU; function Menu_AddContactMenuItem (mi:PCLISTMENUITEM):HGENMENU; function Menu_AddStatusMenuItem (mi:PCLISTMENUITEM):HGENMENU; function Menu_AddProtoMenuItem (mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddSubGroupMenuItem (mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddGroupMenuItem (mi:PCLISTMENUITEM):HGENMENU; function Menu_AddTrayMenuItem (mi:PCLISTMENUITEM):HGENMENU; function UserInfo_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; @@ -416,18 +414,6 @@ begin result:=CallService(MS_CLIST_ADDPROTOMENUITEM, 0,LPARAM(mi)); end; -function Menu_AddSubGroupMenuItem(mi:PCLISTMENUITEM):HGENMENU; -begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDSUBGROUPMENUITEM, 0,LPARAM(mi)); -end; - -function Menu_AddGroupMenuItem(mi:PCLISTMENUITEM):HGENMENU; -begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDGROUPMENUITEM, 0,LPARAM(mi)); -end; - function Menu_AddTrayMenuItem(mi:PCLISTMENUITEM):HGENMENU; begin mi^.hLangpack:=hLangpack; diff --git a/include/m_clist.h b/include/m_clist.h index 22d3a5634b..f2d104a6bd 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -313,18 +313,6 @@ typedef struct { //will get the event that will be got if the user clicks the systray icon. #define MS_CLIST_GETEVENT "CList/GetEvent" -//process a WM_MEASUREITEM message for user context menus v0.1.1.0+ -//wParam, lParam, return value as for WM_MEASUREITEM -//This is for displaying the icons by the menu items. If you don't call this -//and clist/menudrawitem whne drawing a menu returned by one of the three menu -//services below then it'll work but you won't get any icons -#define MS_CLIST_MENUMEASUREITEM "CList/MenuMeasureItem" - -//process a WM_DRAWITEM message for user context menus v0.1.1.0+ -//wParam, lParam, return value as for WM_MEASUREITEM -//See comments for clist/menumeasureitem -#define MS_CLIST_MENUDRAWITEM "CList/MenuDrawItem" - //builds the context menu for a specific contact v0.1.1.0+ //wParam = (MCONTACT)hContact //lParam = 0 diff --git a/include/m_genmenu.h b/include/m_genmenu.h index dd7840e0b5..d62b5463eb 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -7,97 +7,6 @@ extern int hLangpack; -/* - Main features: - 1) Independet from clist,may be used in any module. - 2) Module defined Exec and Check services. - 3) Menu with any level of popups,icons for root of popup. - 4) You may use measure/draw/processcommand even if menuobject is unknown. - - Idea of GenMenu module consists of that, - it must be independet and offers only general menu purpose services: - MO_CREATENEWMENUOBJECT - MO_REMOVEMENUOBJECT - MO_ADDNEWMENUITEM - MO_REMOVEMENUITEM - ...etc - - And then each module that want use and offer to others menu handling - must create own services.For example i rewrited mainmenu and - contactmenu code in clistmenus.c.If you look at code all functions - are very identical, and vary only in check/exec services. - - So template set of function will like this: - RemoveItem - AddItem - Build - ExecService - CheckService - - ExecService and CheckService used as callbacks when GenMenu must - processcommand for menu item or decide to show or not item.This make - GenMenu independet of which params must passed to service when user - click on menu,this decide each module. - 28-04-2003 Bethoven - -*/ - - - -/* -Analog to CLISTMENUITEM,but invented two params root and ownerdata. -root is used for creating any level popup menus,set to -1 to build -at first level and root=MenuItemHandle to place items in submenu -of this item.Must be used two new flags CMIF_ROOTPOPUP and CMIF_CHILDPOPUP -(defined in m_clist.h) - -ownerdata is passed to callback services(ExecService and CheckService) -when building menu or processed command. -*/ - -/*GENMENU_MODULE*/ -/* -Changes: - -28-04-2003 -Moved all general stuff to genmenu.c(m_genmenu.h,genmenu.h), -so removed all frames stuff. - - -Changes: - -28-12-2002 - -Contact menu item service called with wparam=hcontact,lparam=popupPosition - -plugin may add different menu items with some service. -(old behavior wparam=hcontact lparam=0) - - - -25-11-2002 Full support of runtime build of all menus. - Contact MS_CLIST_ADDCONTACTMENUITEM - MS_CLIST_MENUBUILDCONTACT - ME_CLIST_PREBUILDCONTACTMENU - - MainMenu MS_CLIST_ADDMAINMENUITEM - MS_CLIST_REMOVEMAINMENUITEM - MS_CLIST_MENUBUILDMAIN - ME_CLIST_PREBUILDMAINMENU - - FrameMenu MS_CLIST_ADDCONTEXTFRAMEMENUITEM - MS_CLIST_REMOVECONTEXTFRAMEMENUITEM - MS_CLIST_MENUBUILDFRAMECONTEXT - ME_CLIST_PREBUILDFRAMEMENU - - For All menus may be used - MS_CLIST_MODIFYMENUITEM - - All menus supported any level of popups - (pszPopupName=(char *)hMenuItem - for make child of popup) -*/ - -// SubGroup MENU - // Group MENU typedef struct { @@ -250,28 +159,45 @@ EXTERN_C MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem); 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. +///////////////////////////////////////////////////////////////////////////////////////// +// Retrieves user info from a menu item +// Returns ownerdata on success, NULL on failure +// Useful to get and free ownerdata before delete menu item. + +EXTERN_C MIR_APP_DLL(void*) Menu_GetItemData(HGENMENU hMenuItem); + +///////////////////////////////////////////////////////////////////////////////////////// +// Retrieves menu item structure by handle. +// Returns 0 and filled TMO_MenuItem structure on success, or -1 on failure + +EXTERN_C MIR_APP_DLL(int) Menu_GetItemInfo(HGENMENU hMenuItem, TMO_MenuItem &pInfo); + +///////////////////////////////////////////////////////////////////////////////////////// +// Retrieves a default menu item for the menu passed +// Returns a menu handle on success or NULL on failure + +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu); + +///////////////////////////////////////////////////////////////////////////////////////// +// Tries to process a keystroke +// returns TRUE if a key was, FALSE otherwise +// this should be called in WM_KEYDOWN + +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(HANDLE hMenuObject, int key); -#define MO_MENUITEMGETOWNERDATA "MO/MenuItemGetOwnerData" +//process a WM_MEASUREITEM message for user context menus v0.1.1.0+ +//wParam, lParam, return value as for WM_MEASUREITEM +//This is for displaying the icons by the menu items. If you don't call this +//and clist/menudrawitem whne drawing a menu returned by one of the three menu +//services below then it'll work but you won't get any icons -//wparam=MenuItemHandle -//lparam=PMO_MenuItem -//returns 0 and filled PMO_MenuItem structure on success and -//-1 on failure -#define MO_GETMENUITEM "MO/GetMenuItem" +EXTERN_C MIR_APP_DLL(BOOL) Menu_MeasureItem(MEASUREITEMSTRUCT *mis); -//wparam=MenuItemHandle -//lparam=0 -//returns a menu handle on success or NULL on failure -#define MO_GETDEFAULTMENUITEM "MO/GetDefaultMenuItem" +//process a WM_DRAWITEM message for user context menus v0.1.1.0+ +//wParam, lParam, return value as for WM_MEASUREITEM +//See comments for clist/menumeasureitem -//wparam=MenuObjectHandle -//lparam=vKey -//returns TRUE if it processed the command, FALSE otherwise -//this should be called in WM_KEYDOWN -#define MO_PROCESSHOTKEYS "MO/ProcessHotKeys" +EXTERN_C MIR_APP_DLL(BOOL) Menu_DrawItem(DRAWITEMSTRUCT *dis); ///////////////////////////////////////////////////////////////////////////////////////// // Creates a new menu object -- cgit v1.2.3