From bed6bee936ff79d32c08245f0fedaee9d839f76f Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Thu, 28 Apr 2011 12:14:32 +0000 Subject: test rename git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@64 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- dbeditorpp/icons.cpp | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 dbeditorpp/icons.cpp (limited to 'dbeditorpp/icons.cpp') diff --git a/dbeditorpp/icons.cpp b/dbeditorpp/icons.cpp new file mode 100644 index 0000000..fb8248a --- /dev/null +++ b/dbeditorpp/icons.cpp @@ -0,0 +1,173 @@ +#include "headers.h" + +void addIcons(char* szModuleFileName) +{ + SKINICONDESC sid={0}; + char name[32]; + sid.cbSize = sizeof(sid); + sid.pszSection = Translate(modFullname); + sid.pszDefaultFile = szModuleFileName; + + // closed known module + sid.pszDescription = Translate("Closed Known Module"); + _snprintf(name,32,"DBE++_%d",ICO_KNOWN); + sid.pszName = name; + sid.iDefaultIndex = -ICO_KNOWN; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // open known module + sid.pszDescription = Translate("Open Known Module"); + _snprintf(name,32,"DBE++_%d",ICO_KNOWNOPEN); + sid.pszName = name;; + sid.iDefaultIndex = -ICO_KNOWNOPEN; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // closed unknown module + sid.pszDescription = Translate("Closed Unknown Module"); + _snprintf(name,32,"DBE++_%d",ICO_UNKNOWN); + sid.pszName = name; + sid.iDefaultIndex = -ICO_UNKNOWN; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // open unknown module + sid.pszDescription = Translate("Open Unknown Module"); + _snprintf(name,32,"DBE++_%d",ICO_UNKNOWNOPEN); + sid.pszName = name; + sid.iDefaultIndex = -ICO_UNKNOWNOPEN; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // settings contact + sid.pszDescription = Translate("Settings"); + _snprintf(name,32,"DBE++_%d",ICO_SETTINGS); + sid.pszName = name; + sid.iDefaultIndex = -ICO_SETTINGS; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // contact group + sid.pszDescription = Translate("Contacts Group"); + _snprintf(name,32,"DBE++_%d",ICO_CONTACTS); + sid.pszName = name; + sid.iDefaultIndex = -ICO_CONTACTS; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // unknwon contact + sid.pszDescription = Translate("Unknown Contact"); + _snprintf(name,32,"DBE++_%d",ICO_OFFLINE); + sid.pszName = name; + sid.iDefaultIndex = -ICO_OFFLINE; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); + + // known contact + sid.pszDescription = Translate("Known Contact"); + _snprintf(name,32,"DBE++_%d",ICO_ONLINE); + sid.pszName = name; + sid.iDefaultIndex = -ICO_ONLINE; + CallService(MS_SKIN2_ADDICON,0,(LPARAM)&sid); +} + +HICON LoadSkinnedDBEIcon(int icon) +{ + HICON hIcon = 0; + if (UsingIconManager) + { + char name[32]; + _snprintf(name,32,"DBE++_%d",icon); + + hIcon = (HICON)CallService(MS_SKIN2_GETICON,0,(LPARAM)name); + } + if (!hIcon) + return LoadIcon(hInst, MAKEINTRESOURCE(icon)); + else + return hIcon; +} + + +int AddIconToList(HIMAGELIST hil, HICON hIcon) +{ + + if (!hIcon || !hil) return 0; + + ImageList_AddIcon(hil, hIcon); + + return 1; + +} + + +static PROTOCOLDESCRIPTOR **protocols = NULL; +static int protoCount = 0; +static int shift = 0; + + +void AddProtoIconsToList(HIMAGELIST hil, int newshift) +{ + HICON hIcon; + int i; + shift = newshift; + + CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&protoCount,(LPARAM)&protocols); + + for(i = 0 ;i < protoCount; i++) + { + if (protocols[i]->type != PROTOTYPE_PROTOCOL) + continue; + + if (hIcon=LoadSkinnedProtoIcon(protocols[i]->szName, ID_STATUS_ONLINE)) + AddIconToList(hil, hIcon); + else + AddIconToList(himl, LoadSkinnedDBEIcon(ICO_ONLINE)); + } +} + + +int GetProtoIcon(char *szProto) +{ + int result = DEF_ICON; + int i, n = 0; + + if (!protoCount || !protocols || !szProto) return result; + + for(i = 0 ;i < protoCount; i++) + { + if (protocols[i]->type != PROTOTYPE_PROTOCOL) + continue; + + if (!mir_strcmp(protocols[i]->szName, szProto)) + { + result = n + shift; + break; + } + + n++; + + } + + return result; +} + + +BOOL IsProtocolLoaded(char* pszProtocolName) +{ +/* + if (pszProtocolName && pszProtocolName[0]) + { + int res = CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pszProtocolName); + + if (res != CALLSERVICE_NOTFOUND && res) + return TRUE; + } +*/ + int i; + + if (protoCount) + for(i = 0 ;i < protoCount; i++) + { + if (protocols[i]->type != PROTOTYPE_PROTOCOL) + continue; + + if (!mir_strcmp(protocols[i]->szName, pszProtocolName)) + return TRUE; + } + + return FALSE; +} -- cgit v1.2.3