From d123e0ce94bf90b2adb0a4000930eb467e293226 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 1 Nov 2006 14:48:34 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@16 4f64403b-2f21-0410-a795-97e2b3489a10 --- updater/icons.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 updater/icons.cpp (limited to 'updater/icons.cpp') diff --git a/updater/icons.cpp b/updater/icons.cpp new file mode 100644 index 0000000..345e948 --- /dev/null +++ b/updater/icons.cpp @@ -0,0 +1,61 @@ +#include "common.h" +#include "icons.h" + +HICON hIconCheck, hIconRestart, hIconCheckExit; +HANDLE hIcoLibIconsChanged = 0; + +int ReloadIcons(WPARAM wParam, LPARAM lParam) { + hIconCheck = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_check"); + hIconRestart = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_restart"); + hIconCheckExit = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_checkexit"); + + return 0; +} + +void InitIcons() { + if(ServiceExists(MS_SKIN2_ADDICON)) { + SKINICONDESC2 sid; + + sid.cbSize = sizeof(SKINICONDESC2); + sid.pszSection = "Updater"; + + sid.pszDescription = Translate("Check for Updates"); + sid.pszName = "updater_check"; + sid.pszDefaultFile = "updater.dll"; + sid.iDefaultIndex = 0; + sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 0, 0, 0); + CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + + sid.pszDescription = Translate("Restart"); + sid.pszName = "updater_restart"; + sid.pszDefaultFile = "updater.dll"; + sid.iDefaultIndex = 1; + sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RESTART), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); + CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + + sid.pszDescription = Translate("Update and Exit"); + sid.pszName = "updater_checkexit"; + sid.pszDefaultFile = "updater.dll"; + sid.iDefaultIndex = 2; + sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_UPDATEANDEXIT), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); + CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); + + ReloadIcons(0, 0); + + hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); + } else { + hIconCheck = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); + hIconRestart = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RESTART), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); + hIconCheckExit = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_UPDATEANDEXIT), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS ); + } + +} + +void DeinitIcons() { + if(hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged); + else { + DestroyIcon(hIconCheck); + DestroyIcon(hIconRestart); + DestroyIcon(hIconCheckExit); + } +} -- cgit v1.2.3