From a421acc1e18762eb0810d1b9013285d083b95314 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 1 Dec 2012 00:19:57 +0000 Subject: - fixes for the menu icons related stuff; - some old code dropped; git-svn-id: http://svn.miranda-ng.org/main/trunk@2574 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/src/icons.cpp | 63 ++++++++------------------------------ 1 file changed, 13 insertions(+), 50 deletions(-) (limited to 'plugins/MetaContacts/src/icons.cpp') diff --git a/plugins/MetaContacts/src/icons.cpp b/plugins/MetaContacts/src/icons.cpp index 59e60ce5eb..3776212289 100644 --- a/plugins/MetaContacts/src/icons.cpp +++ b/plugins/MetaContacts/src/icons.cpp @@ -1,12 +1,13 @@ #include "metacontacts.h" -typedef struct { - char* szDescr; - char* szName; - int defIconID; -} IconStruct; - -static IconStruct iconList[] = { +struct +{ + char* szDescr; + char* szName; + int defIconID; + HANDLE hIcolib; +} +static iconList[] = { { LPGEN("Toggle Off"), "mc_off", IDI_MCMENUOFF }, { LPGEN("Toggle On"), "mc_on", IDI_MCMENU }, { LPGEN("Convert to MetaContact"), "mc_convert", IDI_MCCONVERT }, @@ -16,48 +17,14 @@ static IconStruct iconList[] = { { LPGEN("Remove"), "mc_remove", IDI_MCREMOVE }, }; - -HICON LoadIconEx(IconIndex i) -{ - return Skin_GetIcon(iconList[i].szName); -} - -void ReleaseIconEx(HICON hIcon) +HANDLE GetIconHandle(IconIndex i) { - Skin_ReleaseIcon(hIcon); + return iconList[i].hIcolib; } -int ReloadIcons(WPARAM wParam, LPARAM lParam) +HICON LoadIconEx(IconIndex i) { - // fix menu icons - CLISTMENUITEM mi = { sizeof(mi) }; - mi.flags = CMIM_ICON; - - mi.hIcon = LoadIconEx(Meta_IsEnabled() ? I_MENUOFF : I_MENU); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - mi.hIcon = LoadIconEx(I_CONVERT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuConvert, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - mi.hIcon = LoadIconEx(I_ADD); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuAdd, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - mi.hIcon = LoadIconEx(I_EDIT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - mi.hIcon = LoadIconEx(I_SETDEFAULT); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - mi.hIcon = LoadIconEx(I_REMOVE); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDelete, (LPARAM)&mi); - ReleaseIconEx(mi.hIcon); - - return 0; + return Skin_GetIcon(iconList[i].szName); } void InitIcons(void) @@ -74,10 +41,6 @@ void InitIcons(void) sid.pszDescription = iconList[i].szDescr; sid.pszName = iconList[i].szName; sid.iDefaultIndex = -iconList[i].defIconID; - Skin_AddIcon(&sid); + iconList[i].hIcolib = Skin_AddIcon(&sid); } - - HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); - - ReloadIcons(0, 0); } -- cgit v1.2.3