summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/IconLib.cpp
blob: 6976612005665ddf28f8c1af2916e0050437c926 (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
#include "StdAfx.h"

static IconItem iconList[] =
{
	{ LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
	{ LPGEN("Auto Update Disabled"), ICON_STR_AUTO_UPDATE_DISABLED, IDI_ICON_DISABLED },
	{ LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
	{ LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
	{ LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
	{ LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
	{ LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
	{ LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
	{ LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
	{ LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
	{ LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
	{ LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
};

void Quotes_IconsInit()
{
	::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
}

std::string Quotes_MakeIconName(const char* name)
{
	assert(name);
	//char szSettingName[100];
	//mir_snprintf(szSettingName,_countof(szSettingName),"%s_%s",QUOTES_PROTOCOL_NAME,name);
	std::string sName(QUOTES_PROTOCOL_NAME);
	sName += "_";
	sName += name;
	return sName;
}

HICON Quotes_LoadIconEx(const char* name, bool bBig /*= false*/)
{
	std::string sIconName = Quotes_MakeIconName(name);
	return IcoLib_GetIcon(sIconName.c_str(), bBig);
}

HANDLE Quotes_GetIconHandle(int iconId)
{
	for (int i = 0; i < _countof(iconList); i++)
		if (iconList[i].defIconID == iconId)
			return iconList[i].hIcolib;

	return NULL;
}