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
|
/*
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (c) 2012-18 Miranda NG team (https://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
#ifndef M_CORE_H__
#include <m_core.h>
#endif
///////////////////////////////////////////////////////////////////////////////
// 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".
#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
struct SKINICONDESC
{
MAllStrings section; // section name used to group icons
MAllStrings description; // description for options dialog
char *pszName; // name to refer to icon when playing and in db
MAllStrings defaultFile; // default icon file to use
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_*
};
#if defined(__cplusplus)
extern "C"
{
#endif
///////////////////////////////////////////////////////////////////////////////
// Adds an icon into the icon library
// returns a handle to the newly added item
MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _lang = hLangpack);
///////////////////////////////////////////////////////////////////////////////
// Removes an icon from icon library by icon's name or handle
MIR_APP_DLL(void) IcoLib_RemoveIcon(const char *pszIconName);
MIR_APP_DLL(void) IcoLib_RemoveIconByHandle(HANDLE hItem);
///////////////////////////////////////////////////////////////////////////////
// Retrieves HICON with the name specified in lParam
// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
MIR_APP_DLL(HICON) IcoLib_GetIcon(const char *pszIconName, bool big = false);
MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big = false);
///////////////////////////////////////////////////////////////////////////////
// Retrieves an icolib handle by the icon's name specified in lParam
MIR_APP_DLL(HANDLE) IcoLib_GetIconHandle(const char *pszIconName);
///////////////////////////////////////////////////////////////////////////////
// Adds 1 to an icon's ref counter. prevents an icon from being unloaded
MIR_APP_DLL(int) IcoLib_AddRef(HICON hIcon);
///////////////////////////////////////////////////////////////////////////////
// Retrieved HICON is not needed anymore (releases a reference; thus helps to optimize GDI usage)
MIR_APP_DLL(int) IcoLib_Release(const char *pszIconName, bool big = false);
MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, bool big = false);
///////////////////////////////////////////////////////////////////////////////
// Checks whether HICON is managed by IcoLib
MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon);
///////////////////////////////////////////////////////////////////////////////
// Helper to apply an icolib's icon to a button
MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId, const char* tooltip);
MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
///////////////////////////////////////////////////////////////////////////////
// Helper to apply an icolib's icon to a window
MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, HANDLE hIcolib);
MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(HWND hWnd, int iconId);
MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId);
MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
///////////////////////////////////////////////////////////////////////////////
// Icons' change notification event
#define ME_SKIN2_ICONSCHANGED "Skin2/IconsChanged"
///////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(void) KillModuleIcons(int hLangpack);
#if defined(__cplusplus)
}
#endif
#endif /* M_ICOLIB_H__ */
|