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 ++++++++++++++++++++++++++++------------ include/m_icq.h | 2 +- include/m_netlib.h | 2 +- 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'include') 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); } diff --git a/include/m_icq.h b/include/m_icq.h index e2378e3e7e..125eeef885 100644 --- a/include/m_icq.h +++ b/include/m_icq.h @@ -263,7 +263,7 @@ typedef struct { // Called from contact list in order to get index of custom status icon in list // wParam = hContact // lParam = 0 -// rerurn = (int) index of extra contact icon shifted <<16 (the low word will be normal status icon, the high will be xStatus Icon +// rerurn = (int)index of extra contact icon shifted <<16 (the low word will be normal status icon, the high will be xStatus Icon #define PS_ICQ_GETADVANCEDSTATUSICON "/GetAdvancedStatusIcon" #endif // M_ICQ_H__ diff --git a/include/m_netlib.h b/include/m_netlib.h index 83b469e9c0..62b7512b69 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -435,7 +435,7 @@ typedef struct { // Converts numerical representation of IP in SOCKADDR_INET into string representation with IP and port // IPv4 will be supplied in formats address:port or address // IPv6 will be supplied in formats [address]:port or [address] -// wParam = (WPARAM)(int) 0 - lParam - (sockaddr_gen*); 1 - lParam - (unsigned) in host byte order +// wParam = (WPARAM)(int)0 - lParam - (sockaddr_gen*); 1 - lParam - (unsigned) in host byte order // lParam = (LPARAM)(sockaddr_gen*) or (unsigned) numeric IP address structure // Returns pointer to the string or NULL if not successful #define MS_NETLIB_ADDRESSTOSTRING "Netlib/AddressToString" -- cgit v1.2.3