summaryrefslogtreecommitdiff
path: root/include/m_clc.h
blob: ac64caeae4dfcf15e0e13c89a6612ee50e1fe40a (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*

Miranda NG: the free IM client for Microsoft* Windows*

Copyright (c) 2012-14 Miranda NG project (http://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_CLC_H__
#define M_CLC_H__ 1

//This module is new in 0.1.2.1

#define CLISTCONTROL_CLASS  "CListControl"

//styles
#define CLS_MANUALUPDATE    0x0001	 //todo
#define CLS_SHOWHIDDEN      0x0002
#define CLS_HIDEOFFLINE     0x0004	 //hides all offline users
#define CLS_CHECKBOXES      0x0008
#define CLS_MULTICOLUMN	    0x0010   //not true multi-column, just for ignore/vis options
#define CLS_HIDEEMPTYGROUPS 0x0020   //note: this flag will be spontaneously removed if the 'new subgroup' menu item is clicked, for obvious reasons
#define CLS_USEGROUPS       0x0040
#define CLS_NOHIDEOFFLINE   0x0080	 //overrides CLS_HIDEOFFLINE and the per-group hideoffline setting
#define CLS_GREYALTERNATE   0x0100   //make every other line slightly grey
#define CLS_GROUPCHECKBOXES 0x0200   //put checkboxes on groups too (managed by CLC)
#define CLS_CONTACTLIST		0x0400   //this control will be the main contact list (v. 0.3.4.3+ 2004/11/02)

#define CLS_EX_DISABLEDRAGDROP     0x00000001
#define CLS_EX_EDITLABELS          0x00000002
#define CLS_EX_SHOWSELALWAYS       0x00000004
#define CLS_EX_TRACKSELECT         0x00000008
#define CLS_EX_SHOWGROUPCOUNTS     0x00000010
#define CLS_EX_DIVIDERONOFF        0x00000020
#define CLS_EX_HIDECOUNTSWHENEMPTY 0x00000040
#define CLS_EX_NOTRANSLUCENTSEL    0x00000080
#define CLS_EX_LINEWITHGROUPS      0x00000100
#define CLS_EX_QUICKSEARCHVISONLY  0x00000200
#define CLS_EX_SORTGROUPSALPHA     0x00000400
#define CLS_EX_NOSMOOTHSCROLLING   0x00000800

#define CLM_FIRST   0x1000    //this is the same as LVM_FIRST
#define CLM_LAST    0x1100

//messages, compare with equivalent TVM_s in the MSDN
#define CLM_ADDCONTACT        (CLM_FIRST+0)    //wParam = hContact
#define CLM_ADDGROUP          (CLM_FIRST+1)    //wParam = hGroup
#define CLM_AUTOREBUILD       (CLM_FIRST+2)
#define CLM_DELETEITEM        (CLM_FIRST+3)    //wParam = hItem
#define CLM_EDITLABEL         (CLM_FIRST+4)    //wParam = hItem
#define CLM_ENDEDITLABELNOW   (CLM_FIRST+5)    //wParam = cancel, 0 to save
#define CLM_ENSUREVISIBLE     (CLM_FIRST+6)    //wParam = hItem, lParam = partialOk
#define CLE_TOGGLE       -1
#define CLE_COLLAPSE     0
#define CLE_EXPAND       1
#define CLE_INVALID      0xFFFF
#define CLM_EXPAND            (CLM_FIRST+7)    //wParam = hItem, lParam = CLE_
#define CLM_FINDCONTACT       (CLM_FIRST+8)    //wParam = hContact, returns an hItem
#define CLM_FINDGROUP         (CLM_FIRST+9)    //wParam = hGroup, returns an hItem
#define CLM_GETBKCOLOR        (CLM_FIRST+10)   //returns a COLORREF
#define CLM_GETCHECKMARK      (CLM_FIRST+11)   //wParam = hItem, returns 1 or 0
#define CLM_GETCOUNT          (CLM_FIRST+12)   //returns the total number of items
#define CLM_GETEDITCONTROL    (CLM_FIRST+13)   //returns the HWND, or NULL
#define CLM_GETEXPAND         (CLM_FIRST+14)   //wParam = hItem, returns a CLE_, CLE_INVALID if not a group
#define CLM_GETEXTRACOLUMNS   (CLM_FIRST+15)   //returns number of extra columns
#define CLM_GETEXTRAIMAGE     (CLM_FIRST+16)   //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based),0), returns iImage or EMPTY_EXTRA_ICON
#define CLM_GETEXTRAIMAGELIST (CLM_FIRST+17)   //returns HIMAGELIST
#define CLM_GETFONT           (CLM_FIRST+18)   //wParam = fontId, see clm_setfont. returns hFont.
#define CLM_GETINDENT         (CLM_FIRST+19)   //wParam = new group indent
#define CLM_GETISEARCHSTRING  (CLM_FIRST+20)   //lParam = (char*)pszStr, max 120 bytes, returns number of chars in string
#define CLM_GETITEMTEXT       (CLM_FIRST+21)   //wParam = hItem, lParam = (TCHAR*)pszStr, max 120 bytes
#define CLM_GETSCROLLTIME     (CLM_FIRST+22)   //returns time in ms
#define CLM_GETSELECTION      (CLM_FIRST+23)   //returns hItem
#define CLM_SETEXTRASPACE     (CLM_FIRST+24)   //wParam=extra space between icons

#define CLCHT_ABOVE        0x0001  //above client area
#define CLCHT_BELOW        0x0002  //below client area
#define CLCHT_TOLEFT       0x0004  //left of client area
#define CLCHT_TORIGHT      0x0008  //right of client area
#define CLCHT_NOWHERE      0x0010  //in client area, not on an item
#define CLCHT_ONITEMICON   0x0020
#define CLCHT_ONITEMCHECK  0x0040
#define CLCHT_ONITEMLABEL  0x0080
#define CLCHT_ONITEMINDENT 0x0100  //to the left of an item icon
#define CLCHT_ONITEMEXTRA  0x0200  //on an extra icon, HIBYTE(HIWORD()) says which
#define CLCHT_ONITEM       0x03E0
#define CLCHT_INLEFTMARGIN 0x0400
#define CLCHT_BELOWITEMS   0x0800  //in client area but below last item
#define CLM_HITTEST           (CLM_FIRST+25)   //lParam = MAKELPARAM(x,y) (relative to control), wParam = (PDWORD)&hitTest (see encoding of HitTest() in clc.h, can be NULL) returns hItem or NULL
#define CLM_SELECTITEM        (CLM_FIRST+26)   //wParam = hItem
#define CLB_TOPLEFT       0
#define CLB_STRETCHV      1
#define CLB_STRETCHH      2	 //and tile vertically
#define CLB_STRETCH       3
#define CLBM_TYPE         0x00FF
#define CLBF_TILEH        0x1000
#define CLBF_TILEV        0x2000
#define CLBF_PROPORTIONAL 0x4000
#define CLBF_SCROLL       0x8000
#define CLM_SETBKBITMAP       (CLM_FIRST+27)   //wParam = mode, lParam = hBitmap (don't delete it), NULL for none
#define CLM_SETBKCOLOR        (CLM_FIRST+28)   //wParam = a COLORREF, default is GetSysColor(COLOR_3DFACE)
#define CLM_SETCHECKMARK      (CLM_FIRST+29)   //wParam = hItem, lParam = 1 or 0
#define CLM_SETEXTRACOLUMNS   (CLM_FIRST+30)   //wParam = number of extra columns (zero to EXTRA_ICON_COUNT from clc.h, currently 16)
#define CLM_SETEXTRAIMAGE     (CLM_FIRST+31)   //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based),iImage). iImage = EMPTY_EXTRA_ICON is a blank
#define CLM_SETEXTRAIMAGELIST (CLM_FIRST+32)   //lParam = HIMAGELIST

#define FONTID_CONTACTS    0
#define FONTID_INVIS       1
#define FONTID_OFFLINE     2
#define FONTID_NOTONLIST   3
#define FONTID_GROUPS      4
#define FONTID_GROUPCOUNTS 5
#define FONTID_DIVIDERS    6
#define FONTID_OFFINVIS    7
#define FONTID_STATUSMSG   8
#define FONTID_GROUPSCLOSED   9
#define FONTID_CONTACTSHOVER	10
#define FONTID_MAX				18

#define CLM_SETFONT           (CLM_FIRST+33)   //wParam = hFont, lParam = MAKELPARAM(fRedraw,fontId)
#define CLM_SETINDENT         (CLM_FIRST+34)   //wParam = new indent, default is 3 pixels
#define CLM_SETITEMTEXT       (CLM_FIRST+35)   //wParam = hItem, lParam = (char*)pszNewText
#define CLM_SETSCROLLTIME     (CLM_FIRST+36)   //wParam = time in ms, default 200

#define CLM_SETHIDEEMPTYGROUPS (CLM_FIRST+38)  //wParam = TRUE/FALSE
#define GREYF_UNFOCUS     0x80000000
#define MODEF_OFFLINE     0x40000000
//and use the PF2_ #defines from m_protosvc.h
#define CLM_SETGREYOUTFLAGS   (CLM_FIRST+39)   //wParam = new flags
#define CLM_GETHIDEOFFLINEROOT (CLM_FIRST+40)   //returns TRUE/FALSE
#define CLM_SETHIDEOFFLINEROOT (CLM_FIRST+41)   //wParam = TRUE/FALSE
#define CLM_SETUSEGROUPS      (CLM_FIRST+42)   //wParam = TRUE/FALSE
#define CLM_SETOFFLINEMODES   (CLM_FIRST+43)   //for 'hide offline', wParam = PF2_ flags and MODEF_OFFLINE
#define CLM_GETEXSTYLE        (CLM_FIRST+44)   //returns CLS_EX_ flags
#define CLM_SETEXSTYLE        (CLM_FIRST+45)   //wParam = CLS_EX_ flags
#define CLM_GETLEFTMARGIN     (CLM_FIRST+46)   //returns count of pixels
#define CLM_SETLEFTMARGIN     (CLM_FIRST+47)   //wParam = pixels
typedef struct {
	int cbSize;
	const TCHAR *pszText;
	HANDLE hParentGroup;
	DWORD flags;
	HICON hIcon;     //todo
} CLCINFOITEM;
#define CLCIIF_BELOWGROUPS    1     //put it between groups and contacts, default is at top
#define CLCIIF_BELOWCONTACTS  2     //put it at the bottom
#define CLCIIF_CHECKBOX       0x40  //give this item a check box
#define CLCIIF_GROUPFONT      0x80  //draw the item using FONTID_GROUPS

#define CLM_ADDINFOITEMA    (CLM_FIRST+48)   //lParam = &cii, returns hItem
#define CLM_ADDINFOITEMW    (CLM_FIRST+53)   //lParam = &cii, returns hItem
#if defined(_UNICODE)
	#define CLM_ADDINFOITEM CLM_ADDINFOITEMW
#else
	#define CLM_ADDINFOITEM CLM_ADDINFOITEMA
#endif

	//the order of info items is never changed, so make sure you add them in the
	//  order you want them to remain
#define CLCIT_INVALID    -1
#define CLCIT_GROUP    0
#define CLCIT_CONTACT  1
#define CLCIT_DIVIDER  2
#define CLCIT_INFO     3
#define CLM_GETITEMTYPE    (CLM_FIRST+49)	//wParam = hItem, returns a CLCIT_
#define CLGN_ROOT      0
#define CLGN_CHILD     1
#define CLGN_PARENT    2
#define CLGN_NEXT      3
#define CLGN_PREVIOUS  4
#define CLGN_NEXTCONTACT 5
#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

//notifications  (most are omitted because the control processes everything)
#define CLNF_ISGROUP   1
#define CLNF_ISINFO    2
typedef struct {
	NMHDR hdr;
	HANDLE hItem;
	int action;
	int iColumn;	//-1 if not on an extra column
	DWORD flags;
	POINT pt;
} NMCLISTCONTROL;
#define CLN_FIRST        (0U-100U)
#define CLN_EXPANDED     (CLN_FIRST-0)      //hItem = hGroup, action = CLE_*
#define CLN_LISTREBUILT  (CLN_FIRST-1)
#define CLN_ITEMCHECKED  (CLN_FIRST-2)      //todo	//hItem, action, flags valid
#define CLN_DRAGGING     (CLN_FIRST-3)		//hItem, pt, flags valid. only sent when cursor outside window, return nonzero if processed
#define CLN_DROPPED      (CLN_FIRST-4)		//hItem, pt, flags valid. only sent when cursor outside window, return nonzero if processed
#define CLN_LISTSIZECHANGE (CLN_FIRST-5)    //pt.y valid. the vertical height of the visible items in the list has changed.
#define CLN_OPTIONSCHANGED (CLN_FIRST-6)	//nothing valid. If you set some extended options they have been overwritten and should be re-set
#define CLN_DRAGSTOP     (CLN_FIRST-7)		//hItem, flags valid. sent when cursor goes back in to the window having been outside, return nonzero if processed
#define CLN_NEWCONTACT   (CLN_FIRST-8)      //hItem, flags valid. sent when a new contact is added without a full list rebuild
#define CLN_CONTACTMOVED (CLN_FIRST-9)      //hItem, flags valid. sent when contact is moved without a full list rebuild
#define CLN_CHECKCHANGED (CLN_FIRST-10)     //hItem, flags valid. sent when any check mark is changed, but only for one change if there are many
//NM_CLICK        							//hItem, iColumn, pt, flags valid
//NM_KEYDOWN                                //NMKEY structure, only sent when key is not already processed, return nonzero to prevent further processing

// clist window tree messages
#define M_CREATECLC  (WM_USER+1)
#define M_SETALLEXTRAICONS (WM_USER+2)

//an infotip for an item should be shown now
//wParam = 0
//lParam = (LPARAM)(CLCINFOTIP*)&it
//Return nonzero if you process this, because it makes no sense for more than
//one plugin to grab it.
//It is up to the plugin to decide the best place to put the infotip. Normally
//it's a few pixels below and to the right of the cursor
//This event is called after the mouse has been stationary over a contact for
//(by default) 200ms, but see below.
//Everything is in screen coordinates.
typedef struct {
	int cbSize;
	int isTreeFocused;   //so the plugin can provide an option
	int isGroup;     //0 if it's a contact, 1 if it's a group
	HANDLE hItem;	 //handle to group or contact
	POINT ptCursor;
	RECT rcItem;
} CLCINFOTIP;
#define ME_CLC_SHOWINFOTIP    "CLC/ShowInfoTip"

typedef struct {
	int cbSize;
	int isTreeFocused;   //so the plugin can provide an option
	HANDLE hItem;	 //handle to group or contact
	POINT ptCursor;
	RECT rcItem;
	int  extraIndex;
	HWND hwnd;
} CLCEXTRAINFOTIP;
#define ME_CLC_SHOWEXTRAINFOTIP    "CLC/ShowExtraInfoTip"

//it's time to destroy an infotip
//wParam = 0
//lParam = (LPARAM)(CLCINFOTIP*)&it
//Only cbSize, isGroup and hItem are set
//Return nonzero if you process this.
//This is sent when the mouse moves off a contact when clc/showinfotip has
//previously been called.
//If you don't want this behaviour, you should have grabbed the mouse capture
//yourself and made your own arrangements.
#define ME_CLC_HIDEINFOTIP    "CLC/HideInfoTip"

//set the hover time before the infotip hooks are called
//wParam = newTime
//lParam = 0
//Returns 0 on success or nonzero on failure
//The value of this setting is applied to all current CLC windows, and saved
//to be applied to all future windows, including after restarts.
//newTime is in ms.
//The default is 750ms.
#define MS_CLC_SETINFOTIPHOVERTIME    "CLC/SetInfoTipHoverTime"

//get the hover time before the infotip hooks are called
//wParam = lParam = 0
//Returns the time in ms
#define MS_CLC_GETINFOTIPHOVERTIME    "CLC/GetInfoTipHoverTime"

#endif // M_CLC_H__