From 68924bfc1a213e619563c2cffb6d44b5b5346f6d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jun 2015 18:21:10 +0000 Subject: next slice of cutting out unused menu features - popupPosition git-svn-id: http://svn.miranda-ng.org/main/trunk@14400 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_clist.inc | 2 - include/m_clist.h | 117 ++++++++++++++++++++++--------- include/m_clistint.h | 6 +- include/m_cluiframes.h | 4 +- include/m_genmenu.h | 168 ++++++++++++++++----------------------------- 5 files changed, 148 insertions(+), 149 deletions(-) (limited to 'include') diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index c92f468a82..d8e9147711 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -62,8 +62,6 @@ type 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 - popupPosition : int; // position of the popup menu on the root menu, ignored - // if pszPopupName is NULL(0) or if the popup menu already exists 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. diff --git a/include/m_clist.h b/include/m_clist.h index 9362080589..4bc8d25709 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -31,14 +31,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "statusmodes.h" +#ifndef M_CORE_H__ #include +#endif -extern int hLangpack; - -#if defined MIR_APP_EXPORTS - typedef struct TMO_IntMenuItem* HGENMENU; -#else - DECLARE_HANDLE(HGENMENU); +#ifndef M_GENMENU_H__ +#include #endif //sent when the user asks to change their status @@ -107,9 +105,6 @@ struct CLISTMENUITEM HGENMENU hParentMenu; // valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu }; - int popupPosition; //position of the popup menu on the root menu. Ignored - //if pszPopupName is NULL or the popup menu already - //existed 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 @@ -117,8 +112,6 @@ struct CLISTMENUITEM int hLangpack; //plugin's hLangpack (added automatically) }; -#define HGENMENU_ROOT ((HGENMENU)-1) - #define CMIF_GRAYED 1 #define CMIF_CHECKED 2 #define CMIF_HIDDEN 4 //only works on contact menus @@ -168,27 +161,6 @@ __forceinline HGENMENU Menu_AddProtoMenuItem(CLISTMENUITEM *mi) return (HGENMENU)CallService("CList/AddProtoMenuItem", 0, (LPARAM)mi); } -///////////////////////////////////////////////////////////////////////////////////////// -// modify an existing menu item -// returns 0 on success, nonzero on failure - -EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon = INVALID_HANDLE_VALUE, int iFlags = -1); - -///////////////////////////////////////////////////////////////////////////////////////// -// changes menu item's visibility - -EXTERN_C MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow); - -///////////////////////////////////////////////////////////////////////////////////////// -// enables or disables a menu item - -EXTERN_C MIR_APP_DLL(void) Menu_EnableItem(HGENMENU hMenuItem, bool bEnable); - -///////////////////////////////////////////////////////////////////////////////////////// -// turns a menu item's check on & off - -EXTERN_C MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet); - //the context menu for a contact is about to be built v0.1.0.1+ //wParam = (MCONTACT)hContact //lParam = 0 @@ -367,8 +339,89 @@ typedef struct { //returns a HMENU. This need not be freed since it's owned by clist #define MS_CLIST_MENUGETSTATUS "CList/MenuGetStatus" +// Group MENU +typedef struct +{ + int wParam; + int lParam; +} +GroupMenuParam, *lpGroupMenuParam; + +//builds the SubGroup menu +//wParam=lParam=0 +//returns a HMENU identifying the menu. +#define MS_CLIST_MENUBUILDSUBGROUP "CList/MenuBuildSubGroup" + +//add a new item to the SubGroup menus +//wParam=lpGroupMenuParam, params to call when exec menuitem +//lParam=(LPARAM)(CLISTMENUITEM*)&mi + +__forceinline HGENMENU Menu_AddSubGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi) +{ + mi->hLangpack = hLangpack; + return (HGENMENU)CallService("CList/AddSubGroupMenuItem", (WPARAM)gmp, (LPARAM)mi); +} + +//the SubGroup menu is about to be built +//wParam=lParam=0 +#define ME_CLIST_PREBUILDSUBGROUPMENU "CList/PreBuildSubGroupMenu" + +// Group MENU + +//builds the Group menu +//wParam=lParam=0 +//returns a HMENU identifying the menu. +#define MS_CLIST_MENUBUILDGROUP "CList/MenuBuildGroup" + +//add a new item to the Group menus +//wParam=lpGroupMenuParam, params to call when exec menuitem +//lParam=(LPARAM)(CLISTMENUITEM*)&mi + +__forceinline HGENMENU Menu_AddGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi) +{ + mi->hLangpack = hLangpack; + return (HGENMENU)CallService("CList/AddGroupMenuItem", (WPARAM)gmp, (LPARAM)mi); +} + +//the Group menu is about to be built +//wParam=lParam=0 +#define ME_CLIST_PREBUILDGROUPMENU "CList/PreBuildGroupMenu" + +// TRAY MENU + +//builds the tray menu +//wParam=lParam=0 +//returns a HMENU identifying the menu. +#define MS_CLIST_MENUBUILDTRAY "CList/MenuBuildTray" + +//add a new item to the tray menus +//wParam=0 +//lParam=(LPARAM)(CLISTMENUITEM*)&mi + +__forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi) +{ + mi->hLangpack = hLangpack; + return (HGENMENU)CallService("CList/AddTrayMenuItem", 0, (LPARAM)mi); +} + +//the tray menu is about to be built +//wParam=lParam=0 +#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu" + +// STATUS MENU + +//the status menu is about to be built +//wParam=lParam=0 +#define ME_CLIST_PREBUILDSTATUSMENU "CList/PreBuildStatusMenu" +//builds the main menu +//wParam=lParam=0 +//returns a HMENU identifying the menu. +#define MS_CLIST_MENUBUILDMAIN "CList/MenuBuildMain" +//the main menu is about to be built +//wParam=lParam=0 +#define ME_CLIST_PREBUILDMAINMENU "CList/PreBuildMainMenu" //processes a menu selection from a menu v0.1.1.0+ //wParam = MAKEWPARAM(LOWORD(wParam from WM_COMMAND), flags) diff --git a/include/m_clistint.h b/include/m_clistint.h index 976f20d8df..d518d92a79 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#include "m_genmenu.h" -#include "m_protocols.h" -#include "m_clc.h" +#include +#include +#include #define HCONTACT_ISGROUP 0x80000000 #define HCONTACT_ISINFO 0xFFFF0000 diff --git a/include/m_cluiframes.h b/include/m_cluiframes.h index 98af031ab1..a52f65375e 100644 --- a/include/m_cluiframes.h +++ b/include/m_cluiframes.h @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_CLUIFRAMES_H__ #define M_CLUIFRAMES_H__ 1 -#if !defined(M_GENMENU_H) -#include "m_genmenu.h" +#if !defined(M_GENMENU_H__) +#include #endif /************************************************************************/ diff --git a/include/m_genmenu.h b/include/m_genmenu.h index d62b5463eb..1d97fa6dcf 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -1,94 +1,17 @@ -#ifndef M_GENMENU_H -#define M_GENMENU_H +#ifndef M_GENMENU_H__ +#define M_GENMENU_H__ -#ifndef M_CLIST_H__ - #include +#ifndef M_CORE_H__ +#include #endif -extern int hLangpack; - -// Group MENU -typedef struct -{ - int wParam; - int lParam; -} -GroupMenuParam,*lpGroupMenuParam; - -//builds the SubGroup menu -//wParam=lParam=0 -//returns a HMENU identifying the menu. -#define MS_CLIST_MENUBUILDSUBGROUP "CList/MenuBuildSubGroup" - -//add a new item to the SubGroup menus -//wParam=lpGroupMenuParam, params to call when exec menuitem -//lParam=(LPARAM)(CLISTMENUITEM*)&mi - -__forceinline HGENMENU Menu_AddSubGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddSubGroupMenuItem", (WPARAM)gmp, (LPARAM)mi); -} - -//the SubGroup menu is about to be built -//wParam=lParam=0 -#define ME_CLIST_PREBUILDSUBGROUPMENU "CList/PreBuildSubGroupMenu" - -// Group MENU - -//builds the Group menu -//wParam=lParam=0 -//returns a HMENU identifying the menu. -#define MS_CLIST_MENUBUILDGROUP "CList/MenuBuildGroup" - -//add a new item to the Group menus -//wParam=lpGroupMenuParam, params to call when exec menuitem -//lParam=(LPARAM)(CLISTMENUITEM*)&mi - -__forceinline HGENMENU Menu_AddGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddGroupMenuItem", (WPARAM)gmp, (LPARAM)mi); -} - -//the Group menu is about to be built -//wParam=lParam=0 -#define ME_CLIST_PREBUILDGROUPMENU "CList/PreBuildGroupMenu" - -// TRAY MENU - -//builds the tray menu -//wParam=lParam=0 -//returns a HMENU identifying the menu. -#define MS_CLIST_MENUBUILDTRAY "CList/MenuBuildTray" - -//add a new item to the tray menus -//wParam=0 -//lParam=(LPARAM)(CLISTMENUITEM*)&mi - -__forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddTrayMenuItem", 0, (LPARAM)mi); -} - -//the tray menu is about to be built -//wParam=lParam=0 -#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu" - -// STATUS MENU - -//the status menu is about to be built -//wParam=lParam=0 -#define ME_CLIST_PREBUILDSTATUSMENU "CList/PreBuildStatusMenu" - -//builds the main menu -//wParam=lParam=0 -//returns a HMENU identifying the menu. -#define MS_CLIST_MENUBUILDMAIN "CList/MenuBuildMain" - -//the main menu is about to be built -//wParam=lParam=0 -#define ME_CLIST_PREBUILDMAINMENU "CList/PreBuildMainMenu" - -/*GENMENU_MODULE*/ +#if defined MIR_APP_EXPORTS + typedef struct TMO_IntMenuItem* HGENMENU; +#else + DECLARE_HANDLE(HGENMENU); +#endif + +#define HGENMENU_ROOT ((HGENMENU)INVALID_HANDLE_VALUE) #define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 @@ -145,20 +68,30 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam 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); +///////////////////////////////////////////////////////////////////////////////////////// +// 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 + +EXTERN_C MIR_APP_DLL(BOOL) Menu_DrawItem(DRAWITEMSTRUCT *dis); + +///////////////////////////////////////////////////////////////////////////////////////// +// enables or disables a menu item + +EXTERN_C MIR_APP_DLL(void) Menu_EnableItem(HGENMENU hMenuItem, bool bEnable); + +///////////////////////////////////////////////////////////////////////////////////////// +// 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); + ///////////////////////////////////////////////////////////////////////////////////////// // Retrieves user info from a menu item // Returns ownerdata on success, NULL on failure @@ -173,10 +106,19 @@ EXTERN_C MIR_APP_DLL(void*) Menu_GetItemData(HGENMENU hMenuItem); 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 +// 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 -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu); +EXTERN_C MIR_APP_DLL(BOOL) Menu_MeasureItem(MEASUREITEMSTRUCT *mis); + +///////////////////////////////////////////////////////////////////////////////////////// +// modify an existing menu item +// returns 0 on success, nonzero on failure + +EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon = INVALID_HANDLE_VALUE, int iFlags = -1); ///////////////////////////////////////////////////////////////////////////////////////// // Tries to process a keystroke @@ -185,19 +127,23 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu); EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(HANDLE hMenuObject, int key); -//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 +///////////////////////////////////////////////////////////////////////////////////////// +// 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(BOOL) Menu_MeasureItem(MEASUREITEMSTRUCT *mis); +EXTERN_C MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem); + +///////////////////////////////////////////////////////////////////////////////////////// +// changes menu item's visibility -//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 +EXTERN_C MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow); -EXTERN_C MIR_APP_DLL(BOOL) Menu_DrawItem(DRAWITEMSTRUCT *dis); +///////////////////////////////////////////////////////////////////////////////////////// +// turns a menu item's check on & off + +EXTERN_C MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet); ///////////////////////////////////////////////////////////////////////////////////////// // Creates a new menu object @@ -251,6 +197,7 @@ __forceinline int Menu_ConfigureObject(HANDLE hMenu, int iSetting, LPCSTR pszVal #define MCI_OPT_UNIQUENAME 1 // a unique name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) #define MCI_OPT_HOTKEY 2 // DWORD value = MAKELONG(VK_*, VK_SHIFT) +#define MCI_OPT_EXECPARAM 3 // INT_PTR or void*, associated with this item EXTERN_C MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value); @@ -268,4 +215,5 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(const char *szProtoName); EXTERN_C MIR_APP_DLL(void) KillModuleMenus(int hLangpack); -#endif +#endif // M_GENMENU_H__ + -- cgit v1.2.3