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

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

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(iconList); i++) 
	{
		::mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, iconList[i].Name);

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

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