summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_clisttray.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-30 13:53:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-30 13:53:37 +0000
commit7f47c5f82ccdb19bd18f3f2500492f33501b78f2 (patch)
tree5adc9208cc32f75ab804a8882d2d39f2d24e6efe /plugins/Clist_modern/src/modern_clisttray.cpp
parent1e96c8f6505891260c9fc48d719ec90060a2560c (diff)
improperly copied code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@11680 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_clisttray.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp151
1 files changed, 74 insertions, 77 deletions
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index 181c1cddd2..f0a42bad28 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -283,16 +283,85 @@ void DestroyTrayMenu(HMENU hMenu)
DestroyMenu(hMenu);
}
-static HMENU BuildTrayMenu()
+/////////////////////////////////////////////////////////////////////////////////////////
+// Tray menu services
+
+HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
+
+static INT_PTR BuildTrayMenu(WPARAM, LPARAM)
{
+ NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0);
+
ListParam param = { 0 };
param.MenuObjectHandle = hTrayMenuObject;
HMENU hMenu = CreatePopupMenu();
CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
- return hMenu;
+ return (INT_PTR)hMenu;
+}
+
+static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam)
+{
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+
+ TMO_MenuItem tmi;
+ if (!pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
+
+ tmi.ownerdata = mir_strdup(mi->pszService);
+
+ OptParam op;
+ op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi);
+ op.Setting = OPT_MENUITEMSETUNIQNAME;
+ op.Value = (INT_PTR)mi->pszService;
+ CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
+ return (INT_PTR)op.Handle;
+}
+
+INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam)
+{
+ MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
+ if (mii == NULL)
+ return 0;
+
+ if (hTrayHideShowMainMenuItem == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_STATE;
+ mii->fState |= MFS_DEFAULT;
+ }
+
+ if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ }
+
+ if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ }
+
+ return(TRUE);
+}
+
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
+INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0)
+ CallService((char*)wParam, 0, lParam);
+
+ return 1;
+}
+
+INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam)
+{
+ mir_free((char*)lParam);
+ return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Tray event handler
+
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
{
MSG *msg = (MSG*)wParam;
@@ -341,7 +410,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
IS_WM_MOUSE_DOWN_IN_TRAY = 1;
}
else if (msg->lParam == WM_RBUTTONUP) {
- HMENU hMenu = BuildTrayMenu();
+ HMENU hMenu = (HMENU)BuildTrayMenu(0, 0);
g_mutex_bOnTrayRightClick = 1;
SetForegroundWindow(msg->hwnd);
@@ -361,80 +430,8 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam)
return corecli.pfnTrayIconProcessMessage(wParam, lParam);
}
-//////////////////////////////TRAY MENU/////////////////////////
-
-HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
-
-static INT_PTR BuildTrayMenu(WPARAM, LPARAM)
-{
- NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0);
-
- ListParam param = { 0 };
- param.MenuObjectHandle = hTrayMenuObject;
-
- HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
- return (INT_PTR)hMenu;
-}
-
-static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam)
-{
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
-
- TMO_MenuItem tmi;
- if (!pcli->pfnConvertMenu(mi, &tmi))
- return NULL;
-
- tmi.ownerdata = mir_strdup(mi->pszService);
-
- OptParam op;
- op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi);
- op.Setting = OPT_MENUITEMSETUNIQNAME;
- op.Value = (INT_PTR)mi->pszService;
- CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
- return (INT_PTR)op.Handle;
-}
-
-INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam)
-{
- MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
- if (mii == NULL)
- return 0;
-
- if (hTrayHideShowMainMenuItem == (HGENMENU)lParam) {
- mii->fMask |= MIIM_STATE;
- mii->fState |= MFS_DEFAULT;
- }
-
- if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
- }
-
- if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- }
-
- return(TRUE);
-}
-
-// called with:
-// wparam - ownerdata
-// lparam - lparam from winproc
-INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam)
-{
- if (wParam != 0)
- CallService((char*)wParam, 0, lParam);
-
- return 1;
-}
-
-INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam)
-{
- mir_free((char*)lParam);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Tray module init
void InitTrayMenus(void)
{