diff options
author | George Hazan <george.hazan@gmail.com> | 2015-07-02 20:26:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-07-02 20:26:28 +0000 |
commit | c2367b41afe38f4e2f78544e1552e4f93302392a (patch) | |
tree | 3846cec944f5d17f2a8a4f5eb58e111fd1e1e5d6 | |
parent | 53ebc4e687d02bdab341171bd8b8b22b792e5c77 (diff) |
tray menu functions also moved to the core.
now all menu items are gathered there
git-svn-id: http://svn.miranda-ng.org/main/trunk@14476 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
21 files changed, 135 insertions, 127 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex 01f8b54a9f..3ac3835abb 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex e2d1d67cf2..a08cb40c9b 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex 01f8b54a9f..3ac3835abb 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex e2d1d67cf2..a08cb40c9b 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/include/m_clist.h b/include/m_clist.h index ec9390fe20..1f2776dda3 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -63,7 +63,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);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi);
// gets a handle to the main Miranda menu
// returns a HMENU. This need not to be freed since it's owned by clist
@@ -82,7 +82,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);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL);
// builds the context menu for a specific contact
// returns a HMENU identifying the menu. This should be DestroyMenu()ed when
@@ -102,7 +102,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);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL);
// the status menu is about to be built
// wParam = lParam = 0
@@ -112,7 +112,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);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(TMO_MenuItem *pmi, const char *pszProto = NULL);
/////////////////////////////////////////////////////////////////////////////////////////
// GROUP MENU
@@ -124,14 +124,11 @@ struct GroupMenuParam };
// builds the Group menu
-// wParam=lParam=0
// returns a HMENU identifying the menu.
EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildGroupMenu(void);
-// add a new item to the Group menus
-// wParam=GroupMenuParam*, params to call when exec menuitem
-// lParam=(LPARAM)(TMO_MenuItem*)&mi
-EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *mi, GroupMenuParam *gmp = NULL);
+// adds a new item to the Group menus
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = NULL);
// the Group menu is about to be built
// wParam = lParam = 0
@@ -144,10 +141,10 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *mi, GroupMenu // returns a HMENU identifying the menu.
EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildSubGroupMenu(struct ClcGroup *group);
-// add a new item to the SubGroup menus
+// adds a new item to the SubGroup menus
// wParam=GroupMenuParam*, params to call when exec menuitem
// lParam=(LPARAM)(TMO_MenuItem*)&mi
-EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *mi, GroupMenuParam *gmp = NULL);
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp = NULL);
// the SubGroup menu is about to be built
// wParam = lParam = 0
@@ -157,22 +154,15 @@ EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *mi, GroupM // TRAY MENU
// builds the tray menu
-// wParam=lParam=0
// returns a HMENU identifying the menu.
-#define MS_CLIST_MENUBUILDTRAY "CList/MenuBuildTray"
+EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildTrayMenu(void);
-// add a new item to the tray menus
-// wParam=0
-// lParam=(LPARAM)(TMO_MenuItem*)&mi
-
-__forceinline HGENMENU Menu_AddTrayMenuItem(TMO_MenuItem *mi)
-{
- return (HGENMENU)CallService("CList/AddTrayMenuItem", 0, (LPARAM)mi);
-}
+// adds a new item to the tray menus
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddTrayMenuItem(TMO_MenuItem *pmi);
// the tray menu is about to be built
-// wParam=lParam=0
-#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu"
+// wParam = lParam = 0
+#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu"
/////////////////////////////////////////////////////////////////////////////////////////
// sets the service to call when a contact is double-clicked
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index c4ee6f98a0..76015d3a1d 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -203,7 +203,6 @@ static HRESULT SubclassClistInterface() static HRESULT CreateHookableEvents()
{
g_CluiData.hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED);
- g_CluiData.hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
g_CluiData.hEventStatusBarShowToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP);
g_CluiData.hEventStatusBarHideToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_HIDE_TOOLTIP);
g_CluiData.hEventSkinServicesCreated = CreateHookableEvent(ME_SKIN_SERVICESCREATED);
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 6d362e128c..11408a33d7 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_commonprototypes.h"
int LoadFavoriteContactMenu();
-int UnloadFavoriteContactMenu();
#pragma hdrstop
@@ -54,11 +53,6 @@ int InitCustomMenus(void) return 0;
}
-void UninitCustomMenus(void)
-{
- UnloadFavoriteContactMenu();
-}
-
//////////////////////////////////////////////////////////////////////////
//
// FAVORITE CONTACT SYSTEM
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index e0b3a257be..409b4eb300 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_modernopt.h>
int OnLoadLangpack(WPARAM, LPARAM);
+int UnloadFavoriteContactMenu();
int CListMod_HideWindow();
@@ -47,7 +48,6 @@ int EventsProcessContactDoubleClick(MCONTACT hContact); INT_PTR TrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
void InitTrayMenus(void);
-void UninitTrayMenu();
// returns normal icon or combined with status overlay. Needs to be destroyed.
@@ -135,8 +135,7 @@ int GetContactIconC(ClcCacheEntry *p) void UnLoadContactListModule() //unhooks noncritical events
{
- UninitTrayMenu();
- UninitCustomMenus();
+ UnloadFavoriteContactMenu();
}
int CListMod_ContactListShutdownProc(WPARAM, LPARAM)
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 234ec01839..9c3a3d0250 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_statusbar.h"
#include <m_protoint.h>
+HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
int g_mutex_bOnTrayRightClick = 0;
BOOL g_bMultiConnectionMode = FALSE;
static HMENU hMainMenu, hStatusMenu;
-static int hTrayMenuObject;
BOOL IS_WM_MOUSE_DOWN_IN_TRAY;
BOOL g_trayTooltipActive = FALSE;
POINT tray_hover_pos = { 0 };
@@ -155,70 +155,6 @@ void DestroyTrayMenu(HMENU hMenu) }
/////////////////////////////////////////////////////////////////////////////////////////
-// Tray menu services
-
-HGENMENU hTrayMainMenuItemProxy, hTrayStatusMenuItemProxy, hTrayHideShowMainMenuItem;
-
-static INT_PTR BuildTrayMenu(WPARAM, LPARAM)
-{
- NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0);
-
- HMENU hMenu = CreatePopupMenu();
- Menu_Build(hMenu, hTrayMenuObject);
- return (INT_PTR)hMenu;
-}
-
-static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam)
-{
- TMO_MenuItem *pmi = (TMO_MenuItem*)lParam;
-
- HGENMENU hNewItem = Menu_AddItem(hTrayMenuObject, pmi, mir_strdup(pmi->pszService));
- Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, pmi->pszService);
- return (INT_PTR)hNewItem;
-}
-
-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 = Menu_GetMainMenu();
- }
-
- if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
- }
-
- 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)
@@ -249,7 +185,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) IS_WM_MOUSE_DOWN_IN_TRAY = 1;
}
else if (msg->lParam == WM_RBUTTONUP) {
- HMENU hMenu = (HMENU)BuildTrayMenu(0, 0);
+ HMENU hMenu = Menu_BuildTrayMenu();
g_mutex_bOnTrayRightClick = 1;
SetForegroundWindow(msg->hwnd);
@@ -292,20 +228,28 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Tray module init
-void InitTrayMenus(void)
+INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
{
- CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
- CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
- CreateServiceFunction("CLISTMENUSTRAY/TrayMenuonAddService", TrayMenuonAddService);
+ MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
+ if (mii == NULL)
+ return 0;
+
+ if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = Menu_GetMainMenu();
+ }
- CreateServiceFunction("CList/AddTrayMenuItem", AddTrayMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDTRAY, BuildTrayMenu);
+ if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
+ mii->fMask |= MIIM_SUBMENU;
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
+ }
- // Tray menu
- hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService");
+ return TRUE;
+}
+
+void InitTrayMenus(void)
+{
+ CreateServiceFunction("CLISTMENUSTRAY/TrayMenuOnAddService", TrayMenuOnAddService);
// add exit command to menu
CMenuItem mi;
@@ -315,12 +259,14 @@ void InitTrayMenus(void) mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT);
Menu_AddTrayMenuItem(&mi);
+ mi.flags = CMIF_DEFAULT;
mi.position = 100000;
mi.pszService = MS_CLIST_SHOWHIDE;
mi.name.a = LPGEN("&Hide/show");
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
hTrayHideShowMainMenuItem = Menu_AddTrayMenuItem(&mi);
+ mi.flags = 0;
mi.position = 200000;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER);
mi.pszService = "FindAdd/FindAddCommand";
@@ -352,13 +298,7 @@ void InitTrayMenus(void) Menu_AddTrayMenuItem(&mi);
hMainMenu = Menu_GetMainMenu();
- hStatusMenu = (HMENU)Menu_GetStatusMenu();
-}
-
-void UninitTrayMenu()
-{
- Menu_RemoveObject(hTrayMenuObject);
- hTrayMenuObject = NULL;
+ hStatusMenu = Menu_GetStatusMenu();
}
VOID CALLBACK cliTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 26e2e56bff..dc07bbc5ba 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -226,7 +226,6 @@ void FreeRowCell(); //Ro void InitGdiPlus(); //gdiplus.cpp
void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int SettingType); //clistsettings.c
void ShutdownGdiPlus(); //gdiplus.cpp
-void UninitCustomMenus(); //clistmenus.c
void UnloadAvatarOverlayIcon(); //clc.c
void UnLoadContactListModule(); //clistmod.c
void UpdateAllAvatars(ClcData *dat); //cache_func.c
diff --git a/plugins/Clist_modern/src/modern_global_structure.h b/plugins/Clist_modern/src/modern_global_structure.h index f6e94f3cb2..7f54143571 100644 --- a/plugins/Clist_modern/src/modern_global_structure.h +++ b/plugins/Clist_modern/src/modern_global_structure.h @@ -70,7 +70,6 @@ typedef struct tagCLUIDATA //hEventHandles
HANDLE hEventBkgrChanged;
- HANDLE hEventPreBuildTrayMenu;
HANDLE hEventStatusBarShowToolTip;
HANDLE hEventStatusBarHideToolTip;
HANDLE hEventSkinServicesCreated;
diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp index 9e52c700ed..d6b1879286 100644 --- a/plugins/MirLua/src/m_clist.cpp +++ b/plugins/MirLua/src/m_clist.cpp @@ -73,7 +73,7 @@ static int lua_AddTrayMenuItem(lua_State *L) static int lua_BuildTrayMenu(lua_State *L)
{
- HMENU res = (HMENU)::CallService(MS_CLIST_MENUBUILDTRAY);
+ HMENU res = Menu_BuildTrayMenu();
lua_pushlightuserdata(L, res);
return 1;
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 7ce932340c..0054d57c26 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clc.h"
INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam);
-int InitFramesMenus(void);
int InitCListEvents(void);
void UninitCListEvents(void);
int ContactSettingChanged(WPARAM wParam, LPARAM lParam);
@@ -488,7 +487,6 @@ int LoadContactListModule2(void) InitCListEvents();
InitGroupServices();
- InitFramesMenus();
cli.pfnInitTray();
hCListImages = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 13, 0);
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/menu_clist.cpp index 517feaef52..03f5830db9 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -30,7 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clc.h"
#include "genmenu.h"
-void InitGroupMenus();
+void InitGroupMenus(void);
+void InitFramesMenus(void);
+void InitTrayMenus(void);
#define MS_CLIST_HKSTATUS "Clist/HK/SetStatus"
@@ -1149,6 +1151,8 @@ void InitCustomMenus(void) // other menus
InitGroupMenus();
+ InitFramesMenus();
+ InitTrayMenus();
// initialize hotkeys
CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);
diff --git a/src/mir_app/src/framesmenu.cpp b/src/mir_app/src/menu_frames.cpp index 4d904620df..7c76e7d371 100644 --- a/src/mir_app/src/framesmenu.cpp +++ b/src/mir_app/src/menu_frames.cpp @@ -30,8 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int hFrameMenuObject;
static HANDLE hPreBuildFrameMenuEvent;
+/////////////////////////////////////////////////////////////////////////////////////////
// contactmenu exec param(ownerdata)
// also used in checkservice
+
struct FrameMenuExecParam
{
ptrA szServiceName;
@@ -52,9 +54,11 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) return (INT_PTR)Menu_AddItem(hFrameMenuObject, pmi, fmep);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// called with:
// wparam - ownerdata
// lparam - lparam from winproc
+
INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
FrameMenuExecParam *fmep = (FrameMenuExecParam*)wParam;
@@ -65,7 +69,6 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam) return 0;
}
-// true - ok,false ignore
INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
@@ -91,9 +94,9 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam, LPARAM lParam) return (INT_PTR)hMenu;
}
-//========================== Frames end
+/////////////////////////////////////////////////////////////////////////////////////////
-int InitFramesMenus(void)
+void InitFramesMenus(void)
{
CreateServiceFunction("FrameMenuExecService", FrameMenuExecService);
CreateServiceFunction("FrameMenuCheckService", FrameMenuCheckService);
@@ -107,5 +110,4 @@ int InitFramesMenus(void) // frame menu object
hFrameMenuObject = Menu_AddObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService");
- return 0;
}
diff --git a/src/mir_app/src/groupmenu.cpp b/src/mir_app/src/menu_groups.cpp index ea7c929ee5..ea7c929ee5 100644 --- a/src/mir_app/src/groupmenu.cpp +++ b/src/mir_app/src/menu_groups.cpp diff --git a/src/mir_app/src/genmenuopt.cpp b/src/mir_app/src/menu_options.cpp index 6e57e67f9d..6e57e67f9d 100644 --- a/src/mir_app/src/genmenuopt.cpp +++ b/src/mir_app/src/menu_options.cpp diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp new file mode 100644 index 0000000000..f3ccede108 --- /dev/null +++ b/src/mir_app/src/menu_tray.cpp @@ -0,0 +1,80 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+#include "genmenu.h"
+
+static int hTrayMenuObject;
+static HANDLE hEventPreBuildTrayMenu;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Tray menu services
+
+MIR_APP_DLL(HMENU) Menu_BuildTrayMenu(void)
+{
+ NotifyEventHooks(hEventPreBuildTrayMenu, 0, 0);
+
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hTrayMenuObject);
+ return hMenu;
+}
+
+MIR_APP_DLL(HGENMENU) Menu_AddTrayMenuItem(TMO_MenuItem *pmi)
+{
+ HGENMENU pimi = Menu_AddItem(hTrayMenuObject, pmi, mir_strdup(pmi->pszService));
+ replaceStr(pimi->UniqName, pmi->pszService);
+ return pimi;
+}
+
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
+static INT_PTR TrayMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0)
+ CallService((char*)wParam, 0, lParam);
+
+ return 1;
+}
+
+static INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam)
+{
+ mir_free((char*)lParam);
+ return 0;
+}
+
+void InitTrayMenus(void)
+{
+ CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
+ CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
+
+ hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
+
+ // Tray menu
+ hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
+ Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
+ Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
+ Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuOnAddService");
+}
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/menu_utils.cpp index 758d3c8b5e..758d3c8b5e 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/menu_utils.cpp diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 584a79020a..3fbf3bff93 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -233,3 +233,5 @@ Menu_BuildSubGroupMenu @230 Menu_AddGroupMenuItem @231
Menu_AddSubGroupMenuItem @232
Menu_BuildGroupMenu @233
+Menu_AddTrayMenuItem @234
+Menu_BuildTrayMenu @235
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 52c1014550..9f72915c5f 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -233,3 +233,5 @@ Menu_BuildSubGroupMenu @230 Menu_AddGroupMenuItem @231
Menu_AddSubGroupMenuItem @232
Menu_BuildGroupMenu @233
+Menu_AddTrayMenuItem @234
+Menu_BuildTrayMenu @235
|