summaryrefslogtreecommitdiff
path: root/plugins/MirOTR
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/MirOTR
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (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/MirOTR')
-rw-r--r--plugins/MirOTR/MirOTR/src/dllmain.cpp1
-rw-r--r--plugins/MirOTR/MirOTR/src/icons.cpp51
-rw-r--r--plugins/MirOTR/MirOTR/src/icons.h1
3 files changed, 11 insertions, 42 deletions
diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp
index e9d04647d6..4e5e0f91c9 100644
--- a/plugins/MirOTR/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp
@@ -145,7 +145,6 @@ DLLFUNC int Unload(void)
otrl_userstate_free(otr_user_state);
lib_cs_unlock();
- DeinitIcons();
DeinitUtils();
return 0;
diff --git a/plugins/MirOTR/MirOTR/src/icons.cpp b/plugins/MirOTR/MirOTR/src/icons.cpp
index 10f140ff22..aa20796b58 100644
--- a/plugins/MirOTR/MirOTR/src/icons.cpp
+++ b/plugins/MirOTR/MirOTR/src/icons.cpp
@@ -2,54 +2,25 @@
#include "icons.h"
TCHAR g_dllpath[1024];
-struct
-{
- const TCHAR* stzDescr;
- const char* szName;
- int defIconID;
-}
-static iconList[] = {
- { _T(LANG_ICON_OTR), ICON_OTR, IDI_OTR },
- { _T(LANG_ICON_PRIVATE), ICON_PRIVATE, IDI_PRIVATE },
- { _T(LANG_ICON_UNVERIFIED), ICON_UNVERIFIED, IDI_UNVERIFIED },
- { _T(LANG_ICON_FINISHED), ICON_FINISHED, IDI_FINISHED },
- { _T(LANG_ICON_NOT_PRIVATE), ICON_NOT_PRIVATE, IDI_INSECURE }
-
+static IconItem iconList[] = {
+ { LPGEN(LANG_ICON_OTR), ICON_OTR, IDI_OTR },
+ { LPGEN(LANG_ICON_PRIVATE), ICON_PRIVATE, IDI_PRIVATE },
+ { LPGEN(LANG_ICON_UNVERIFIED), ICON_UNVERIFIED, IDI_UNVERIFIED },
+ { LPGEN(LANG_ICON_FINISHED), ICON_FINISHED, IDI_FINISHED },
+ { LPGEN(LANG_ICON_NOT_PRIVATE), ICON_NOT_PRIVATE, IDI_INSECURE }
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
-void InitIcons() {
- TCHAR szFile[MAX_PATH+500];
-
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.ptszSection = _T(MODULENAME);
- sid.flags = SIDF_ALL_TCHAR;
-
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- sid.pszName = (char*)iconList[i].szName;
- sid.ptszDescription = (TCHAR*)iconList[i].stzDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
-
-}
-
-void DeinitIcons() {
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- (HANDLE)CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)iconList[i].szName);
- hIconLibItem[i] = NULL;
- }
+void InitIcons()
+{
+ Icon_Register(hInst, MODULENAME, iconList, SIZEOF(iconList));
}
HICON LoadIcon(const char* name, int big) {
return Skin_GetIcon(name, big);
}
-HANDLE GetIconHandle(const char* name) {
+HANDLE GetIconHandle(const char* name)
+{
return Skin_GetIconHandle(name);
}
diff --git a/plugins/MirOTR/MirOTR/src/icons.h b/plugins/MirOTR/MirOTR/src/icons.h
index 0983cc147c..2a8e774dfa 100644
--- a/plugins/MirOTR/MirOTR/src/icons.h
+++ b/plugins/MirOTR/MirOTR/src/icons.h
@@ -6,7 +6,6 @@
#define ICON_OTR (MODULENAME"_otr")
void InitIcons();
-void DeinitIcons();
HICON LoadIcon(const char* name, int big);
HANDLE GetIconHandle(const char* name);
void ReleaseIcon(const char* name, int big);