From c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 2 Dec 2012 18:19:49 +0000 Subject: new easy standard way of registering icons: Icon_Register git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AvatarHistory/src/icolib.cpp | 52 +++++------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) (limited to 'plugins/AvatarHistory/src/icolib.cpp') diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 28a88494bb..12497d1009 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -6,42 +6,20 @@ enum IconIndex I_OVERLAY }; -typedef struct +static IconItem iconList[] = { - TCHAR* szDescr; - char* szName; - int defIconID; - BOOL core; -} IconStruct; - -static IconStruct iconList[] = -{ - { LPGENT("History"), "core_main_10", IDI_AVATARHIST, TRUE }, - { LPGENT("Avatar Overlay"), "avh_overlay", IDI_AVATAROVERLAY, FALSE } + { LPGEN("History"), "core_main_10", IDI_AVATARHIST }, + { LPGEN("Avatar Overlay"), "avh_overlay", IDI_AVATAROVERLAY } }; -extern HANDLE hHooks[]; - static HICON LoadIconEx(IconIndex i) { - HICON hIcon; - - if (hHooks[4]) - hIcon = Skin_GetIcon(iconList[(int)i].szName); - else - hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(iconList[(int)i].defIconID), - IMAGE_ICON, 0, 0, 0); - - return hIcon; + return Skin_GetIcon(iconList[(int)i].szName); } - static void ReleaseIconEx(HICON hIcon) { - if (hHooks[4]) - Skin_ReleaseIcon(hIcon); - else - DestroyIcon(hIcon); + Skin_ReleaseIcon(hIcon); } static void IcoLibUpdateMenus() @@ -61,24 +39,8 @@ int IcoLibIconsChanged(WPARAM wParam, LPARAM lParam) void SetupIcoLib() { - if (hHooks[4]) { - TCHAR path[MAX_PATH]; - GetModuleFileName(hInst, path, sizeof(path)); - - SKINICONDESC sid = { sizeof(sid) }; - sid.ptszSection = LPGENT("Avatar History"); - sid.ptszDefaultFile = path; - sid.flags = SIDF_ALL_TCHAR; - - for (unsigned i = 0; i < MAX_REGS(iconList); i++) { - if (!iconList[i].core) { - sid.ptszDescription = iconList[i].szDescr; - sid.pszName = iconList[i].szName; - sid.iDefaultIndex = -iconList[i].defIconID; - Skin_AddIcon(&sid); - } - } - } + iconList[0].hIcolib = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY); + Icon_Register(hInst, LPGEN("Avatar History"), iconList+1, SIZEOF(iconList)-1); IcoLibUpdateMenus(); } -- cgit v1.2.3