From ee3100701b64a1a34e8e5b3069219c7c5a201d8a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 29 Jun 2015 19:30:51 +0000 Subject: - unified menu creation using wrapper class CMenuItem; - duplicated hLangpack field removed from TMO_IntMenuItem; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14440 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_genmenu.inc | 8 ++++---- include/delphi/m_helpers.inc | 12 ++++++++---- include/m_clist.h | 8 ++++---- include/m_genmenu.h | 11 +++++++++++ 4 files changed, 27 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index ad49a1c160..6246276244 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -167,16 +167,16 @@ type hLangpack :int; end; -function _AddMainMenuItem(mi:PMO_MenuItem; hlang:integer) : HGENMENU; stdcall; +function _AddMainMenuItem(mi:PMO_MenuItem) : HGENMENU; stdcall; external AppDll name 'Menu_AddMainMenuItem'; -function _AddContactMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; +function _AddContactMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar) : HGENMENU; stdcall; external AppDll name 'Menu_AddContactMenuItem'; -function _AddProtoMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; +function _AddProtoMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar) : HGENMENU; stdcall; external AppDll name 'Menu_AddProtoMenuItem'; -function _AddStatusMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; +function _AddStatusMenuItem(mi:PMO_MenuItem; pszProto:PAnsiChar) : HGENMENU; stdcall; external AppDll name 'Menu_AddStatusMenuItem'; { diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index ac89dd005f..2d1cdadeeb 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -392,22 +392,26 @@ end; function Menu_AddMainMenuItem(mi:PMO_MenuItem):HGENMENU; begin - result:=_AddMainMenuItem(mi, hLangpack); + mi^.hLangpack:=hLangpack; + result:=_AddMainMenuItem(mi); end; function Menu_AddContactMenuItem(mi:PMO_MenuItem):HGENMENU; begin - result:=_AddContactMenuItem(mi, nil, hLangpack); + mi^.hLangpack:=hLangpack; + result:=_AddContactMenuItem(mi, nil); end; function Menu_AddStatusMenuItem(mi:PMO_MenuItem):HGENMENU; begin - result:=_AddStatusMenuItem(mi, nil, hLangpack); + mi^.hLangpack:=hLangpack; + result:=_AddStatusMenuItem(mi, nil); end; function Menu_AddProtoMenuItem(mi:PMO_MenuItem):HGENMENU; begin - result:=_AddProtoMenuItem(mi, nil, hLangpack); + mi^.hLangpack:=hLangpack; + result:=_AddProtoMenuItem(mi, nil); end; function Menu_AddTrayMenuItem(mi:PMO_MenuItem):HGENMENU; diff --git a/include/m_clist.h b/include/m_clist.h index 803fe25ba5..64105858b8 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -79,7 +79,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // MAIN MENU // adds a new element into main menu -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *mi, int = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *mi); // gets a handle to the main Miranda menu // returns a HMENU. This need not to be freed since it's owned by clist @@ -98,7 +98,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildMainMenu(void); // CONTACT MENU // adds a new element into contact menu -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL); // builds the context menu for a specific contact // returns a HMENU identifying the menu. This should be DestroyMenu()ed when @@ -118,7 +118,7 @@ EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact); EXTERN_C MIR_APP_DLL(HMENU) Menu_GetStatusMenu(void); // adds an item to a status menu -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL); // the status menu is about to be built // wParam = lParam = 0 @@ -128,7 +128,7 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *mi, const ch // PROTOCOL MENU // adds an item to status or main menu, according to the option -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL, int = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *mi, const char *pszProto = NULL); ///////////////////////////////////////////////////////////////////////////////////////// // GROUP MENU diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 20ca70b020..2ea11b239b 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -50,6 +50,17 @@ struct TMO_MenuItem int hLangpack; }; +#ifdef __cplusplus +struct CMenuItem : public TMO_MenuItem +{ + CMenuItem() + { + memset(this, 0, sizeof(CMenuItem)); + this->hLangpack = ::hLangpack; + } +}; +#endif + /* This structure passed to CheckService. */ -- cgit v1.2.3