summaryrefslogtreecommitdiff
path: root/include/delphi/m_clistint.inc
blob: adade975fa105ec48d4870d31f38d41848a92ef8 (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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
{
  Miranda IM: the free IM client for Microsoft* Windows*

  Copyright 2000-2008 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_CLISTINT}
{$DEFINE M_CLISTINT}

{Type
  P_menuProto           = ^_menuProto;
  PClcCacheEntryBase    = ^ClcCacheEntryBase;
  PClcContact           = ^ClcContact;
  PClcData              = ^ClcData;
  PClcFontInfo          = ^ClcFontInfo;
  PClcGroup             = ^ClcGroup;
  PClcProtoStatus       = ^ClcProtoStatus;
  PCLIST_INTERFACE      = ^CLIST_INTERFACE;
  PCListEvent           = ^CListEvent;
  PCLCCacheEntry        = ^CLCCacheEntry;
  PContactList          = ^ContactList;
  PEventList            = ^EventList;
  PMenuProto            = ^MenuProto;
  PMIRANDASYSTRAYNOTIFY = ^MIRANDASYSTRAYNOTIFY;
  PPROTOCOLDESCRIPTOR   = ^PROTOCOLDESCRIPTOR;
  PtrayIconInfo_t       = ^trayIconInfo_t;
}
const
  HCONTACT_ISGROUP = $80000000;
  HCONTACT_ISINFO  = $FFFF0000;
  MAX_TIP_SIZE     = 2048;
  EXTRA_ICON_COUNT = 10;

const
  INTM_NAMECHANGED         = WM_USER+10;
  INTM_ICONCHANGED         = WM_USER+11;
  INTM_GROUPCHANGED        = WM_USER+12;
  INTM_CONTACTADDED        = WM_USER+14;
  INTM_CONTACTDELETED      = WM_USER+15;
  INTM_HIDDENCHANGED       = WM_USER+16;
  INTM_INVALIDATE          = WM_USER+17;
  INTM_APPARENTMODECHANGED = WM_USER+18;
  INTM_SETINFOTIPHOVERTIME = WM_USER+19;
  INTM_NOTONLISTCHANGED    = WM_USER+20;
  INTM_RELOADOPTIONS       = WM_USER+21;
  INTM_NAMEORDERCHANGED    = WM_USER+22;
  INTM_IDLECHANGED         = WM_USER+23;
  INTM_SCROLLBARCHANGED    = WM_USER+24;
  INTM_PROTOCHANGED        = WM_USER+25;

  TIMERID_RENAME           = 10;
  TIMERID_DRAGAUTOSCROLL   = 11;
  TIMERID_INFOTIP          = 13;
  TIMERID_REBUILDAFTER     = 14;
  TIMERID_DELAYEDRESORTCLC = 15;
  TIMERID_TRAYHOVER        = 16;
  TIMERID_TRAYHOVER_2      = 17;

  GROUP_ALLOCATE_STEP = 8;

type
  PClcContact = ^tClcContact;
  tClcContact = record
      {undefined structure}
  end;

  PClcData = ^tClcData;
  tClcData = record
      {undefined structure}
  end;

{ templates, where are you...  }

  PContactList = ^tContactList;
  tContactList = record
    items     : ^PClcContact;
    count     : int;
    limit     : int;
    increment : int;
    sortFunc  : pointer;
  end;

  PEventList = ^TEventList;
  TEventList = record
    items     : ^PCListEvent;
    count     : int;
    limit     : int;
    increment : int;
    sortFunc  : pointer;
  end;

  pClcGroup = ^tClcGroup;
  tClcGroup = record
    cl           : tContactList;
    expanded     : int;
    hideOffline  : int;
    groupId      : int;
    parent       : PClcGroup;
    scanIndex    : int;
    totalMembers : int;
  end;

  pClcFontInfo = ^tClcFontInfo;
  tClcFontInfo = record
    hFont      : HFONT;
    fontHeight : int;
    changed    : int;
    colour     : COLORREF;
  end;

type
  tCLCCB = record
    case boolean of
     false: (
       iImage:int;
       hContact:TMCONTACT);
     true : (
       groupId:word;
       group  :pClcGroup;);
  end;
  pClcContactBase = ^tClcContactBase;
  tClcContactBase = record
    _type      :byte;
    flags      :byte;
    data       :tCLCCB;
    iExtraImage:array [0..EXTRA_ICON_COUNT-1] of word;
    szText     :array [0..120-EXTRA_ICON_COUNT-1] of WideChar;
    proto      :PAnsiChar; // MS_PROTO_GETBASEPROTO
  end;

type
  pClcDataBase = ^tClcDataBase;
  tClcDataBase = record
    list                  :TClcGroup;
    rowHeight             :int;
    yScroll               :int;
    selection             :int;
    fontInfo              :array [0..FONTID_MAX] of TClcFontInfo;
    scrollTime            :int;
    himlHighlight         :THANDLE; // HIMAGELIST in CommCtrl
    groupIndent           :int;
    szQuickSearch         :array [0..127] of WideChar;
    iconXSpace            :int;
    hwndRenameEdit        :HWND;
    bkColour,
    selBkColour,
    selTextColour,
    hotTextColour,
    quickSearchColour     :TCOLORREF;
    iDragItem,
    iInsertionMark        :int;
    dragStage             :int;
    ptDragStart           :TPOINT;
    dragAutoScrolling     :int;
    dragAutoScrollHeight  :int;
    leftMargin            :int;
    insertionMarkHitHeight:int;
    hBmpBackground        :HBITMAP;
    backgroundBmpUse,
    bkChanged             :int;
    iHotTrack             :int;
    gammaCorrection       :int;
    greyoutFlags          :dword; // see m_clc.h
    offlineModes          :dword;
    exStyle               :dword;
    ptInfoTip             :TPOINT;
    infoTipTimeout        :int;
    hInfoTipItem          :DWORD;
    himlExtraColumns      :THANDLE; // HIMAGELIST in CommCtrl
    extraColumnsCount     :int;
    extraColumnSpacing    :int;
    checkboxSize          :int;
	 bShowSelAlways, bShowIdle, bNoVScrollbar, bUseWindowsColours : byte;
	 bNeedsResort, bFilterSearch, bLockScrollbar : byte;
  end;

  PtrayIconInfo_t = ^trayIconInfo_t;
  trayIconInfo_t = record
    id          : int;
    szProto     : PAnsiChar;
    hBaseIcon   : HICON;
    isBase      : int;
    ptszToolTip : TChar;
  end;

{This is DLL-based unique name }

  P_menuProto = ^T_menuProto;
  T_menuProto = record
    szProto : PAnsiChar;
    pMenu   : HGENMENU;
    hIcon   : HICON;
  end;
  TMenuProto = T_menuProto;
  PMenuProto = ^TMenuProto;
{ constants  }

const
  DRAGSTAGE_NOTMOVED     = 0;
  DRAGSTAGE_ACTIVE       = 1;
  DRAGSTAGEM_STAGE       = $00FF;
  DRAGSTAGEF_MAYBERENAME = $8000;
  DRAGSTAGEF_OUTSIDE     = $4000;

  CONTACTF_ONLINE    = 1;
  CONTACTF_INVISTO   = 2;
  CONTACTF_VISTO     = 4;
  CONTACTF_NOTONLIST = 8;
  CONTACTF_CHECKED   = 16;
  CONTACTF_IDLE      = 32;

  DROPTARGET_OUTSIDE   = 0;
  DROPTARGET_ONSELF    = 1;
  DROPTARGET_ONNOTHING = 2;
  DROPTARGET_ONGROUP   = 3;
  DROPTARGET_ONCONTACT = 4;
  DROPTARGET_INSERTION = 5;

  CLCDEFAULT_ROWHEIGHT         = 16;
  CLCDEFAULT_EXSTYLE           = CLS_EX_EDITLABELS or CLS_EX_TRACKSELECT or
                                 CLS_EX_SHOWGROUPCOUNTS or CLS_EX_HIDECOUNTSWHENEMPTY or
                                 CLS_EX_TRACKSELECT or CLS_EX_NOTRANSLUCENTSEL;
                                 //plus CLS_EX_NOSMOOTHSCROLL is got from the system
  CLCDEFAULT_SCROLLTIME        = 150;
  CLCDEFAULT_GROUPINDENT       = 5;
  CLCDEFAULT_USEBITMAP         = 0;
  CLCDEFAULT_BKBMPUSE          = CLB_STRETCH;
  CLCDEFAULT_OFFLINEMODES      = MODEF_OFFLINE;
  CLCDEFAULT_GREYOUTFLAGS      = 0;
  CLCDEFAULT_SELBLEND          = 1;
  CLCDEFAULT_FULLGREYOUTFLAGS  = MODEF_OFFLINE or PF2_INVISIBLE or GREYF_UNFOCUS;
  CLCDEFAULT_QUICKSEARCHCOLOUR = $0000FFFF; //RGB(255,255,0);
  CLCDEFAULT_LEFTMARGIN        = 0;
  CLCDEFAULT_RIGHTMARGIN       = 2;
  CLCDEFAULT_GAMMACORRECT      = 1;
  CLCDEFAULT_SHOWIDLE          = 1;
  CLCDEFAULT_USEWINDOWSCOLOURS = 0;

  TRAYICON_ID_BASE = 100;
  TIM_CALLBACK     = WM_USER+1857;
  TIM_CREATE       = WM_USER+1858;

  {**************************************************************************
   * CLIST_INTERFACE structure definition
   ************************************************************************** }

const
  GCDNF_NOMYHANDLE = 1; // will never return the user's custom name
  GCDNF_NOCACHE    = 4; // will not use the cache

type
  PClcProtoStatus = ^TClcProtoStatus;
  TClcProtoStatus = record
    szProto :PAnsiChar;
    dwStatus:dword;
  end;

type
  PClcCacheEntryBase = ^TClcCacheEntryBase;
  TClcCacheEntryBase = record
    hContact:TMCONTACT;
    name    :TCHAR;
    group   :TCHAR;
    isHidden:int;
  end;

  PClcCacheEntry = ^TCLCCacheEntry;
  TCLCCacheEntry = record
  end;

type
  PCLIST_INTERFACE = ^TCLIST_INTERFACE;
  TCLIST_INTERFACE = record
    version         : int;
    hwndContactList : HWND;
    hwndContactTree : HWND;
    hwndStatus      : HWND;
    hMenuMain       : HMENU;
    hInst           : HMODULE;
    hClcProtoCount  : int;
    clcProto        : PClcProtoStatus;

  (* clc.h *)
    pfnClcOptionsChanged               : procedure; cdecl;
    pfnBuildGroupPopupMenu             : function  (_para1:PClcGroup):HMENU; cdecl;

    pfnContactListControlWndProc       : function(hwnd:HWND; msg:uint; wParam:WPARAM; lParam:LPARAM):LRESULT; stdcall;

  (* clcfiledrop.c *)
    pfnRegisterFileDropping            : procedure (hwnd:HWND); cdecl;
    pfnUnregisterFileDropping          : procedure (hwnd:HWND); cdecl;

  (* clcidents.c *)
    blablabla6                         : procedure; cdecl;

    pfnGetRowsPriorTo                  : function (var group:TClcGroup; var subgroup:TClcGroup; contactIndex:int):int; cdecl;
    pfnGetRowByIndex                   : function (var dat:TClcData; testindex:int; var contact:PClcContact; var subgroup:PClcGroup):int; cdecl;
    unused1                            : function (var contact:TClcContact):THANDLE;cdecl;
    unused2                            : function (var contact:TClcContact; var nmFlags:dword):THANDLE; cdecl;

  (* clcitems.c *)
    pfnCreateClcContact                : function :PClcContact; cdecl;
    pfnAddGroup                        : function (hwnd:HWND; var dat:TClcData; szName:TChar; flags:dword; groupId:int; calcTotalMembers:int):PClcGroup; cdecl;
    pfnRemoveItemFromGroup             : function (hwnd:HWND; var group:TClcGroup; var contact:TClcContact; updateTotalCount:int):PClcGroup; cdecl;

    pfnFreeContact                     : procedure (var contact:TClcContact); cdecl;
    pfnFreeGroup                       : procedure (var group:TClcGroup); cdecl;

    pfnAddInfoItemToGroup              : function  (var group:TClcGroup; flags:int; pszText:TChar):PClcContact; cdecl;
    pfnAddItemToGroup                  : function  (var group:TClcGroup; iAboveItem:int):PClcContact; cdecl;
    pfnAddContactToGroup               : function  (var dat:TClcData; var group:TClcGroup; hContact:TMCONTACT):PClcContact; cdecl;
    pfnAddContactToTree                : procedure (hwnd:HWND; var dat:TClcData; hContact:TMCONTACT; updateTotalCount:int; checkHideOffline:int); cdecl;
    pfnDeleteItemFromTree              : procedure (hwnd:HWND; hItem:TMCONTACT); cdecl;
    pfnRebuildEntireList               : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnGetGroupContentsCount           : function  (var group:TClcGroup; visibleOnly:int):int; cdecl;
    pfnSortCLC                         : procedure (hwnd:HWND; var dat:TClcData; useInsertionSort:int); cdecl;
    pfnSaveStateAndRebuildList         : procedure (hwnd:HWND; var dat:TClcData); cdecl;

  (* clcmsgs.c *)
    pfnProcessExternalMessages         : function (hwnd:HWND; var dat:TClcData; msg:uint; wParam:WPARAM; lParam:LPARAM):LRESULT; cdecl;

  (* clcpaint.c *)
    pfnPaintClc                        : procedure (hwnd:HWND; var dat:TClcData; hdc:HDC; var rcPaint:TRECT);  cdecl;

  (* clcutils.c *)
    pfnGetGroupCountsText              : function (var dat:TClcData; var contact:TClcContact):PAnsiChar; cdecl;
    pfnHitTest                         : function (hwnd:HWND; var dat:TClcData; testx:int; testy:int; var contact:PClcContact; var group:PClcGroup; var flags:dword):int; cdecl;
    pfnScrollTo                        : procedure (hwnd:HWND; var dat:TClcData; desty:int; noSmooth:int); cdecl;
    pfnEnsureVisible                   : procedure (hwnd:HWND; var dat:TClcData; iItem:int; partialOk:int); cdecl;
    pfnRecalcScrollBar                 : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnSetGroupExpand                  : procedure (hwnd:HWND; var dat:TClcData; var group:TClcGroup; newState:int); cdecl;
    pfnDoSelectionDefaultAction        : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnFindRowByText                   : function  (hwnd:HWND; var dat:TClcData; text:TChar; prefixOk:int):int; cdecl;
    pfnEndRename                       : procedure (hwnd:HWND; var dat:TClcData; save:int); cdecl;
    pfnDeleteFromContactList           : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnBeginRenameSelection            : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnCalcEipPosition                 : procedure (var dat:TClcData; var contact:TClcContact; var group:TClcGroup; var result:TPOINT); cdecl;
    pfnGetDropTargetInformation        : function  (hwnd:HWND; var dat:TClcData; pt:TPOINT):int; cdecl;
    pfnClcStatusToPf2                  : function  (status:int):int; cdecl;
    pfnIsHiddenMode                    : function  (var dat:TClcData; status:int):int; cdecl;
    pfnHideInfoTip                     : procedure (hwnd:HWND; var dat:TClcData); cdecl;
    pfnNotifyNewContact                : procedure (hwnd:HWND; hContact:TMCONTACT); cdecl;
    pfnGetDefaultExStyle               : function  :dword; cdecl;
    pfnGetDefaultFontSetting           : procedure (i:int; var lf:LOGFONT; var colour:COLORREF); cdecl;
    pfnLoadClcOptions                  : procedure (hwnd:HWND; var dat:TClcData; bFirst: int); cdecl;
    blablablabla7                      : procedure; cdecl;
    blablablabla6                      : procedure; cdecl;
    blablablabla5                      : procedure; cdecl;
    blablablabla4                      : procedure; cdecl;

    pfnGetRowBottomY                   : function (var dat:TClcData; item:int):int; cdecl;
    pfnGetRowHeight                    : function (var dat:TClcData; item:int):int; cdecl;
    pfnGetRowTopY                      : function (var dat:TClcData; item:int):int; cdecl;
    pfnGetRowTotalHeight               : function (var dat:TClcData):int; cdecl;
    pfnRowHitTest                      : function (var dat:TClcData; y:int):int; cdecl;

  (* clistevents.c *)
    blablablabla2                      : procedure; cdecl;
    blablablabla3                      : procedure; cdecl;

  (* clistmod.c *)
    pfnIconFromStatusMode              : function (szProto:PAnsiChar; status:int; hContact:TMCONTACT):int; cdecl;
    pfnShowHide                        : function :int; cdecl;
                                       
  (* clistsettings.c *)
    blablablabla1                      : procedure; cdecl;
    pfnCreateCacheItem                 : function (hContact:TMCONTACT):PClcCacheEntry; cdecl;
    pfnCheckCacheItem                  : procedure (_para1:PClcCacheEntry); cdecl;
    pfnFreeCacheItem                   : procedure (_para1:PClcCacheEntry); cdecl;

    pfnInvalidateDisplayNameCacheEntry : procedure (hContact:TMCONTACT); cdecl;

  (* clisttray.c *)
    pfnTrayIconPauseAutoHide           : function (wParam:WPARAM; lParam:LPARAM):int; cdecl;
    pfnTrayIconProcessMessage          : function (wParam:WPARAM; lParam:LPARAM):int_ptr; cdecl;
                                       
  (* clui.c *)                         
    pfnContactListWndProc              : function(hwnd:HWND; msg:uint; wParam:WPARAM; lParam:LPARAM):int; stdcall;
                                       
    pfnCluiProtocolStatusChanged       : procedure (status:int; szProto:PAnsiChar); cdecl;
    pfnLoadCluiGlobalOpts              : procedure; cdecl;
    pfnInvalidateRect                  : function (hwnd:HWND; var lpRect:TRECT; bErase:bool):bool; cdecl;
    pfnOnCreateClc                     : procedure ; cdecl;
                                       
  (* contact.c *)                      
    pfnCompareContacts                 : function (var contact1:TClcContact; var contact2:TClcContact):int; cdecl;
    pfnSetHideOffline                  : function (wParam:WPARAM; lParam:LPARAM):int; cdecl;
                                      
  (* docking.c *)                     
    pfnDocking_ProcessWindowMessage    : function (wParam:WPARAM; lParam:LPARAM):int; cdecl;

  (*************************************************************************************
  * version 2 - events processing
  *************************************************************************************)

    events : PEventList;

    pfnAddEvent : function (_para1:PCLISTEVENT):PCListEvent; cdecl;
    pfnGetEvent : function (hContact:TMCONTACT; idx:int):PCLISTEVENT; cdecl;

    pfnRemoveEvent     : function (hContact:TMCONTACT; hDbEvent:TMEVENT):int; cdecl;
  end;

function Clist_GetInterface : PCLIST_INTERFACE; stdcall; external AppDll;

var
  cli : PCLIST_INTERFACE;

{$ENDIF}