summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_icons.cpp
blob: edd4f0d316837c6199ebf537a6b0c5f15263ab8f (plain)
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
#include "skype_proto.h"

_tag_iconList CSkypeProto::IconList[] =
{
	{ LPGENT("Protocol icon"),			"main",				IDI_ICON },

	{ LPGENT("Call"),					"call",				IDI_CALL },
	{ LPGENT("Invite to conference"),	"confInvite",		IDI_CONF_INVITE },
	{ LPGENT("Spawn conference"),		"confSpawn",		IDI_CONF_SPAWN },
	{ LPGENT("Revoke authorization"),	"authRevoke",		IDI_AUTH_REVOKE },
	{ LPGENT("Request authorization"),	"authRequest",		IDI_AUTH_REQUEST },
	{ LPGENT("Grant authorization"),	"authGrant",		IDI_AUTH_GRANT },
	{ LPGENT("Send contact"),			"sendContacts",		IDI_SEND_CONTACTS },
};

void CSkypeProto::InitIcons()
{
	wchar_t szFile[MAX_PATH];
	::GetModuleFileName(g_hInstance, szFile, MAX_PATH);

	char szSettingName[100];
	wchar_t szSectionName[100];

	SKINICONDESC sid = {0};
	sid.cbSize = sizeof(SKINICONDESC);
	sid.flags = SIDF_ALL_TCHAR;
	sid.ptszDefaultFile = szFile;
	sid.pszName = szSettingName;
	sid.ptszSection = szSectionName;

	::mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
	for (int i = 0; i < SIZEOF(CSkypeProto::IconList); i++) 
	{
		::mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, CSkypeProto::IconList[i].Name);

		sid.ptszDescription = CSkypeProto::IconList[i].Description;
		sid.iDefaultIndex = -CSkypeProto::IconList[i].IconId;
		CSkypeProto::IconList[i].Handle = ::Skin_AddIcon(&sid);
	}	
}

HANDLE CSkypeProto::GetIconHandle(const char* name)
{
	for (size_t i = 0; i < SIZEOF(CSkypeProto::IconList); i++)
	{
		if (::stricmp(CSkypeProto::IconList[i].Name, name) == 0)
			return CSkypeProto::IconList[i].Handle;
	}
	return 0;
}

void CSkypeProto::UninitIcons()
{
	for (size_t i = 0; i < SIZEOF(CSkypeProto::IconList); i++)
	{
		::Skin_RemoveIcon(CSkypeProto::IconList[i].Name);
	}
}