summaryrefslogtreecommitdiff
path: root/protocols/Tlen/src
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 /protocols/Tlen/src
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 'protocols/Tlen/src')
-rw-r--r--protocols/Tlen/src/tlen.cpp67
1 files changed, 19 insertions, 48 deletions
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 8d6e8a5b0d..8fa54107fd 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -80,36 +80,31 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
return interfaces;
}
-struct
+static IconItem iconList[] =
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
-{
- { LPGENT("Protocol icon"), "PROTO", IDI_TLEN },
- { LPGENT("Tlen inbox"), "MAIL", IDI_MAIL },
- { LPGENT("Group chats"), "MUC", IDI_MUC },
- { LPGENT("Tlen chats"), "CHATS", IDI_CHATS },
- { LPGENT("Grant authorization"), "GRANT", IDI_GRANT },
- { LPGENT("Request authorization"), "REQUEST", IDI_REQUEST },
- { LPGENT("Voice chat"), "VOICE", IDI_VOICE },
- { LPGENT("Microphone"), "MICROPHONE", IDI_MICROPHONE },
- { LPGENT("Speaker"), "SPEAKER", IDI_SPEAKER },
- { LPGENT("Send image"), "IMAGE", IDI_IMAGE }
+ { LPGEN("Protocol icon"), "PROTO", IDI_TLEN },
+ { LPGEN("Tlen inbox"), "MAIL", IDI_MAIL },
+ { LPGEN("Group chats"), "MUC", IDI_MUC },
+ { LPGEN("Tlen chats"), "CHATS", IDI_CHATS },
+ { LPGEN("Grant authorization"), "GRANT", IDI_GRANT },
+ { LPGEN("Request authorization"), "REQUEST", IDI_REQUEST },
+ { LPGEN("Voice chat"), "VOICE", IDI_VOICE },
+ { LPGEN("Microphone"), "MICROPHONE", IDI_MICROPHONE },
+ { LPGEN("Speaker"), "SPEAKER", IDI_SPEAKER },
+ { LPGEN("Send image"), "IMAGE", IDI_IMAGE }
};
-static HANDLE GetIconHandle(int iconId) {
- int i;
- for (i = 0; i < SIZEOF(iconList); i++)
+static HANDLE GetIconHandle(int iconId)
+{
+ for (int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
- return iconList[i].hIconLibItem;
+ return iconList[i].hIcolib;
+
return NULL;
}
-HICON GetIcolibIcon(int iconId) {
+HICON GetIcolibIcon(int iconId)
+{
HANDLE handle = GetIconHandle(iconId);
if (handle != NULL)
return Skin_GetIconByHandle(handle);
@@ -121,33 +116,9 @@ void ReleaseIcolibIcon(HICON hIcon) {
Skin_ReleaseIcon(hIcon);
}
-/*
-static int TlenIconsChanged(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-*/
-
static void TlenRegisterIcons()
{
- TCHAR path[MAX_PATH], szSectionName[100];
- mir_sntprintf(szSectionName, SIZEOF( szSectionName ), _T("%s/%s"), _T("Protocols"), _T("Tlen"));
- GetModuleFileName(hInst, path, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszSection = szSectionName;
- sid.ptszDefaultFile = path;
- sid.flags = SIDF_ALL_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "TLEN_%s", iconList[i].szName );
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);;
- }
+ Icon_Register(hInst, "Protocols/Tlen", iconList, SIZEOF(iconList), "TLEN");
}
int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)