summaryrefslogtreecommitdiff
path: root/plugins/MetaContacts/src/icons.cpp
blob: 37762122891c555405f066ed120388de18ad3397 (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
#include "metacontacts.h"

struct
{
	char*  szDescr;
	char*  szName;
	int    defIconID;
	HANDLE hIcolib;
}
static iconList[] = {
	{ LPGEN("Toggle Off"),             "mc_off",     IDI_MCMENUOFF     },
	{ LPGEN("Toggle On"),              "mc_on",      IDI_MCMENU        },
	{ LPGEN("Convert to MetaContact"), "mc_convert", IDI_MCCONVERT     },
	{ LPGEN("Add to Existing"),        "mc_add",     IDI_MCADD         },
	{ LPGEN("Edit"),                   "mc_edit",    IDI_MCEDIT        },
	{ LPGEN("Set to Default"),         "mc_default", IDI_MCSETDEFAULT  },
	{ LPGEN("Remove"),                 "mc_remove",  IDI_MCREMOVE      },
};

HANDLE GetIconHandle(IconIndex i)
{
	return iconList[i].hIcolib;
}

HICON LoadIconEx(IconIndex i)
{
	return Skin_GetIcon(iconList[i].szName);
}

void InitIcons(void) 
{
	TCHAR path[MAX_PATH];
	GetModuleFileName(hInstance, path, SIZEOF(path));

	SKINICONDESC sid = { sizeof(sid) };
	sid.flags = SIDF_PATH_TCHAR;
	sid.pszSection = META_PROTO;
	sid.ptszDefaultFile = path;

	for (int i=0; i < SIZEOF(iconList); ++i) {
		sid.pszDescription = iconList[i].szDescr;
		sid.pszName = iconList[i].szName;
		sid.iDefaultIndex = -iconList[i].defIconID;
		iconList[i].hIcolib = Skin_AddIcon(&sid);
	}
}