From 32dedc767dec565c576b78b786e7a95d76ac806e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 19 Nov 2012 12:51:53 +0000 Subject: - added another helper, ExtraIcon_Clear, to remove an icon from slot; - added ability to pass IcoLib handles instead of icons' names git-svn-id: http://svn.miranda-ng.org/main/trunk@2371 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_extraicons.h | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'include/m_extraicons.h') diff --git a/include/m_extraicons.h b/include/m_extraicons.h index 921346ad3c..2d38fe7db4 100644 --- a/include/m_extraicons.h +++ b/include/m_extraicons.h @@ -117,11 +117,12 @@ typedef struct { typedef struct { int cbSize; - HANDLE hExtraIcon; // Value returned by MS_EXTRAICON_REGISTER - HANDLE hContact; // Contact to set the extra icon - union { // The icon to be set. This depends on the type of the extra icon: - HANDLE hImage; // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK) - const char *icoName; // Name of the icon registered with icolib (if EXTRAICON_TYPE_ICOLIB) + HANDLE hExtraIcon; // Value returned by MS_EXTRAICON_REGISTER + HANDLE hContact; // Contact to set the extra icon + union { // The icon to be set. This depends on the type of the extra icon: + HANDLE hImage; // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK) + // or the icolib icon handle (if EXTRAICON_TYPE_ICOLIB) + const char *icoName; // Name of the icon registered with icolib (if EXTRAICON_TYPE_ICOLIB) }; } EXTRAICON; @@ -130,15 +131,19 @@ typedef struct { // Return: 0 on success #define MS_EXTRAICON_SET_ICON "ExtraIcon/SetIcon" - +// Set an extra icon by icolib icon's name +// wParam = (EXTRAICON *) Extra icon +// Return: 0 on success +#define MS_EXTRAICON_SET_ICON_BY_NAME "ExtraIcon/SetIconByName" #ifndef _NO_WRAPPERS #ifdef __cplusplus -static HANDLE ExtraIcon_Register(const char *name, const char *description, const char *descIcon, - MIRANDAHOOK RebuildIcons, - MIRANDAHOOK ApplyIcon, - MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0) +static HANDLE ExtraIcon_Register( + const char *name, const char *description, const char *descIcon, + MIRANDAHOOK RebuildIcons, + MIRANDAHOOK ApplyIcon, + MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0) { if (!ServiceExists(MS_EXTRAICON_REGISTER)) return NULL; @@ -156,8 +161,9 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, 0); } -static HANDLE ExtraIcon_Register(const char *name, const char *description, const char *descIcon = NULL, - MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0) +static HANDLE ExtraIcon_Register( + const char *name, const char *description, const char *descIcon = NULL, + MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0) { if (!ServiceExists(MS_EXTRAICON_REGISTER)) return NULL; @@ -190,6 +196,16 @@ static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, const char *ico ei.hContact = hContact; ei.icoName = icoName; + return CallService(MS_EXTRAICON_SET_ICON_BY_NAME, (WPARAM) &ei, 0); +} + +static int ExtraIcon_Clear(HANDLE hExtraIcon, HANDLE hContact) +{ + EXTRAICON ei = { sizeof(ei) }; + ei.hExtraIcon = hExtraIcon; + ei.hContact = hContact; + ei.icoName = NULL; + return CallService(MS_EXTRAICON_SET_ICON, (WPARAM) &ei, 0); } -- cgit v1.2.3