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/Nudge/src/main.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'plugins/Nudge') diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 7921fce8a9..ab5c252a3c 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -5,7 +5,7 @@ int nProtocol = 0; -static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hIcon = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL; +static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL; HINSTANCE hInst; NudgeElementList *NudgeList = NULL; @@ -363,20 +363,15 @@ void RegisterToDbeditorpp(void) CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0); } +static IconItem iconList[] = +{ + { LPGEN("Nudge as Default"), "Nudge_Default", IDI_NUDGE } +}; + void LoadIcons(void) { //Load icons - TCHAR szFilename[MAX_PATH]; - GetModuleFileName(hInst,szFilename,MAX_PATH); - - SKINICONDESC sid = { sizeof(sid) }; - sid.flags = SIDF_PATH_TCHAR; - sid.pszSection = LPGEN("Nudge"); - sid.ptszDefaultFile = szFilename; - sid.pszName = "Nudge_Default"; - sid.pszDescription = LPGEN("Nudge as Default"); - sid.iDefaultIndex = -IDI_NUDGE; - g_hIcon = Skin_AddIcon(&sid); + Icon_Register(hInst, LPGEN("Nudge"), iconList, SIZEOF(iconList)); } // Nudge support @@ -399,7 +394,7 @@ static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) bbd.ptszTooltip = LPGENT("Send Nudge"); bbd.dwDefPos = 300; bbd.bbbFlags = BBBF_ISIMBUTTON|BBBF_ISLSIDEBUTTON|BBBF_CANBEHIDDEN; - bbd.hIcon = g_hIcon; + bbd.hIcon = iconList[0].hIcolib; bbd.dwButtonID = 6000; bbd.iButtonWidth = 0; CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); @@ -550,7 +545,7 @@ void LoadPopupClass() ppc.flags = PCF_TCHAR; ppc.pszName = "Nudge"; ppc.ptszDescription = LPGENT("Show Nudge"); - ppc.hIcon = Skin_GetIconByHandle(g_hIcon); + ppc.hIcon = Skin_GetIconByHandle(iconList[0].hIcolib); ppc.colorBack = NULL; ppc.colorText = NULL; ppc.iSeconds = 0; -- cgit v1.2.3