summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/icolib.cpp
blob: 7ee2a5e5fdb70208eec5c09c29daf22cee6ed6de (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
59
60
61
62
63
64
65
66
67
68
69
70
71
////////////////////////////////////////////////////////////////////////////////
// Gadu-Gadu Plugin for Miranda IM
//
// Copyright (c) 2003-2007 Adam Strzelecki <ono+miranda@java.pl>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
////////////////////////////////////////////////////////////////////////////////

#include "gg.h"

extern IconItem iconList[] =
{
	{ LPGEN("Protocol icon"),              "main",          IDI_GG },
	{ LPGEN("Import list from server"),    "importserver",  IDI_IMPORT_SERVER },
	{ LPGEN("Import list from text file"), "importtext",    IDI_IMPORT_TEXT },
	{ LPGEN("Remove list from server"),    "removeserver",  IDI_REMOVE_SERVER },
	{ LPGEN("Export list to server"),      "exportserver",  IDI_EXPORT_SERVER },
	{ LPGEN("Export list to text file"),   "exporttext",    IDI_EXPORT_TEXT },
	{ LPGEN("Account settings"),           "settings",      IDI_SETTINGS },
	{ LPGEN("Contact list"),               "list",          IDI_LIST },
	{ LPGEN("Block user"),                 "block",         IDI_BLOCK },
	{ LPGEN("Previous image"),             "previous",      IDI_PREV },
	{ LPGEN("Next image"),                 "next",          IDI_NEXT },
	{ LPGEN("Send image"),                 "image",         IDI_IMAGE },
	{ LPGEN("Save image"),                 "save",          IDI_SAVE },
	{ LPGEN("Delete image"),               "delete",        IDI_DELETE },
	{ LPGEN("Open new conference"),        "conference",    IDI_CONFERENCE },
	{ LPGEN("Clear ignored conferences"),  "clearignored",  IDI_CLEAR_CONFERENCE },
	{ LPGEN("Concurrent sessions"),        "sessions",      IDI_SESSIONS }
};

void gg_icolib_init()
{
	Icon_Register(g_hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
}

HICON LoadIconEx(const char* name, bool big)
{
	char szSettingName[100];
	mir_snprintf(szSettingName, "%s_%s", GGDEF_PROTO, name);

	return IcoLib_GetIcon(szSettingName, big);
}

HANDLE GetIconHandle(int iconId)
{
	for (const auto &icon : iconList)
		if (icon.defIconID == iconId)
			return icon.hIcolib;

	return nullptr;
}

void ReleaseIconEx(const char* name, bool big)
{
	char szSettingName[100];
	mir_snprintf(szSettingName, "%s_%s", GGDEF_PROTO, name);
	IcoLib_Release(szSettingName, big);
}