summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/icons.cpp
blob: b1ee0142c0abf60f4785af70b5c1f61e66125492 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
Popup Plus plugin for Miranda IM

Copyright	© 2002 Luca Santarelli,
			© 2004-2007 Victor Pavlychko
			© 2010 MPK
			© 2010 Merlin_de

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.

===============================================================================

File name      : $HeadURL: http://svn.miranda.im/mainrepo/popup/trunk/src/icons.cpp $
Revision       : $Revision: 1610 $
Last change on : $Date: 2010-06-23 00:55:13 +0300 (Ср, 23 июн 2010) $
Last change by : $Author: Merlin_de $

===============================================================================
*/

#include "headers.h"

struct
{
	LPSTR	pszName;
	LPSTR	ptszDesc;
	LPSTR	ptszSection;
	WORD	idResource;
	LPSTR	pszIcon;
	int	size;
}
static icoDesc[] = 
{
	//toolbar
	{ ICO_TB_POPUP_ON,    "Popups are enabled",          SECT_TOLBAR,               IDI_POPUP,          NULL,  0 },
	{ ICO_TB_POPUP_OFF,   "Popups are disabled",         SECT_TOLBAR,               IDI_NOPOPUP,        NULL,  0 },

	//common popup
	{ ICO_POPUP_ON,       "Popups are enabled",          SECT_POPUP,                IDI_POPUP,          NULL,  0 },
	{ ICO_POPUP_OFF,      "Popups are disabled",         SECT_POPUP,                IDI_NOPOPUP,        NULL,  0 },
	{ ICO_FAV,            "With \"favourite\" overlay",  SECT_POPUP,                IDI_PU_FAVOURITE,   NULL,  0 },
	{ ICO_FULLSCREEN,     "With \"fullscreen\" overlay", SECT_POPUP,                IDI_PU_FULLSCREEN,  NULL,  0 },
	{ ICO_HISTORY,        "Popup History",               SECT_POPUP,                IDI_HISTORY,        NULL, -1 },

	//option
	{ ICO_OPT_RELOAD,     "Refresh skin list",           SECT_POPUP SECT_POPUP_OPT, IDI_RELOAD,         NULL,  0 },
	{ ICO_OPT_RESIZE,     "Popup Placement",             SECT_POPUP SECT_POPUP_OPT, IDI_RESIZE,         NULL,  0 },
	{ ICO_OPT_OK,         "OK",                          SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK,         NULL,  0 },
	{ ICO_OPT_CANCEL,     "Cancel",                      SECT_POPUP SECT_POPUP_OPT, IDI_ACT_CLOSE,      NULL,  0 },
	{ ICO_OPT_GROUP,      "Popup Group",                 SECT_POPUP SECT_POPUP_OPT, IDI_OPT_GROUP,      NULL,  0 },
	{ ICO_OPT_DEF,        "Show default",                SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK,         NULL,  0 },
	{ ICO_OPT_FAV,        "Favorite Contact",            SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FAVORITE,   NULL,  0 },
	{ ICO_OPT_FULLSCREEN, "Show in Fullscreen",          SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FULLSCREEN, NULL,  0 },
	{ ICO_OPT_BLOCK,      "Blocked Contact",             SECT_POPUP SECT_POPUP_OPT, IDI_OPT_BLOCK,      NULL,  0 },

	//action
	{ ICO_ACT_REPLY,      "Quick Reply",                 SECT_POPUP SECT_POPUP_ACT, IDI_ACT_REPLY,      NULL, -1 },
	{ ICO_ACT_PIN,        "Pin Popup",                   SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PIN,        NULL, -1 },
	{ ICO_ACT_PINNED,     "Pinned Popup",                SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PINNED,     NULL, -1 },
	{ ICO_ACT_MESS,       "Send Message",                SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MESSAGE,    NULL, -1 },
	{ ICO_ACT_INFO,       "User Details",                SECT_POPUP SECT_POPUP_ACT, IDI_ACT_INFO,       NULL, -1 },
	{ ICO_ACT_MENU,       "Contact Menu",                SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MENU,       NULL, -1 },
	{ ICO_ACT_ADD,        "Add Contact Permanently",     SECT_POPUP SECT_POPUP_ACT, IDI_ACT_ADD,        NULL, -1 },
	{ ICO_ACT_CLOSE,      "Dismiss Popup",               SECT_POPUP SECT_POPUP_ACT, IDI_ACT_CLOSE,      NULL, -1 },
	{ ICO_ACT_COPY,       "Copy to clipboard",           SECT_POPUP SECT_POPUP_ACT, IDI_ACT_COPY,       NULL, -1 }

};

/**
 * Returns a icon, identified by a name
 * @param	pszIcon		- name of the icon
 * @param	big			- bool big icon (default = false)
 * @return:	HICON if the icon is loaded, NULL otherwise
 **/
HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big)
{
	return (pszIcon) ? Skin_GetIcon(pszIcon, big) : NULL;
}

void InitIcons()
{
	TCHAR selfDLL[MAX_PATH];
	GetModuleFileName(hInst, selfDLL, SIZEOF(selfDLL));

	SKINICONDESC sid = { sizeof(sid) };
	sid.flags = SIDF_PATH_TCHAR;
	sid.ptszDefaultFile = selfDLL;

	for(int i=0; i < SIZEOF(icoDesc); i++) {
		sid.pszName = icoDesc[i].pszName;
		sid.pszDescription = icoDesc[i].ptszDesc;		// [TRANSLATED-BY-CORE]
		sid.pszSection = icoDesc[i].ptszSection;		//must be always untranslatet !!!!!
		sid.iDefaultIndex = -icoDesc[i].idResource;

		switch (icoDesc[i].size){
		// small and big icons
		case -1:
			sid.cx = sid.cy = 0;
			break;

		// small icons (16x16)
		case 0:
			sid.cx = sid.cy = 16;
			break;

		// normal icons (32x32)
		case 1:
			sid.cx = sid.cy = 32;
			break;

		// custom icon size
		default:
			sid.cx = sid.cy = icoDesc[i].size;
			break;
		}
		Skin_AddIcon(&sid);
	}
}