From ecb177cadbcff850a16c4b9e306beb15f61ac6f9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 4 Nov 2012 18:51:53 +0000 Subject: kernel extraicons, part II git-svn-id: http://svn.miranda-ng.org/main/trunk@2188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_clc.h | 4 ++-- include/m_clistint.h | 7 ++++++ include/m_clui.h | 1 - include/m_cluiframes.h | 58 -------------------------------------------------- include/m_extraicons.h | 41 ++++++++++++++++++++++++----------- 5 files changed, 38 insertions(+), 73 deletions(-) (limited to 'include') diff --git a/include/m_clc.h b/include/m_clc.h index c71378bf54..969f5aee21 100644 --- a/include/m_clc.h +++ b/include/m_clc.h @@ -185,14 +185,15 @@ typedef struct { #define CLGN_PREVIOUSCONTACT 6 #define CLGN_NEXTGROUP 7 #define CLGN_PREVIOUSGROUP 8 + #define CLM_GETNEXTITEM (CLM_FIRST+50) //wParam = flag, lParam = hItem, returns an hItem #define CLM_GETTEXTCOLOR (CLM_FIRST+51) //wParam = FONTID_, returns COLORREF #define CLM_SETTEXTCOLOR (CLM_FIRST+52) //wParam = FONTID_, lParam = COLORREF -//DO NOT USE IT EXTERNALLY CAN BE NOT SUPPORTED BY CLIST #define CLM_SETWIDEEXTRAIMAGE (CLM_FIRST+60) //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based), iImage). iImage = 0xFFFF is a blank #define CLM_GETWIDEEXTRAIMAGE (CLM_FIRST+61) //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based), 0), returns iImage or 0xFF #define CLM_GETWIDEEXTRAIMAGELIST (CLM_FIRST+62) //returns HWIDEIMAGELIST +#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+63) //wParam=extra space between icons //notifications (most are omitted because the control processes everything) #define CLNF_ISGROUP 1 @@ -278,4 +279,3 @@ typedef struct { #define MS_CLC_GETINFOTIPHOVERTIME "CLC/GetInfoTipHoverTime" #endif // M_CLC_H__ - diff --git a/include/m_clistint.h b/include/m_clistint.h index af87b3f114..e82c39d565 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -467,6 +467,13 @@ typedef struct *************************************************************************************/ int (*pfnGetAccountIndexByPos)(int pos); int (*pfnConvertMenu)(CLISTMENUITEM*, TMO_MenuItem*); + + /************************************************************************************* + * version 7 additions (0.11.0.x) - extra images + *************************************************************************************/ + HIMAGELIST hExtraImageList; + void (*pfnReloadExtraIcons)(void); + void (*pfnSetAllExtraIcons)(HWND hwndList,HANDLE hContact); } CLIST_INTERFACE; diff --git a/include/m_clui.h b/include/m_clui.h index 9b4ae4977b..bd636dc407 100644 --- a/include/m_clui.h +++ b/include/m_clui.h @@ -152,7 +152,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // modern layered return 0x07 (assuming classic, mw, meta, nicer1, modern1, nicer++, modernLayered) // +0x0100 for unicode #define CLUIF2_EXTRACOLUMNCOUNT 3 // return max number of extra icon available to be set in main window -#define CLUIF2_USEREXTRASTART 4 // return index of first 'advanced' image except Adv1 and Adv2 #define MS_CLUI_GETCAPS "CLUI/GetCaps" diff --git a/include/m_cluiframes.h b/include/m_cluiframes.h index e2c12f3e72..89b36c2f3c 100644 --- a/include/m_cluiframes.h +++ b/include/m_cluiframes.h @@ -24,64 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_genmenu.h" #endif -//Extra columns type. -//column arranged in this way -// -// [statusicon] ContactName [WEB][ADV1][ADV2][SMS][EMAIL][PROTO][CLIENT] -// -#define EXTRA_ICON_RES0 0 // only used by nicer -#define EXTRA_ICON_EMAIL 1 -#define EXTRA_ICON_PROTO 2 // used by mwclist and modern -#define EXTRA_ICON_RES1 2 // only used by nicer -#define EXTRA_ICON_SMS 3 -#define EXTRA_ICON_ADV1 4 -#define EXTRA_ICON_ADV2 5 -#define EXTRA_ICON_WEB 6 -#define EXTRA_ICON_CLIENT 7 -#define EXTRA_ICON_VISMODE 8 // only used by modern -#define EXTRA_ICON_RES2 8 // only used by nicer -#define EXTRA_ICON_ADV3 9 -#define EXTRA_ICON_ADV4 10 - -#ifndef EXTRA_ICON_COUNT -#define EXTRA_ICON_COUNT 10 // define this inside clist-plugin depending on used icon slots -#endif - -typedef struct -{ - int cbSize; //must be sizeof(IconExtraColumn) - int ColumnType; - HANDLE hImage; //return value from MS_CLIST_EXTRA_ADD_ICON -}IconExtraColumn,*pIconExtraColumn; - -//Set icon for contact at needed column -//wparam=hContact -//lparam=pIconExtraColumn -//return 0 on success,-1 on failure -// -//See above for supported columns -#define MS_CLIST_EXTRA_SET_ICON "CListFrames/SetIconForExraColumn" - -//Adding icon to extra image list. -//Call this in ME_CLIST_EXTRA_LIST_REBUILD event -// -//wparam=hIcon -//lparam=0 -//return hImage on success,-1 on failure -#define MS_CLIST_EXTRA_ADD_ICON "CListFrames/AddIconToExtraImageList" - -#define ME_CLIST_EXTRA_LIST_REBUILD "CListFrames/OnExtraListRebuild" - -//called with wparam=hContact -#define ME_CLIST_EXTRA_IMAGE_APPLY "CListFrames/OnExtraImageApply" - -//called with wparam=hContact lparam=extra -#define ME_CLIST_EXTRA_CLICK "CListFrames/OnExtraClick" - -//End of extra images header. TODO move it to separate m_extraimages.h file -//Cause it has not any relationship to cluiframes engine - - /************************************************************************/ /* CLUI Frames Support */ /************************************************************************/ diff --git a/include/m_extraicons.h b/include/m_extraicons.h index 1e86cb168e..584950544f 100644 --- a/include/m_extraicons.h +++ b/include/m_extraicons.h @@ -20,6 +20,26 @@ #ifndef __M_EXTRAICONS_H__ #define __M_EXTRAICONS_H__ +#ifndef EXTRA_ICON_COUNT +#define EXTRA_ICON_COUNT 10 +#endif + +// Adding icon to extra image list. +// Used for EXTRAICON_TYPE_CALLBACK extra icons +// +// wparam = (HICON)hIcon +// lparam = 0 (unused) +// return HANDLE hImage on success or INVALID_HANDLE_VALUE on failure +#define MS_CLIST_EXTRA_ADD_ICON "CListFrames/AddIconToExtraImageList" + +//called with wparam=hContact +#define ME_CLIST_EXTRA_IMAGE_APPLY "CListFrames/OnExtraImageApply" + +//called with wparam=hContact lparam=extra +#define ME_CLIST_EXTRA_CLICK "CListFrames/OnExtraClick" + +//called with wparam=lparam=0 +#define ME_CLIST_EXTRA_LIST_REBUILD "CListFrames/OnExtraListRebuild" /* @@ -27,17 +47,17 @@ There is 2 ways of registering with Extra Icons service: 1. Using callbacks This works similar to clist API. When you register you provide 2 callbacks, one to rebuild the icons -and one to apply the icons for a contact. - In the RebuildIcons callback, all icons that will be used have to be registered calling +and one to apply the icons for a contact. + In the RebuildIcons callback, all icons that will be used have to be registered calling MS_CLIST_EXTRA_ADD_ICON service. The value returned by this service has to be stored and used in the apply icons. - The ApplyIcons callback will be called for all the needed contacts. Inside it, you must call + The ApplyIcons callback will be called for all the needed contacts. Inside it, you must call MS_EXTRAICON_SET_ICON to set the icon for the contact, sending the value returned by MS_CLIST_EXTRA_ADD_ICON as the hImage. 2. Using icolib - In this case no callback is needed and the plugin just need to call MS_EXTRAICON_SET_ICON passing the -icolib name in icoName when needed. If your plugin can have extra icons on startup, remember to do a loop + In this case no callback is needed and the plugin just need to call MS_EXTRAICON_SET_ICON passing the +icolib name in icoName when needed. If your plugin can have extra icons on startup, remember to do a loop over all contacts to set the initial icon. @@ -121,8 +141,7 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons if (!ServiceExists(MS_EXTRAICON_REGISTER)) return NULL; - EXTRAICON_INFO ei = {0}; - ei.cbSize = sizeof(ei); + EXTRAICON_INFO ei = { sizeof(ei) }; ei.type = EXTRAICON_TYPE_CALLBACK; ei.name = name; ei.description = description; @@ -141,8 +160,7 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons if (!ServiceExists(MS_EXTRAICON_REGISTER)) return NULL; - EXTRAICON_INFO ei = {0}; - ei.cbSize = sizeof(ei); + EXTRAICON_INFO ei = { sizeof(ei) }; ei.type = EXTRAICON_TYPE_ICOLIB; ei.name = name; ei.description = description; @@ -155,7 +173,7 @@ static HANDLE ExtraIcon_Register(const char *name, const char *description, cons static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage) { - EXTRAICON ei = {0}; + EXTRAICON ei = { sizeof(ei) }; ei.cbSize = sizeof(ei); ei.hExtraIcon = hExtraIcon; ei.hContact = hContact; @@ -166,8 +184,7 @@ static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage) static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, const char *icoName) { - EXTRAICON ei = {0}; - ei.cbSize = sizeof(ei); + EXTRAICON ei = { sizeof(ei) }; ei.hExtraIcon = hExtraIcon; ei.hContact = hContact; ei.icoName = icoName; -- cgit v1.2.3