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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/*
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org)
Copyright (c) 2000-08 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
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.
*/
#ifndef M_ICOLIB_H__
#define M_ICOLIB_H__ 1
extern int hLangpack;
///////////////////////////////////////////////////////////////////////////////
// WARNING: do not use Translate(TS) for p(t)szSection or p(t)szDescription as they
// are translated by the core, which may lead to double translation.
// Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl".
typedef struct {
size_t cbSize;
union {
char *pszSection; // section name used to group icons
TCHAR *ptszSection; // [TRANSLATED-BY-CORE]
WCHAR *pwszSection;
};
union {
char *pszDescription; // description for options dialog
TCHAR *ptszDescription; // [TRANSLATED-BY-CORE]
WCHAR *pwszDescription;
};
char *pszName; // name to refer to icon when playing and in db
union {
char *pszDefaultFile; // default icon file to use
TCHAR *ptszDefaultFile;
WCHAR *pwszDefaultFile;
};
int iDefaultIndex; // index of icon in default file
HICON hDefaultIcon; // handle to default icon
int cx,cy; // dimensions of icon (if 0 then standard size icon (big and small options available)
int flags; // combination of SIDF_*
} SKINICONDESC;
#define SIDF_SORTED 0x01 // Icons in section are sorted by name
#define SIDF_UNICODE 0x100 // Section and Description are in UCS-2
#define SIDF_PATH_UNICODE 0x200 // Default File is in UCS-2
#define SIDF_ALL_UNICODE SIDF_PATH_UNICODE | SIDF_UNICODE
#if defined(_UNICODE)
#define SIDF_TCHAR SIDF_UNICODE
#define SIDF_PATH_TCHAR SIDF_PATH_UNICODE
#define SIDF_ALL_TCHAR SIDF_ALL_UNICODE
#else
#define SIDF_TCHAR 0
#define SIDF_PATH_TCHAR 0
#define SIDF_ALL_TCHAR 0
#endif
///////////////////////////////////////////////////////////////////////////////
// Adds an icon into options UI
//
// wParam = (WPARAM)0
// lParam = (LPARAM)(SKINICONDESC*)sid;
// returns a handle to the newly added item
__forceinline HANDLE Skin_AddIcon(SKINICONDESC* si)
{ return (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)si);
}
///////////////////////////////////////////////////////////////////////////////
// Removes an icon from options UI
//
// wParam = (WPARAM)(HANDLE)hIcolib (optional)
// lParam = (LPARAM)(char*)pszName (optional)
// at least one needs to be specified
#define MS_SKIN2_REMOVEICON "Skin2/Icons/RemoveIcon"
__forceinline void Skin_RemoveIcon(const char* szIconName)
{ CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)szIconName);
}
__forceinline void Skin_RemoveIconHandle(HANDLE hIcolib)
{ CallService(MS_SKIN2_REMOVEICON, (WPARAM)hIcolib, 0);
}
///////////////////////////////////////////////////////////////////////////////
// Retrieves HICON with the name specified in lParam
//
// wParam = (WPARAM)0 - small 1 - big
// lParam = (LPARAM)(char*)pszName
// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
#define MS_SKIN2_GETICON "Skin2/Icons/GetIcon"
#ifdef __cplusplus
__forceinline HICON Skin_GetIcon(const char* szIconName, int size=0)
#else
__forceinline HICON Skin_GetIcon(const char* szIconName, int size)
#endif
{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
}
///////////////////////////////////////////////////////////////////////////////
// Retrieves an icolib handle by the icon's name specified in lParam
//
// wParam = (WPARAM)0
// lParam = (LPARAM)(char*)pszName
#define MS_SKIN2_GETICONHANDLE "Skin2/Icons/GetIconHandle"
__forceinline HANDLE Skin_GetIconHandle(const char* szIconName)
{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
}
///////////////////////////////////////////////////////////////////////////////
// Retrieves HICON with HANDLE specified in lParam
//
// wParam = (WPARAM)0 - small 1 - big
// lParam = (LPARAM)(HANDLE)hIcoLibIcon
// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
#define MS_SKIN2_GETICONBYHANDLE "Skin2/Icons/GetIconByHandle"
#ifdef __cplusplus
__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size=0)
#else
__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size)
#endif
{ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon);
}
///////////////////////////////////////////////////////////////////////////////
// Adds a reference to HICON
//
// wParam = (WPARAM)HICON
// lParam = 0 - small 1 - big
#define MS_SKIN2_ADDREFICON "Skin2/Icons/AddRef"
///////////////////////////////////////////////////////////////////////////////
// Retrieved HICON is not needed anymore (releases a reference; thus helps to optimize GDI usage)
//
// wParam = (WPARAM)HICON (optional)
// lParam = (LPARAM)(char*)pszName (optional) // at least one needs to be specified
#define MS_SKIN2_RELEASEICON "Skin2/Icons/ReleaseIcon"
#define MS_SKIN2_RELEASEICONBIG "Skin2/Icons/ReleaseIconBig"
__forceinline void Skin_ReleaseIcon(const char* szIconName)
{ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
}
#ifdef __cplusplus
__forceinline void Skin_ReleaseIcon(const char* szIconName, int big)
{ CallService((big) ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
}
__forceinline void Skin_ReleaseIcon(HICON hIcon)
#else
__forceinline void Skin_ReleaseIcon2(HICON hIcon)
#endif
{ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
}
///////////////////////////////////////////////////////////////////////////////
// Checks whether HICON is managed by IcoLib
//
// wParam = (WPARAM)HICON
// lParam = 0
#define MS_SKIN2_ISMANAGEDICON "Skin2/Icons/IsManaged"
///////////////////////////////////////////////////////////////////////////////
// Icons' change notification
#define ME_SKIN2_ICONSCHANGED "Skin2/IconsChanged"
#endif /* M_ICOLIB_H__ */
|