8 * DEFINITIONS ________________________________________________________________
17 #define THIS_HINST (HINSTANCE)GetModuleHandle(NULL)
20 #define WC_FASTLIST TEXT("FastList")
22 #define FLM_FIRST 0x1400
24 #define FLN_FIRST (0U-880U)
25 #define FLN_LAST (0U-885U)
27 #define IMAGE_NOIMAGE ((int)(-1))
28 #define IMAGE_BLANKIMAGE ((int)(-2))
32 * WINDOW STYLES ______________________________________________________________
36 // The FLS_VIEW_* styles are used to indicate the format for
37 // displaying items in the FastList; either by Large Icons,
38 // Small Icons (equivalent to a ListView's "List" layout),
39 // in a List (equivalent to ListView's "Report" layout),
40 // in a Tree (equivalent to a TreeView), or as a tree/list hybrid--
41 // showing the Tree hierarchy as well as a header bar and
42 // details about each item.
44 #define FLS_VIEW_LARGE 0x0001
45 #define FLS_VIEW_SMALL 0x0002
46 #define FLS_VIEW_LIST 0x0003
47 #define FLS_VIEW_TREE 0x0004
48 #define FLS_VIEW_TREELIST (FLS_VIEW_TREE | FLS_VIEW_LIST)
49 #define FLS_VIEW_MASK (FLS_VIEW_LARGE | FLS_VIEW_SMALL | FLS_VIEW_TREE | FLS_VIEW_LIST)
51 // The FLS_NOSORTHEADER style causes the header bar (when visible)
52 // to be drawn "flat"--the buttons cannot be depressed. This style
53 // cannot be combined with FLS_AUTOSORTHEADER.
55 #define FLS_NOSORTHEADER 0x0008
57 // The FLS_SELECTION_MULTIPLE style indicates that more than one
58 // item in the list may be selected at any time. When combined with
59 // the FLS_SELECTION_SIBLING style, only direct siblings in the tree
60 // hierarchy may be selected at any time. When instead combined with
61 // the FLS_SELECTION_LEVEL style, only items at the same level from
62 // the root may be selected at any time. If these bits are not set,
63 // only one item may be selected at any time.
65 #define FLS_SELECTION_MULTIPLE 0x0010
66 #define FLS_SELECTION_SIBLING (0x0020 | FLS_SELECTION_MULTIPLE)
67 #define FLS_SELECTION_LEVEL (0x0040 | FLS_SELECTION_MULTIPLE)
69 // The FLS_LINESATROOT style causes root-level items in the tree
70 // to be prefixed by open/close boxes.
72 #define FLS_LINESATROOT 0x0080
74 // The FLS_LONGCOLUMNS style allows the right-most column containing
75 // text, if left-justified, to be drawn to the extent of the window
76 // regardless of column boundaries. It is particularly useful in
77 // Tree/List mode, where some entries may have long descriptions
78 // for the left-most column, and others may have several columns of
81 #define FLS_LONGCOLUMNS 0x0100
83 // The FLS_HIT_TEXTONLY style allows the user to de-select all
84 // items by left- or right-clicking on the whitespace between
85 // columns of data in List mode. (It has no effect in other modes.)
86 // If this bit is not set, clicking on this whitespace causes
87 // that item to be selected.
89 #define FLS_HIT_TEXTONLY 0x0200
91 // The FLS_AUTOSORTHEADER style allows the user to sort on any
92 // column by clicking on the column, or to reverse the sort on
93 // a column by clicking it twice. This style cannot be combined
94 // with the FLS_NOSORTHEADER style.
96 #define FLS_AUTOSORTHEADER 0x0400
99 * STRUCTURES _________________________________________________________________
103 typedef struct _FASTLISTITEM *HLISTITEM;
105 typedef struct FASTLISTADDITEM
107 HLISTITEM hParent; // parent item or NULL
108 int iFirstImage; // primary icon or imageNO_IMAGE
109 int iSecondImage; // secondary icon or imageNO_IMAGE
110 LPTSTR pszText; // text for column 0
111 LPARAM lParam; // user-supplied cookie
112 DWORD dwFlags; // combination of FLIF_* flags
113 } FASTLISTADDITEM, *LPFASTLISTADDITEM;
115 #define FLIF_TREEVIEW_ONLY 0x0001 // hide item unless in tree view
116 #define FLIF_DROPHIGHLIGHT 0x0002 // draw item as if it were selected
117 #define FLIF_DISALLOW_COLLAPSE 0x0004 // don't allow this item to collapse
118 #define FLIF_DISALLOW_SELECT 0x0008 // don't allow this item to be selected
120 typedef struct FASTLISTITEMREGIONS
122 RECT rItem; // OUT: overall rectangle for item
123 RECT rImage; // OUT: rect of item's images
124 RECT rLabel; // OUT: rect of item's label
125 RECT rHighlight; // OUT: rect that inverts on selection
126 RECT rButton; // OUT: rect of tree open/close button
127 RECT rSelect; // OUT: union of rHighlight+rImage
128 } FASTLISTITEMREGIONS, *LPFASTLISTITEMREGIONS;
130 typedef struct FASTLISTDRAWITEM
132 HDC hdc; // IN: target or template HDC
133 BOOL fDraw; // IN: TRUE if should render to hdc
134 BOOL fDragImage; // IN: TRUE if want drag image only
135 HWND hWnd; // IN: handle of fastlist window
136 HLISTITEM hItem; // IN: item to be drawn
137 LPARAM lParam; // IN: user-supplied lparam for item
138 RECT rItem; // IN: overall rectangle for item
139 POINT ptTextTest; // IN: client coords of point to test
140 BOOL fTextTestHit; // OUT: TRUE if point is within text
141 FASTLISTITEMREGIONS reg; // OUT: information about item image
142 } FASTLISTDRAWITEM, *LPFASTLISTDRAWITEM;
144 typedef struct FLN_GETITEMTEXT_PARAMS
146 NMHDR hdr; // IN: typical notification header
149 HLISTITEM hItem; // IN: item for which to obtain text
150 int icol; // IN: 0-based column of text to get
151 LPARAM lParam; // IN: user-supplied lparam for item
152 LPTSTR pszText; // IN: buffer in which to place text
153 size_t cchTextMax; // IN: size of buffer; OUT: required
155 } FLN_GETITEMTEXT_PARAMS, *LPFLN_GETITEMTEXT_PARAMS;
157 typedef struct FLN_ITEMCHANGED_PARAMS
159 NMHDR hdr; // IN: typical notification header
160 HLISTITEM hItem; // IN: item whose data has changed
161 } FLN_ITEMCHANGED_PARAMS, *LPFLN_ITEMCHANGED_PARAMS;
163 typedef struct FLN_ADDITEM_PARAMS
165 NMHDR hdr; // IN: typical notification header
166 HLISTITEM hItem; // IN: item which was added
167 } FLN_ADDITEM_PARAMS, *LPFLN_ADDITEM_PARAMS;
169 typedef struct FLN_REMOVEITEM_PARAMS
171 NMHDR hdr; // IN: typical notification header
172 HLISTITEM hItem; // IN: item which was removed
173 } FLN_REMOVEITEM_PARAMS, *LPFLN_REMOVEITEM_PARAMS;
175 typedef struct FLN_COLUMNCLICK_PARAMS
177 NMHDR hdr; // IN: typical notification header
178 int icol; // IN: 0-based column that was clicked
179 BOOL fDouble; // IN: TRUE if 'twas a double-click
180 } FLN_COLUMNCLICK_PARAMS, *LPFLN_COLUMNCLICK_PARAMS;
182 typedef struct FLN_COLUMNRESIZE_PARAMS
184 NMHDR hdr; // IN: typical notification header
185 int icol; // IN: 0-based column that was resized
186 LONG cxWidth; // IN: new width of the column
187 } FLN_COLUMNRESIZE_PARAMS, *LPFLN_COLUMNRESIZE_PARAMS;
189 typedef struct FLN_ITEMSELECT_PARAMS
191 NMHDR hdr; // IN: typical notification header
192 HLISTITEM hItem; // IN: first item which is now selected
193 } FLN_ITEMSELECT_PARAMS, *LPFLN_ITEMSELECT_PARAMS;
195 typedef struct FLN_ITEMEXPAND_PARAMS
197 NMHDR hdr; // IN: typical notification header
198 HLISTITEM hItem; // IN: item which was expanded/collapsed
199 BOOL fExpanded; // IN: TRUE if item is now expanded
200 } FLN_ITEMEXPAND_PARAMS, *LPFLN_ITEMEXPAND_PARAMS;
202 typedef struct FLN_DRAG_PARAMS
204 NMHDR hdr; // IN: typical notification header
205 HLISTITEM hFirst; // IN: first (of perhaps many) selected
206 POINT ptScreenFrom; // IN: screen coordinates of button-down
207 POINT ptScreenTo; // IN: final screen coordinates
208 BOOL fRightButton; // IN: TRUE if right-button drag
209 BOOL fShift; // IN: TRUE if shift is down
210 BOOL fControl; // IN: TRUE if control is down
211 } FLN_DRAG_PARAMS, *LPFLN_DRAG_PARAMS;
213 typedef struct FASTLISTCOLUMN
218 } FASTLISTCOLUMN, *LPFASTLISTCOLUMN;
220 #define FLCF_JUSTIFY_LEFT 0x0001
221 #define FLCF_JUSTIFY_RIGHT 0x0002
222 #define FLCF_JUSTIFY_CENTER 0x0003
223 #define FLCF_JUSTIFY_MASK 0x0003
225 typedef struct FASTLISTITEMCOLUMN
229 } FASTLISTITEMCOLUMN, *LPFASTLISTITEMCOLUMN;
231 typedef struct FASTLISTITEMIMAGE
235 } FASTLISTITEMIMAGE, *LPFASTLISTITEMIMAGE;
237 typedef int (CALLBACK * LPFASTLISTSORTFUNC)( HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2 );
239 typedef BOOL (CALLBACK * LPFASTLISTTEXTCALLBACK)( HWND hList, LPFLN_GETITEMTEXT_PARAMS pfln, DWORD dwCookie );
243 * NOTIFICATIONS ______________________________________________________________
245 * All notifications come via a WM_NOTIFY message to the FastList window's
246 * parent window. The message handler should be of the form:
250 * switch (((LPNMHDR)lp)->code) {
251 * case FLN_GETITEMTEXT: {
252 * LPFLN_GETITEMTEXT_PARAMS pParams = (LPFLN_GETITEMTEXT_PARAMS)lp;
253 * lstrcpy (pParams->pszText, ...);
256 * case FLN_ITEMEXPAND: {
264 * The LPARAM associated with a WM_NOTIFY message is always (for notifications
265 * from any window, not just FastLists) a structure consisting of:
268 * // window- and message-specific elements ...
270 * Thus, by casing the LPARAM value to LPNMHDR, information about the
271 * notification can be obtained from any notification structure.
272 * If a notification message is handled, the handler must return TRUE.
276 #define FLN_GETITEMTEXT (FLN_FIRST-0) // lp = LPFLN_GETITEMTEXT_PARAMS
277 #define FLN_ITEMCHANGED (FLN_FIRST-1) // lp = LPFLN_ITEMCHANGED_PARAMS
278 #define FLN_ADDITEM (FLN_FIRST-2) // lp = LPFLN_ADDITEM_PARAMS
279 #define FLN_REMOVEITEM (FLN_FIRST-3) // lp = LPFLN_REMOVEITEM_PARAMS
280 #define FLN_COLUMNCLICK (FLN_FIRST-4) // lp = LPFLN_COLUMNCLICK_PARAMS
281 #define FLN_COLUMNRESIZE (FLN_FIRST-5) // lp = LPFLN_COLUMNRESIZE_PARAMS
282 #define FLN_ITEMSELECT (FLN_FIRST-6) // lp = LPFLN_ITEMSELECT_PARAMS
283 #define FLN_ITEMEXPAND (FLN_FIRST-7) // lp = LPFLN_ITEMEXPAND_PARAMS
284 #define FLN_LCLICK (FLN_FIRST-8) // lp = LPNMHDR
285 #define FLN_RCLICK (FLN_FIRST-9) // lp = LPNMHDR
286 #define FLN_LDBLCLICK (FLN_FIRST-10) // lp = LPNMHDR
287 #define FLN_BEGINDRAG (FLN_FIRST-11) // lp = LPFLN_DRAG_PARAMS, rc = fDrag
288 #define FLN_DRAG (FLN_FIRST-12) // lp = LPFLN_DRAG_PARAMS
289 #define FLN_ENDDRAG (FLN_FIRST-13) // lp = LPFLN_DRAG_PARAMS
293 * MESSAGES ___________________________________________________________________
300 * Calling FastList_Begin() suspends sorting, repainting and other display-
301 * oriented operations until a matching call to FastList_End(). By surrounding
302 * multiple operations with an initial call to _Begin() and a final call to
303 * _End(), the operations can proceed (potentially much) more quickly, and
304 * without flicker as items are added, updated or removed. Calls to _Begin()
305 * and _End() nest: if _Begin() is called twice, two calls to _End() are
306 * required to finally cause the display to be repainted and resume normal
307 * operation. (A call to FastList_EndAll() ignores all nesting and enables
308 * redraw as if the proper number of calls to _End() had been made.)
312 // void FastList_Begin (HWND hList);
314 #define FastList_Begin(_hList) \
315 (void)SendMessage (_hList, FLM_BEGIN, 0, 0)
316 #define FLM_BEGIN (FLM_FIRST + 0x0000)
318 // void FastList_End (HWND hList);
319 // void FastList_EndAll (HWND hList);
321 #define FastList_End(_hList) \
322 (void)SendMessage (_hList, FLM_END, 0, 0)
323 #define FastList_EndAll(_hList) \
324 (void)SendMessage (_hList, FLM_END, 1, 0)
325 #define FLM_END (FLM_FIRST + 0x0001)
330 * These operations add and remove items to the list, and affect items'
335 // HLISTITEM FastList_AddItem (HWND hList, LPFASTLISTADDITEM pai);
337 #define FastList_AddItem(_hList,_pai) \
338 (HLISTITEM)SendMessage (_hList, FLM_ADDITEM, 0, (LPARAM)(_pai))
339 #define FLM_ADDITEM (FLM_FIRST + 0x0002)
341 // void FastList_RemoveAll (HWND hList)
342 // void FastList_RemoveItem (HWND hList, HLISTITEM hItem)
344 #define FastList_RemoveAll(_hList) \
345 FastList_RemoveItem(_hList,0)
346 #define FastList_RemoveItem(_hList,_hItem) \
347 (void)SendMessage (_hList, FLM_REMOVEITEM, (WPARAM)(_hItem), 0)
348 #define FLM_REMOVEITEM (FLM_FIRST + 0x0003)
350 // LPCTSTR FastList_GetItemText (HWND hList, HLISTITEM hItem, int icol);
351 // void FastList_SetItemText (HWND hList, HLISTITEM hItem, int icol, LPCTSTR pszText);
353 #define FastList_GetItemText(_hList,_hItem,_iCol) \
354 (LPCTSTR)SendMessage (_hList, FLM_GETITEMTEXT, (WPARAM)(_hItem), (LPARAM)(_iCol))
355 #define FastList_SetItemText(_hList,_hItem,_iCol,_psz) \
356 do { FASTLISTITEMCOLUMN _flic; \
357 _flic.hItem = _hItem; \
358 _flic.icol = _iCol; \
359 (void)SendMessage (_hList, FLM_SETITEMTEXT, (WPARAM)&_flic, (LPARAM)(_psz)); } while (0)
360 #define FLM_GETITEMTEXT (FLM_FIRST + 0x0004)
361 #define FLM_SETITEMTEXT (FLM_FIRST + 0x0005)
363 // LPARAM FastList_GetItemParam (HWND hList, HLISTITEM hItem);
364 // void FastList_SetItemParam (HWND hList, HLISTITEM hItem, LPARAM lParam);
366 #define FastList_GetItemParam(_hList,_hItem) \
367 (LPARAM)SendMessage (_hList, FLM_GETITEMPARAM, (WPARAM)(_hItem), 0)
368 #define FastList_SetItemParam(_hList,_hItem,_lp) \
369 (void)SendMessage (_hList, FLM_SETITEMPARAM, (WPARAM)(_hItem), (LPARAM)(_lp))
370 #define FLM_GETITEMPARAM (FLM_FIRST + 0x0006)
371 #define FLM_SETITEMPARAM (FLM_FIRST + 0x0007)
373 // DWORD FastList_GetItemFlags (HWND hList, HLISTITEM hItem);
374 // void FastList_SetItemFlags (HWND hList, HLISTITEM hItem, DWORD dwFlags);
376 #define FastList_GetItemFlags(_hList,_hItem) \
377 (LPARAM)SendMessage (_hList, FLM_GETITEMFLAGS, (WPARAM)(_hItem), 0)
378 #define FastList_SetItemFlags(_hList,_hItem,_dw) \
379 (void)SendMessage (_hList, FLM_SETITEMFLAGS, (WPARAM)(_hItem), (LPARAM)(_dw))
380 #define FLM_GETITEMFLAGS (FLM_FIRST + 0x0008)
381 #define FLM_SETITEMFLAGS (FLM_FIRST + 0x0009)
383 // int FastList_GetItemFirstImage (HWND hList, HLISTITEM hItem);
384 // int FastList_GetItemSecondImage (HWND hList, HLISTITEM hItem);
385 // void FastList_SetItemFirstImage (HWND hList, HLISTITEM hItem, int image);
386 // void FastList_SetItemSecondImage (HWND hList, HLISTITEM hItem, int image);
388 #define FastList_GetItemFirstImage(_hList,_hItem) \
389 FastList_GetItemImage(_hList,_hItem,0)
390 #define FastList_GetItemSecondImage(_hList,_hItem) \
391 FastList_GetItemImage(_hList,_hItem,1)
392 #define FastList_SetItemFirstImage(_hList,_hItem,_image) \
393 FastList_SetItemImage(_hList,_hItem,0,_image)
394 #define FastList_SetItemSecondImage(_hList,_hItem,_image) \
395 FastList_SetItemImage(_hList,_hItem,1,_image)
396 #define FastList_GetItemImage(_hList,_hItem,_iImage) \
397 (int)SendMessage (_hList, FLM_GETITEMIMAGE, (WPARAM)(_hItem), (LPARAM)(_iImage))
398 #define FastList_SetItemImage(_hList,_hItem,_iImage,_image) \
399 do { FASTLISTITEMIMAGE _flii; \
400 _flii.hItem = _hItem; \
401 _flii.iImage = _iImage; \
402 (void)SendMessage (_hList, FLM_SETITEMIMAGE, (WPARAM)&_flii, (LPARAM)(_image)); } while (0)
403 #define FLM_GETITEMIMAGE (FLM_FIRST + 0x000A)
404 #define FLM_SETITEMIMAGE (FLM_FIRST + 0x000B)
406 // BOOL FastList_IsExpanded (HWND hList, HLISTITEM hItem);
407 // void FastList_Expand (HWND hList, HLISTITEM hItem);
408 // void FastList_Collapse (HWND hList, HLISTITEM hItem);
409 // void FastList_SetExpanded (HWND hList, HLISTITEM hItem, BOOL fExpand);
411 #define FastList_IsExpanded(_hList,_hItem) \
412 (BOOL)SendMessage (_hList, FLM_ISEXPANDED, (WPARAM)(_hItem), 0)
413 #define FastList_Expand(_hList,_hItem) \
414 FastList_SetExpanded(_hList,_hItem,TRUE)
415 #define FastList_Collapse(_hList,_hItem) \
416 FastList_SetExpanded(_hList,_hItem,FALSE)
417 #define FastList_SetExpanded(_hList,_hItem,_fExpand) \
418 (BOOL)SendMessage (_hList, FLM_EXPAND, (WPARAM)(_hItem), (LPARAM)(_fExpand))
419 #define FLM_ISEXPANDED (FLM_FIRST + 0x000C)
420 #define FLM_EXPAND (FLM_FIRST + 0x000D)
422 // BOOL FastList_IsVisible (HWND hList, HLISTITEM hItem);
423 // void FastList_EnsureVisible (HWND hList, HLISTITEM hItem);
425 #define FastList_IsVisible(_hList,_hItem) \
426 (BOOL)SendMessage (_hList, FLM_ITEMVISIBLE, (WPARAM)(_hItem), 0)
427 #define FastList_EnsureVisible(_hList,_hItem) \
428 (BOOL)SendMessage (_hList, FLM_ITEMVISIBLE, (WPARAM)(_hItem), 1)
429 #define FLM_ITEMVISIBLE (FLM_FIRST + 0x000E)
431 // HLISTITEM FastList_GetFocus (HWND hList);
432 // BOOL FastList_IsFocused (HWND hList, HLISTITEM hItem);
433 // void FastList_SetFocus (HWND hList, HLISTITEM hItem);
435 #define FastList_GetFocus(_hList) \
436 (HLISTITEM)SendMessage (_hList, FLM_ITEMFOCUS, 0, 0)
437 #define FastList_IsFocused(_hList,_hItem) \
438 (BOOL)SendMessage (_hList, FLM_ITEMFOCUS, (WPARAM)(_hItem), 0)
439 #define FastList_SetFocus(_hList,_hItem) \
440 (void)SendMessage (_hList, FLM_ITEMFOCUS, (WPARAM)(_hItem), 1)
441 #define FLM_ITEMFOCUS (FLM_FIRST + 0x000F)
447 * A FastList may have two separate IMAGELISTs associated with it--one for
448 * 32x32 icons (used only in Large mode), and one for 16x16 icons (used in
449 * all other display modes). Use COMMCTRL.H's ImageList_Create() to create
450 * imagelists for use with a FastList.
454 // void FastList_GetImageLists (HWND hList, HIMAGELIST *phiSmall, HIMAGELIST *phiLarge)
456 #define FastList_GetImageLists(_hList,_phiSmall,_phiLarge) \
457 (void)SendMessage (_hList, FLM_GETIMAGELISTS, (WPARAM)(_phiSmall), (LPARAM)(_phiLarge))
458 #define FLM_GETIMAGELISTS (FLM_FIRST + 0x0010)
460 // void FastList_SetImageLists (HWND hList, HIMAGELIST hiSmall, HIMAGELIST hiLarge)
462 #define FastList_SetImageLists(_hList,_hiSmall,_hiLarge) \
463 (void)SendMessage (_hList, FLM_SETIMAGELISTS, (WPARAM)(_hiSmall), (LPARAM)(_hiLarge))
464 #define FLM_SETIMAGELISTS (FLM_FIRST + 0x0011)
466 // HIMAGELIST FastList_CreateDragImage (HWND hList, HLISTITEM hItem)
468 #define FastList_CreateDragImage(_hList,_hItem) \
469 (HIMAGELIST)SendMessage (_hList, FLM_CREATEDRAGIMAGE, (WPARAM)(_hItem), 0)
470 #define FLM_CREATEDRAGIMAGE (FLM_FIRST + 0x0012)
475 * The contents of a FastList are always kept sorted; they will never be
476 * displayed out-of-sort. The function used to sort items may be replaced
477 * by calling the FastList_SetSortFunction() method, and parameters
478 * regarding the sort may be changed by calling the FastList_SetSortStyle()
479 * function. The default sorting parameters are:
481 * Function: FastList_SortFunc_AlphaNumeric() [declared way down below]
482 * Column: Sorted on column 0
483 * Reverse: No; items ascending-sorted
485 * The FastList_Sort() function may be called to initiate a re-sort;
486 * however, doing so is unnecessary (as the list is automatically re-sorted
487 * when necessary). When displaying items in a tree, sorting is performed
488 * between sibling items only.
492 // LPFASTLISTSORTFUNC FastList_GetSortFunction (HWND hList)
494 #define FastList_GetSortFunction(_hList,_pfn) \
495 (LPFASTLISTSORTFUNC)SendMessage (_hList, FLM_GETSORTFUNC, 0, 0)
496 #define FLM_GETSORTFUNC (FLM_FIRST + 0x0013)
498 // void FastList_SetSortFunction (HWND hList, LPFASTLISTSORTFUNC pfn)
500 #define FastList_SetSortFunction(_hList,_pfn) \
501 (void)SendMessage (_hList, FLM_SETSORTFUNC, 0, (LPARAM)(_pfn))
502 #define FLM_SETSORTFUNC (FLM_FIRST + 0x0014)
504 // void FastList_GetSortStyle (HWND hList, int *piColumn, BOOL *pfReverse)
506 #define FastList_GetSortStyle(_hList,_piCol,_pfRev) \
507 (void)SendMessage (_hList, FLM_GETSORTSTYLE, (WPARAM)(_piCol), (LPARAM)(_pfRev))
508 #define FLM_GETSORTSTYLE (FLM_FIRST + 0x0015)
510 // void FastList_SetSortStyle (HWND hList, int iColumn, BOOL fReverse)
512 #define FastList_SetSortStyle(_hList,_iCol,_fRev) \
513 (void)SendMessage (_hList, FLM_SETSORTSTYLE, (WPARAM)(_iCol), (LPARAM)(_fRev))
514 #define FLM_SETSORTSTYLE (FLM_FIRST + 0x0016)
516 // void FastList_Sort (HWND hList)
518 #define FastList_Sort(_hList) \
519 (void)SendMessage (_hList, FLM_SORT, 0, 0)
520 #define FLM_SORT (FLM_FIRST + 0x0017)
525 * In List and TreeList mode, a FastList can be caused to display a column
526 * header and the associated multiple columns of information for each item.
527 * FastList_AddItem() supplies only a place for the item's column-0 text
528 * to be specified; other columns may be specified by FastList_SetItemText(),
529 * but if not, the FastList will call back to its parent window via the
530 * WM_NOTIFY/FLN_GETITEMTEXT notification to obtain text for the items'
531 * unspecified columns.
535 // int FastList_GetColumnCount (HWND hList)
537 #define FastList_GetColumnCount(_hList) \
538 (int)SendMessage (_hList, FLM_GETCOLUMNCOUNT, 0, 0)
539 #define FLM_GETCOLUMNCOUNT (FLM_FIRST + 0x0018)
541 // BOOL FastList_GetColumn (HWND hList, int iColumn, LPFASTLISTCOLUMN pcol)
543 #define FastList_GetColumn(_hList,_iCol,_pCol) \
544 (BOOL)SendMessage (_hList, FLM_GETCOLUMN, (WPARAM)(_iCol), (LPARAM)(_pCol))
545 #define FLM_GETCOLUMN (FLM_FIRST + 0x0019)
547 // void FastList_SetColumn (HWND hList, int iColumn, LPFASTLISTCOLUMN pcol)
548 // void FastList_RemoveColumn (HWND hList, int iColumn)
550 #define FastList_SetColumn(_hList,_iCol,_pCol) \
551 (void)SendMessage (_hList, FLM_SETCOLUMN, (WPARAM)(_iCol), (LPARAM)(_pCol))
552 #define FastList_RemoveColumn(_hList,_iCol) \
553 FastList_SetColumn (_hList, _iCol, NULL)
554 #define FLM_SETCOLUMN (FLM_FIRST + 0x001A)
559 * A FastList supports several types of selection. Single Selection causes
560 * any current selection to be cleared before a new item can be selected,
561 * either programmatically or by user action. Multiple Selection
562 * indiscriminately allows any items to be selected or deselected at
563 * the same time. Multiple/Sibling Selection requires that, if an item
564 * is selected which is not a sibling of any currently-selected items,
565 * the current selection is cleared first. Multiple/Level Selection requires
566 * that, if an item is selected which is at a different level from the root
567 * than any currently-selected item, the current selection is cleared first.
571 // BOOL FastList_IsSelected (HWND hList, HLISTITEM hItem)
573 #define FastList_IsSelected(_hList,_hItem) \
574 (BOOL)SendMessage (_hList, FLM_ISSELECTED, (WPARAM)(_hItem), 0)
575 #define FLM_ISSELECTED (FLM_FIRST + 0x001B)
577 // void FastList_SelectAll (HWND hList)
578 // void FastList_SelectNone (HWND hList)
579 // void FastList_SelectItem (HWND hList, HLISTITEM hItem, BOOL fSelect)
581 #define FastList_SelectAll(_hList) \
582 FastList_SelectItem(_hList,0,TRUE)
583 #define FastList_SelectNone(_hList) \
584 FastList_SelectItem(_hList,0,FALSE)
585 #define FastList_SelectItem(_hList,_hItem,_fSel) \
586 (void)SendMessage (_hList, FLM_SELECTITEM, (WPARAM)(_hItem), (LPARAM)(_fSel))
587 #define FLM_SELECTITEM (FLM_FIRST + 0x001C)
592 * A FastList provides multiple methods for enumeration. Items in the list
593 * may be enumerated as members of a hierarchy, or as members of a list.
594 * Additionally, the items in a FastList are hashed across their lParam
595 * values, so the FastList item matching a given lParam value can quickly
596 * be found. All enumeration functions are either constant time, or (as
597 * in the case of lParam-to-HLISTITEM lookups) extremely close to it.
599 * A typical enumeration will look like this:
600 * for (HLISTITEM hItem = FastList_FindFirst (hList);
602 * hItem = FastList_FindNext (hList, hItem))
608 * HLISTITEM hItem = NULL;
609 * while ((hItem = FastList_FindNext (hList, hItem)) != NULL)
614 * If an enumeration involving an LPENUM pointer is terminated without
615 * having enumerated all items in the list, the loop must be followed
616 * by a FastList_FindClose() statement. (This statement is optional
617 * otherwise.) If the state of the list or tree is updated, the enumeration
622 // HLISTITEM FastList_FindFirst (HWND hList)
623 // HLISTITEM FastList_FindNext (HWND hList, HLISTITEM hItem)
624 // HLISTITEM FastList_FindPrevious (HWND hList, HLISTITEM hItem)
626 #define FastList_FindFirst(_hList) \
627 FastList_FindList(_hList,0,FLM_FINDLIST_FIRST)
628 #define FastList_FindNext(_hList,_hItem) \
629 FastList_FindList(_hList,_hItem,FLM_FINDLIST_NEXT)
630 #define FastList_FindPrevious(_hList,_hItem) \
631 FastList_FindList(_hList,_hItem,FLM_FINDLIST_PREVIOUS)
632 #define FastList_FindList(_hList,_hItem,_dwCode) \
633 (HLISTITEM)SendMessage (_hList, FLM_FINDLIST, (WPARAM)(_hItem), (LPARAM)(_dwCode))
634 #define FLM_FINDLIST (FLM_FIRST + 0x001D)
635 #define FLM_FINDLIST_FIRST 0
636 #define FLM_FINDLIST_PREVIOUS 1
637 #define FLM_FINDLIST_NEXT 2
639 // HLISTITEM FastList_FindFirstInRoot (HWND hList)
640 // HLISTITEM FastList_FindParent (HWND hList, HLISTITEM hItem)
641 // HLISTITEM FastList_FindFirstChild (HWND hList, HLISTITEM hItem)
642 // HLISTITEM FastList_FindPreviousSibling (HWND hList, HLISTITEM hItem)
643 // HLISTITEM FastList_FindNextSibling (HWND hList, HLISTITEM hItem)
645 #define FastList_FindFirstInRoot(_hList) \
646 FastList_FindTree(_hList,0,FLM_FINDTREE_CHILD)
647 #define FastList_FindParent(_hList,_hItem) \
648 FastList_FindTree(_hList,_hItem,FLM_FINDTREE_PARENT)
649 #define FastList_FindFirstChild(_hList,_hItem) \
650 FastList_FindTree(_hList,_hItem,FLM_FINDTREE_CHILD)
651 #define FastList_FindPreviousSibling(_hList,_hItem) \
652 FastList_FindTree(_hList,_hItem,FLM_FINDTREE_PREVIOUS)
653 #define FastList_FindNextSibling(_hList,_hItem) \
654 FastList_FindTree(_hList,_hItem,FLM_FINDTREE_NEXT)
655 #define FastList_FindTree(_hList,_hItem,_dwCode) \
656 (HLISTITEM)SendMessage (_hList, FLM_FINDTREE, (WPARAM)(_hItem), (LPARAM)(_dwCode))
657 #define FLM_FINDTREE (FLM_FIRST + 0x001E)
658 #define FLM_FINDTREE_PARENT 0
659 #define FLM_FINDTREE_CHILD 1
660 #define FLM_FINDTREE_PREVIOUS 2
661 #define FLM_FINDTREE_NEXT 3
663 // HLISTITEM FastList_FindFirstSelected (HWND hList)
664 // HLISTITEM FastList_FindNextSelected (HWND hList, HLISTITEM hItemPrevious)
666 #define FastList_FindFirstSelected(_hList) \
667 FastList_FindNextSelected(_hList,0)
668 #define FastList_FindNextSelected(_hList,_hItem) \
669 (HLISTITEM)SendMessage (_hList, FLM_FINDSELECTED, (WPARAM)(_hItem), 0)
670 #define FLM_FINDSELECTED (FLM_FIRST + 0x001F)
672 // HLISTITEM FastList_FindItem (HWND hList, LPARAM lParam)
673 // HLISTITEM FastList_FindFirstItem (HWND hList, LPENUM *ppEnum, LPARAM lParam)
674 // HLISTITEM FastList_FindNextItem (HWND hList, LPENUM *ppEnum)
675 // void FastList_FindClose (HWND hList, LPENUM *ppEnum)
677 #define FastList_FindItem(_hList,_lp) \
678 (HLISTITEM)SendMessage (_hList, FLM_FINDITEM, 0, (LPARAM)(_lp))
679 #define FastList_FindFirstItem(_hList,_ppEnum,_lp) \
680 (HLISTITEM)SendMessage (_hList, FLM_FINDITEM, (WPARAM)(_ppEnum), (LPARAM)(_lp))
681 #define FastList_FindNextItem(_hList,_ppEnum) \
682 (HLISTITEM)SendMessage (_hList, FLM_FINDNEXTITEM, (WPARAM)(_ppEnum), 0)
683 #define FastList_FindClose(_hList,_ppEnum) \
684 (void)SendMessage (_hList, FLM_FINDCLOSE, (WPARAM)(_ppEnum), 0)
685 #define FLM_FINDITEM (FLM_FIRST + 0x0020)
686 #define FLM_FINDNEXTITEM (FLM_FIRST + 0x0021)
687 #define FLM_FINDCLOSE (FLM_FIRST + 0x0022)
689 // int FastList_GetItemCount (HWND hList)
690 // int FastList_GetVisibleItemCount (HWND hList)
692 #define FastList_GetItemCount(_hList) \
693 (int)SendMessage (_hList, FLM_GETITEMCOUNT, 0, 0)
694 #define FastList_GetVisibleItemCount(_hList) \
695 (int)SendMessage (_hList, FLM_GETITEMCOUNT, 1, 0)
696 #define FLM_GETITEMCOUNT (FLM_FIRST + 0x0023)
698 // HLISTITEM FastList_FindFirstVisible (HWND hList)
699 // HLISTITEM FastList_FindNextVisible (HWND hList, HLISTITEM hItem)
701 #define FastList_FindFirstVisible(_hList) \
702 FastList_FindVisible(_hList,0,FLM_FINDVISIBLE_FIRST)
703 #define FastList_FindNextVisible(_hList,_hItem) \
704 FastList_FindVisible(_hList,_hItem,FLM_FINDVISIBLE_NEXT)
705 #define FastList_FindVisible(_hList,_hItem,_dwCode) \
706 (HLISTITEM)SendMessage (_hList, FLM_FINDVISIBLE, (WPARAM)(_hItem), (LPARAM)(_dwCode))
707 #define FLM_FINDVISIBLE (FLM_FIRST + 0x0024)
708 #define FLM_FINDVISIBLE_FIRST 0
709 #define FLM_FINDVISIBLE_NEXT 1
714 * Like any other control, a FastList can tell you which item is underneath
715 * a particular point, and can tell you what RECTs an item uses for what
716 * purposes on the display.
718 * There are style bits which can be set to affect hit-testing on
719 * a FastList. Notably, the FLS_HIT_TEXTONLY bit prevents left- or right-
720 * clicking in whitespace to select an item (in list mode).
724 // HLISTITEM FastList_ItemFromPoint (HWND hList, POINT *pptClient, BOOL fStrict)
726 #define FastList_ItemFromPoint(_hList,_pptClient,_fStrict) \
727 (HLISTITEM)SendMessage (_hList, FLM_ITEMFROMPOINT, (WPARAM)(_pptClient), (LPARAM)(_fStrict))
728 #define FLM_ITEMFROMPOINT (FLM_FIRST + 0x0025)
730 // void FastList_GetItemRegions (HWND hList, HLISTITEM hItem, LPFASTLISTITEMREGIONS pReg)
732 #define FastList_GetItemRegions(_hList,_hItem,_pReg) \
733 (HLISTITEM)SendMessage (_hList, FLM_GETITEMREGIONS, (WPARAM)(_hItem), (LPARAM)(_pReg))
734 #define FLM_GETITEMREGIONS (FLM_FIRST + 0x0026)
736 // LPFASTLISTTEXTCALLBACK FastList_GetTextCallback (HWND hList)
737 // void FastList_SetTextCallback (HWND hList, LPFASTLISTTEXTCALLBACK pfn, DWORD dwCookie)
739 #define FastList_GetTextCallback(_hList) \
740 (LPFASTLISTTEXTCALLBACK)SendMessage (_hList, FLM_GETTEXTCALLBACK, 0, 0)
741 #define FastList_SetTextCallback(_hList,_pfn,_dwCookie) \
742 (void)SendMessage (_hList, FLM_SETTEXTCALLBACK, (WPARAM)(_pfn), (LPARAM)(_dwCookie))
743 #define FLM_GETTEXTCALLBACK (FLM_FIRST + 0x0027)
744 #define FLM_SETTEXTCALLBACK (FLM_FIRST + 0x0028)
748 * PROTOTYPES _________________________________________________________________
752 EXPORTED BOOL RegisterFastListClass (void);
753 EXPORTED BOOL fIsFastList (HWND hList);
755 EXPORTED void FastList_Enter (HWND hList);
756 EXPORTED void FastList_Leave (HWND hList);
758 EXPORTED int CALLBACK FastList_SortFunc_Alphabetic (HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2);
759 EXPORTED int CALLBACK FastList_SortFunc_Numeric (HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2);
760 EXPORTED int CALLBACK FastList_SortFunc_AlphaNumeric (HWND hList, HLISTITEM hItem1, LPARAM lpItem1, HLISTITEM hItem2, LPARAM lpItem2);