diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/NoHistory | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff) |
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
Diffstat (limited to 'plugins/NoHistory')
-rw-r--r-- | plugins/NoHistory/src/dllmain.cpp | 2 | ||||
-rw-r--r-- | plugins/NoHistory/src/icons.cpp | 46 | ||||
-rw-r--r-- | plugins/NoHistory/src/icons.h | 1 |
3 files changed, 13 insertions, 36 deletions
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index e2742e3fcd..1b2f7048b0 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -366,7 +366,5 @@ extern "C" __declspec (dllexport) int Unload(void) { RemoveReadEvents();
DeleteCriticalSection(&list_cs);
-
- DeinitIcons();
return 0;
}
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index f0d0844aa5..f823517f11 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -3,47 +3,27 @@ #include "resource.h"
HICON hIconRemove, hIconKeep, hIconClear;
-HANDLE hIcoLibIconsChanged = 0;
-int ReloadIcons(WPARAM wParam, LPARAM lParam) {
- hIconRemove = Skin_GetIcon(MODULE "_remove");
- hIconKeep = Skin_GetIcon(MODULE "_keep");
- hIconClear = Skin_GetIcon(MODULE "_clear");
+static IconItem iconList[] =
+{
+ { LPGEN("Disable"), "remove", IDI_HREMOVE },
+ { LPGEN("Enable"), "keep", IDI_HKEEP },
+ { LPGEN("Clear"), "clear", IDI_HCLEAR },
+};
+int ReloadIcons(WPARAM wParam, LPARAM lParam)
+{
+ hIconRemove = Skin_GetIconByHandle(iconList[0].hIcolib);
+ hIconKeep = Skin_GetIconByHandle(iconList[1].hIcolib);
+ hIconClear = Skin_GetIconByHandle(iconList[2].hIcolib);
return 0;
}
void InitIcons()
{
- TCHAR path[MAX_PATH];
- GetModuleFileName(hInst,path,MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = MODULE;
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = path;
-
- sid.pszDescription = LPGEN("Disable");
- sid.pszName = MODULE "_remove";
- sid.iDefaultIndex = -IDI_HREMOVE;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Enable");
- sid.pszName = MODULE "_keep";
- sid.iDefaultIndex = -IDI_HKEEP;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Clear");
- sid.pszName = MODULE "_clear";
- sid.iDefaultIndex = -IDI_HCLEAR;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, MODULE, iconList, SIZEOF(iconList), MODULE);
ReloadIcons(0, 0);
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
-}
-
-void DeinitIcons() {
- if(hIcoLibIconsChanged)
- UnhookEvent(hIcoLibIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
diff --git a/plugins/NoHistory/src/icons.h b/plugins/NoHistory/src/icons.h index 88fae4be67..cfd2288c52 100644 --- a/plugins/NoHistory/src/icons.h +++ b/plugins/NoHistory/src/icons.h @@ -4,6 +4,5 @@ extern HICON hIconRemove, hIconKeep, hIconClear;
void InitIcons();
-void DeinitIcons();
#endif
|