summaryrefslogtreecommitdiff
path: root/include/m_extraicons.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-19 12:51:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-19 12:51:53 +0000
commit32dedc767dec565c576b78b786e7a95d76ac806e (patch)
tree0f2eb209b3716569a8e3c3ef146a91f402ebbb4d /include/m_extraicons.h
parentadf7367cfdb57b32aadeb74af45dce9a6a3c02a5 (diff)
- 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
Diffstat (limited to 'include/m_extraicons.h')
-rw-r--r--include/m_extraicons.h40
1 files changed, 28 insertions, 12 deletions
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);
}