diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-27 17:05:05 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-27 17:05:05 +0000 |
commit | cbd22101bcff041e598aba668412d0a4232b58e3 (patch) | |
tree | 984f7afe9ec9246719e185288f8a2e96f4bc0665 /MySpace/menu.cpp | |
parent | 353f66dee3f468aaf7cc0d0ab314df89ae56c428 (diff) |
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@217 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'MySpace/menu.cpp')
-rw-r--r-- | MySpace/menu.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/MySpace/menu.cpp b/MySpace/menu.cpp new file mode 100644 index 0000000..42c8ca9 --- /dev/null +++ b/MySpace/menu.cpp @@ -0,0 +1,75 @@ +#include "common.h"
+#include "menu.h"
+#include "resource.h"
+
+HANDLE hMenuMain = 0, hServiceMenuMain = 0;
+
+int MainMenuService(WPARAM wParam, LPARAM lParam) {
+ // TODO: add code here that executes when the menu item is chosen
+
+ // e.g. modify main menu item - see m_clist.h
+ //CLISTMENUITEM menu = {0};
+ //menu.cbSize=sizeof(menu);
+ //menu.flags = CMIM_NAME | CMIF_TCHAR;
+ //menu.ptszName = (char *)TranslateT("Changed menu text");
+ //CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuMain, (LPARAM)&menu);
+
+ return 0;
+}
+
+HANDLE hMenuContact = 0, hServiceMenuContact = 0, hEventMenuBuild = 0;
+
+int ContactMenuService(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ // TODO: add code here that executes when the menu item is chosen
+
+ // e.g. you could modify the menu item here - see below
+ return 0;
+}
+
+// this function is called when the contact's menu is about to be shown - you can e.g.
+// modify the menu here using the MS_CLIST_MODIFYMENUITEM service
+int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
+ HANDLE hContact = (HANDLE)wParam;
+ // TODO: add code here that executes when the menu is constructed
+
+ // e.g. modify menu item - see m_clist.h
+ //CLISTMENUITEM menu = {0};
+ //menu.cbSize=sizeof(menu);
+ //menu.flags = CMIM_NAME | CMIF_TCHAR;
+ //menu.ptszName = (char *)TranslateT("Changed menu text");
+ //CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact, (LPARAM)&menu);
+
+ return 0;
+}
+
+void InitMenu() {
+ CLISTMENUITEM menu = {0};
+ menu.cbSize=sizeof(menu);
+
+ menu.flags = CMIM_ALL | CMIF_TCHAR;
+ menu.hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_PROTO), IMAGE_ICON, 0, 0, 0);
+
+ // main menu item
+ hServiceMenuMain = CreateServiceFunction(MODULE "/MainMenu", MainMenuService);
+ menu.ptszName = TranslateT(MODULE);
+ menu.pszService = MODULE "/MainMenu";
+ menu.position = 0;
+ hMenuMain = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+
+ // contact menu item
+ hServiceMenuContact = CreateServiceFunction(MODULE "/ContactMenu", ContactMenuService);
+ menu.ptszName = TranslateT(MODULE);
+ menu.pszService = MODULE "/ContactMenu";
+ menu.position = 0;
+ menu.flags = CMIF_NOTOFFLINE; // only show for not-offline contacts
+ hMenuContact = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&menu);
+
+ hEventMenuBuild = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+}
+
+void DeinitMenu() {
+ UnhookEvent(hEventMenuBuild);
+ DestroyServiceFunction(hServiceMenuContact);
+ DestroyServiceFunction(hServiceMenuMain);
+}
\ No newline at end of file |