1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#include "headers.h"
HIMAGELIST himl;
IconItem iconList[] = {
{ LPGENT("Main icon"), "DBE++_0", ICO_DBE_BUTT },
{ LPGENT("Closed known module"), "DBE++_1", ICO_KNOWN },
{ LPGENT("Open known module"), "DBE++_2", ICO_KNOWNOPEN },
{ LPGENT("Settings"), "DBE++_5", ICO_SETTINGS },
{ LPGENT("Contacts group"), "DBE++_6", ICO_CONTACTS },
{ LPGENT("Unknown contact"), "DBE++_7", ICO_OFFLINE },
{ LPGENT("Known contact"), "DBE++_8", ICO_ONLINE },
{ LPGENT("Open user tree"), "DBE++_9", ICO_REGUSER },
{ LPGENT("BLOB setting"), "DBE++_BINARY", ICO_BINARY },
{ LPGENT("Byte setting"), "DBE++_BYTE", ICO_BYTE },
{ LPGENT("Word setting"), "DBE++_WORD", ICO_WORD },
{ LPGENT("Dword setting"), "DBE++_DWORD", ICO_DWORD },
{ LPGENT("String setting"), "DBE++_STRING", ICO_STRING },
{ LPGENT("Unicode setting"), "DBE++_UNICODE", ICO_UNICODE },
{ LPGENT("Handle"), "DBE++_HANDLE", ICO_HANDLE }
};
void addIcons(void)
{
Icon_Register(hInst, modFullname, iconList, SIZEOF(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
{
for (int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == icon)
return IcoLib_GetIconByHandle(iconList[i].hIcolib);
return LoadIcon(hInst, MAKEINTRESOURCE(icon));
}
int AddIconToList(HIMAGELIST hil, HICON hIcon)
{
if (!hIcon || !hil)
return 0;
ImageList_AddIcon(hil, hIcon);
return 1;
}
static PROTOACCOUNT **protocols = NULL;
static int protoCount = 0;
static int shift = 0;
void AddProtoIconsToList(HIMAGELIST hil, int newshift)
{
shift = newshift;
ProtoEnumAccounts(&protoCount, &protocols);
for (int i = 0; i < protoCount; i++) {
HICON hIcon;
if (hIcon = LoadSkinnedProtoIcon(protocols[i]->szModuleName, ID_STATUS_ONLINE))
AddIconToList(hil, hIcon);
else
AddIconToList(himl, LoadSkinnedDBEIcon(ICO_ONLINE));
}
}
int GetProtoIcon(char *szProto)
{
if (!protoCount || !protocols || !szProto)
return DEF_ICON;
int n = 0;
for (int i = 0; i < protoCount; i++) {
if (!mir_strcmp(protocols[i]->szModuleName, szProto))
return n + shift;
n++;
}
return DEF_ICON;
}
BOOL IsProtocolLoaded(char *pszProtocolName)
{
if (protoCount)
for (int i = 0; i < protoCount; i++)
if (!mir_strcmp(protocols[i]->szModuleName, pszProtocolName))
return TRUE;
return FALSE;
}
|