diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-16 16:07:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-16 16:07:54 +0000 |
commit | 3abd733254c02e2ca2c9bcc7fbbd1417c4a8ff74 (patch) | |
tree | f797b88d7a3c6993d447ac35b240a20fee4186b7 /include | |
parent | caf5e0116248d00c0b6beaed6e4e7817a0158fbb (diff) |
- new menu object helpers (MO_CreateMenuObject, MO_SetMenuObjectParam);
- menu item display names are now translatable;
- old nasty pieces of junk removed in CLUIFrames/cluiframes.cpp
git-svn-id: http://svn.miranda-ng.org/main/trunk@7247 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r-- | include/m_genmenu.h | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/include/m_genmenu.h b/include/m_genmenu.h index ef05806534..d26e539c2a 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -249,31 +249,6 @@ typedef struct }
TCheckProcParam,*PCheckProcParam;
-typedef struct
-{
- int cbSize;
- char *name;
-
- /*
- This service called when module build menu(MO_BUILDMENU).
- Service called with params
-
- wparam=PCheckProcParam
- lparam=0
- if return==FALSE item is skiped.
- */
- char *CheckService;
-
- /*
- This service called when user select menu item.
- Service called with params
- wparam=ownerdata
- lparam=lParam from MO_PROCESSCOMMAND
- */
- char *ExecService;//called when processmenuitem called
-}
- TMenuParam,*PMenuParam;
-
//used in MO_BUILDMENU
typedef struct tagListParam
{
@@ -309,20 +284,6 @@ typedef struct //and call MO_PROCESSCOMMAND
#define MO_PROCESSCOMMANDBYMENUIDENT "MO/ProcessCommandByMenuIdent"
-
-//wparam=0;
-//lparam=PMenuParam;
-//returns=MenuObjectHandle on success,-1 on failure
-#define MO_CREATENEWMENUOBJECT "MO/CreateNewMenuObject"
-
-//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"
-
-
//wparam=MenuItemHandle
//lparam=0
//returns 0 on success,-1 on failure.
@@ -382,6 +343,39 @@ typedef struct //enable ability user to edit menuitems via options page.
#define OPT_USERDEFINEDITEMS 1
+// szName = unique menu object identifier
+// szDisplayName = menu display name (auto-translated by core)
+// szCheckService = this service called when module build menu(MO_BUILDMENU).
+// Service is called with params wparam = PCheckProcParam, lparam = 0
+// if service returns FALSE, item is skipped.
+// 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
+
+struct TMenuParam
+{
+ int cbSize;
+ LPCSTR name, CheckService, ExecService;
+};
+
+__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);
+}
+
+//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"
+
+// wparam=0
+// lparam=*lpOptParam
+// returns TRUE if it processed the command, FALSE otherwise
+#define MO_SRV_SETOPTIONSMENUOBJECT "MO/SetOptionsMenuObject"
typedef struct tagOptParam
{
@@ -391,21 +385,26 @@ typedef struct tagOptParam }
OptParam,*lpOptParam;
-//wparam=0
-//lparam=*lpOptParam
-//returns TRUE if it processed the command, FALSE otherwise
-#define MO_SETOPTIONSMENUOBJECT "MO/SetOptionsMenuObject"
-
+__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, INT_PTR iValue)
+{
+ OptParam param = { hMenu, iSetting, iValue };
+ CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)¶m);
+}
+__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, LPCSTR pszValue)
+{
+ OptParam param = { hMenu, iSetting, (INT_PTR)pszValue };
+ CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)¶m);
+}
//wparam=0
//lparam=*lpOptParam
//returns TRUE if it processed the command, FALSE otherwise
-#define MO_SETOPTIONSMENUITEM "MO/SetOptionsMenuItem"
+#define MO_SETOPTIONSMENUITEM "MO/SetOptionsMenuItem"
//wparam=char* szProtoName
//lparam=0
//returns HGENMENU of the root item or NULL
-#define MO_GETPROTOROOTMENU "MO/GetProtoRootMenu"
+#define MO_GETPROTOROOTMENU "MO/GetProtoRootMenu"
__forceinline HGENMENU MO_GetProtoRootMenu( const char* szProtoName )
{
|