From be616d81bdaf8fd4ae61b0a145fb81bbdf467994 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jun 2015 22:03:02 +0000 Subject: YEEHAW! CLISTMENUITEM::pszPopupName also died git-svn-id: http://svn.miranda-ng.org/main/trunk@14404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_clist.inc | 30 ++++++++++++++---------------- include/delphi/m_genmenu.inc | 23 +++++++++++++++++++---- include/m_clist.h | 36 +++++++++++++++--------------------- include/m_genmenu.h | 24 +++++++++++++++--------- 4 files changed, 63 insertions(+), 50 deletions(-) (limited to 'include') diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index d8e9147711..7fe96dd4ff 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -52,22 +52,20 @@ type // Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". PCLISTMENUITEM = ^TCLISTMENUITEM; TCLISTMENUITEM = record - szName : TChar; // [TRANSLATED-BY-CORE] text of the menu item - flags : dword; - position : int; // approx position on the menu, lower numbers go nearer the top - hIcon : THANDLE; // icon to put by the item, if this was *not* loaded from - // a resource, you can delete it straight after the call - //icolibItem:THANDLE; if CMIF_ICONFROMICOLIB used - pszService : PAnsiChar; // name of the service to call when the service is clicked - szPopupName : TChar; // [TRANSLATED-BY-CORE] name of the popup menu that this item is on, if this - // is NULL the iteem is on the root of the menu - // or hParentMenu:HGENMENU - valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu - pszContactOwner: PAnsiChar; // contact menus only, the protocol module that owns - // the contacts to which this to which this menu item - // applies, NULL(0) if it applies to all contacts. - // if it applies to multiple but not all protocols - // add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU - hLangpack : int; // plugin's hLangpack (added automatically) + szName : TChar; // [TRANSLATED-BY-CORE] text of the menu item + flags : dword; + position : int; // approx position on the menu, lower numbers go nearer the top + hIcon : THANDLE; // icon to put by the item, if this was *not* loaded from + // a resource, you can delete it straight after the call + pszService : PAnsiChar; // name of the service to call when the service is clicked + hParentMenu : THANDLE; // parent menu hamdle + + pszContactOwner: PAnsiChar; // contact menus only, the protocol module that owns + // the contacts to which this to which this menu item + // applies, NULL(0) if it applies to all contacts. + // if it applies to multiple but not all protocols + // add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU + hLangpack : int; // plugin's hLangpack (added automatically) end; const diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index 400abdf6ec..b152cb8106 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -86,6 +86,13 @@ plugin may add different menu items with some service. (pszPopupName=(AnsiChar *)hMenuItem - for make child of popup) } +// predefined menu object codes +const + MO_MAIN = -1; + MO_CONTACT = -2; + MO_PROTO = -3; + MO_STATUS = -4; + // Group MENU type PGroupMenuParam = ^TGroupMenuParam; @@ -194,7 +201,7 @@ type result hMenu } -function Menu_Build(parent:HMENU; menuObject:THANDLE; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; +function Menu_Build(parent:HMENU; menuObject:integer; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; external AppDLL name 'Menu_Build'; { @@ -215,6 +222,14 @@ function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdca function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall; external AppDLL name 'Menu_ProcessCommandById'; +{ + creates a submenu + returns=MenuObjectHandle on success,-1 on failure +} + +function Menu_CreateRoot(menuObject:integer; const name:PWideChar; position:integer; icon:THANDLE; lang:integer) : THANDLE; stdcall; + external AppDLL name 'Menu_CreateRoot'; + { returns=MenuObjectHandle on success,-1 on failure } @@ -228,7 +243,7 @@ function Menu_AddObject(const name, displayName, checkService, execService:PAnsi call this service.MO_REMOVEMENUOBJECT NOT free it. } -function Menu_RemoveObject(hMenuObject:THANDLE) : integer; stdcall; +function Menu_RemoveObject(hMenuObject:integer) : integer; stdcall; external AppDLL name 'Menu_RemoveObject'; { @@ -244,7 +259,7 @@ function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall; return MenuItemHandle on success,-1 on failure } -function Menu_AddItem(hMenuObject:THANDLE; var tmi:TMO_MenuItem) : integer; stdcall; +function Menu_AddItem(hMenuObject:integer; var tmi:TMO_MenuItem) : integer; stdcall; external AppDLL name 'Menu_AddItem'; { @@ -275,7 +290,7 @@ function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; this should be called in WM_KEYDOWN } -function Menu_ProcessHotKey(hMenuObject:THANDLE; vKey:DWORD) : integer; stdcall; +function Menu_ProcessHotKey(hMenuObject:integer; vKey:DWORD) : integer; stdcall; external AppDLL name 'Menu_ProcessHotKey'; { diff --git a/include/m_clist.h b/include/m_clist.h index 4bc8d25709..7314f9f303 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -88,28 +88,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CLISTMENUITEM { union { - char* pszName; //[TRANSLATED-BY-CORE] text of the menu item - TCHAR* ptszName; //Unicode text of the menu item + char* pszName; // [TRANSLATED-BY-CORE] text of the menu item + TCHAR* ptszName; // Unicode text of the menu item }; - DWORD flags; //set of CMIF_* flags - int position; //approx position on the menu. lower numbers go nearer the top + DWORD flags; // set of CMIF_* flags + int position; // approx position on the menu. lower numbers go nearer the top union { - HICON hIcon; //icon to put by the item. If this was not loaded from - //a resource, you can delete it straight after the call - HANDLE icolibItem; //set CMIF_ICONFROMICOLIB to pass this value + HICON hIcon; // icon to put by the item. If this was not loaded from + // a resource, you can delete it straight after the call + HANDLE icolibItem; // set CMIF_ICONFROMICOLIB to pass this value }; - char* pszService; //name of service to call when the item gets selected - union { - char* pszPopupName; //[TRANSLATED-BY-CORE] name of the popup menu that this item is on. If this - TCHAR* ptszPopupName; //is NULL the item is on the root of the menu - HGENMENU hParentMenu; // valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu - }; - - char *pszContactOwner; //contact menus only. The protocol module that owns - //the contacts to which this menu item applies. NULL if it - //applies to all contacts. If it applies to multiple but not all - //protocols, add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU - int hLangpack; //plugin's hLangpack (added automatically) + char* pszService; // name of service to call when the item gets selected + HGENMENU hParentMenu; // HGENMENU_ROOT or NULL means the root menu + + char *pszContactOwner; // contact menus only. The protocol module that owns + // the contacts to which this menu item applies. NULL if it + // applies to all contacts. If it applies to multiple but not all + // protocols, add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU + int hLangpack; // plugin's hLangpack (added automatically) }; #define CMIF_GRAYED 1 @@ -119,7 +115,6 @@ struct CLISTMENUITEM #define CMIF_NOTONLINE 16 // " online #define CMIF_NOTONLIST 32 //item won't appear on standard contacts #define CMIF_NOTOFFLIST 64 //item won't appear on contacts that have the 'NotOnList' setting -#define CMIF_ROOTHANDLE 384 //means that hParentMenu member is set #define CMIF_UNICODE 512 //will return TCHAR* instead of char* #if defined(_UNICODE) @@ -129,7 +124,6 @@ struct CLISTMENUITEM #endif #define CMIF_KEEPUNTRANSLATED 1024 // don't translate a menu item -//#define CMIF_ICONFROMICOLIB 2048 // use icolibName instead of hIcon, unused #define CMIF_DEFAULT 4096 // this menu item is the default one __forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi) diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 3aa06a6544..a1fd164538 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -13,6 +13,12 @@ #define HGENMENU_ROOT ((HGENMENU)INVALID_HANDLE_VALUE) +// predefined menu objects +#define MO_MAIN (-1) +#define MO_CONTACT (-2) +#define MO_PROTO (-3) +#define MO_STATUS (-4) + #define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 struct TMO_MenuItem @@ -52,7 +58,7 @@ struct ProcessCommandParam // Builds a menu from menu object's description // Returns hMenu on success or NULL on failure -EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0); +EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, int hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0); ///////////////////////////////////////////////////////////////////////////////////////// // Passes custom lParam to the ExecMenuService for the specified menu item @@ -72,13 +78,13 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam); // Adds a menu item to genmenu // Returns HGENMENU on success, or NULL on failure -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pItem); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(int 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); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib = NULL, int hLang = hLangpack); ///////////////////////////////////////////////////////////////////////////////////////// // process a WM_DRAWITEM message for user context menus v0.1.1.0+ @@ -131,7 +137,7 @@ EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszN // 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); +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key); ///////////////////////////////////////////////////////////////////////////////////////// // Removes a menu item from genmenu @@ -163,7 +169,7 @@ EXTERN_C MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet); // // returns = MenuObjectHandle on success, NULL on failure -EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService); +EXTERN_C MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService); ///////////////////////////////////////////////////////////////////////////////////////// // Removes the whole menu object with all submenus @@ -171,7 +177,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, // Note: you must free all ownerdata structures, before you // call this function. Menu_RemoveObject DOES NOT free it. -EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject); +EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(int hMenuObject); ///////////////////////////////////////////////////////////////////////////////////////// // tunes the whold menu object @@ -191,10 +197,10 @@ EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject); // Set menu check service #define MCO_OPT_CHECK_SERVICE 4 -EXTERN_C MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE hMenu, int iSetting, INT_PTR value); +EXTERN_C MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int iSetting, INT_PTR value); -__forceinline int Menu_ConfigureObject(HANDLE hMenu, int iSetting, LPCSTR pszValue) -{ return Menu_ConfigureObject(hMenu, iSetting, INT_PTR(pszValue)); +__forceinline int Menu_ConfigureObject(int hMenuObject, int iSetting, LPCSTR pszValue) +{ return Menu_ConfigureObject(hMenuObject, iSetting, INT_PTR(pszValue)); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3