Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

982 lines
42 KiB

  1. // LISTVIEW PRIVATE DECLARATIONS
  2. #ifndef _INC_LISTVIEW
  3. #define _INC_LISTVIEW
  4. #include "selrange.h"
  5. #include <urlmon.h>
  6. #define COBJMACROS
  7. #include <iimgctx.h>
  8. //#define USE_SORT_FLARE
  9. //
  10. // Apps steal our userdata space so make sure we don't use it.
  11. //
  12. #undef GWLP_USERDATA
  13. #undef GWL_USERDATA
  14. // define this to get single click activate to activate immediately.
  15. // if a second click comes to the same window within a double-click-timeout
  16. // period, we blow it off. we try to keep focus on the app that launched,
  17. // but we can't figure out how to do that yet... with this not defined,
  18. // the single-click-activate waits a double-click-timeout before activating.
  19. //
  20. //#define ONECLICKHAPPENED
  21. // REVIEW: max items in a OWNERDATA listview
  22. // due to currently unknown reasons the listview will not handle much more
  23. // items than this. Since this number is very high, no time has yet been
  24. // spent on finding the reason(s).
  25. //
  26. #define MAX_LISTVIEWITEMS (100000000)
  27. #define CLIP_HEIGHT ((plv->cyLabelChar * 2) + g_cyEdge)
  28. #define CLIP_HEIGHT_DI ((plvdi->plv->cyLabelChar * 2) + g_cyEdge)
  29. #define CLIP_WIDTH ((plv->cxIconSpacing - g_cxLabelMargin * 2))
  30. // Timer IDs
  31. #define IDT_NAMEEDIT 42
  32. #define IDT_SCROLLWAIT 43
  33. #define IDT_MARQUEE 44
  34. #define IDT_ONECLICKOK 45
  35. #define IDT_ONECLICKHAPPENED 46
  36. #define IDT_SORTFLARE 47
  37. #define IDT_TRACKINGTIP 48 // Keyboard tracking tooltip display pause
  38. //
  39. // use g_cxIconSpacing when you want the the global system metric
  40. // use _GetCurrentItemSize when you want the padded size of "icon" in a ListView
  41. //
  42. extern BOOL g_fListviewAlphaSelect;
  43. extern BOOL g_fListviewShadowText;
  44. extern BOOL g_fListviewWatermarkBackgroundImages;
  45. extern BOOL g_fListviewEnableWatermark;
  46. extern int g_cxIcon;
  47. extern int g_cyIcon;
  48. #define g_cxIconOffset ((g_cxIconSpacing - g_cxIcon) / 2)
  49. #define g_cyIconOffset (g_cyBorder * 2) // NOTE: Must be >= cyIconMargin!
  50. #define DT_LV (DT_CENTER | DT_SINGLELINE | DT_NOPREFIX | DT_EDITCONTROL)
  51. #define DT_LVWRAP (DT_CENTER | DT_WORDBREAK | DT_NOPREFIX | DT_EDITCONTROL)
  52. #define DT_LVTILEWRAP (DT_WORDBREAK | DT_NOPREFIX | DT_EDITCONTROL)
  53. #define CCHLABELMAX MAX_PATH
  54. #define CCMAX_TILE_COLUMNS 20 // Max number of slots per tile. Having a value means the drawing code doesn't need to Alloc
  55. #define BORDERSELECT_THICKNESS 3
  56. #define IsEqualRect(rc1, rc2) ( ((rc1).left==(rc2).left) && ((rc1).top==(rc2).top) && ((rc1).right==(rc2).right) && ((rc1).bottom==(rc2).bottom) )
  57. BOOL ListView_Init(HINSTANCE hinst);
  58. LRESULT CALLBACK _export ListView_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  59. #define ListView_DefProc DefWindowProc
  60. typedef struct _IMAGE IMAGE;
  61. typedef struct tagLISTGROUP
  62. {
  63. LPWSTR pszHeader;
  64. LPWSTR pszFooter;
  65. UINT state;
  66. UINT uAlign;
  67. int iGroupId;
  68. HDPA hdpa;
  69. RECT rc;
  70. int cyTitle;
  71. } LISTGROUP, *PLISTGROUP;
  72. #define LISTGROUP_HEIGHT(plv, pgrp) (max((plv)->rcBorder.top, (pgrp)->cyTitle + 6) + (plv)->paddingTop)
  73. #define LISTITEM_HASASKEDFORGROUP(plvi) ((plvi)->pGroup != (LISTGROUP*)I_GROUPIDCALLBACK)
  74. #define LISTITEM_HASGROUP(plvi) ((plvi)->pGroup != NULL && LISTITEM_HASASKEDFORGROUP(plvi))
  75. #define LISTITEM_SETASKEDFORGROUP(plvi) ((plvi)->pGroup = NULL)
  76. #define LISTITEM_SETHASNOTASKEDFORGROUP(plvi) ((plvi)->pGroup = (LISTGROUP*)I_GROUPIDCALLBACK)
  77. #define LISTITEM_GROUP(plvi) (LISTITEM_HASGROUP(plvi)? (plvi)->pGroup: NULL)
  78. typedef struct _LISTITEM // li
  79. {
  80. LPTSTR pszText;
  81. POINT pt;
  82. short iImage;
  83. short cxSingleLabel;
  84. short cxMultiLabel;
  85. short cyFoldedLabel;
  86. short cyUnfoldedLabel;
  87. short iWorkArea; // Which workarea do I belong
  88. WORD state; // LVIS_*
  89. short iIndent;
  90. LPARAM lParam;
  91. // Region listview stuff
  92. HRGN hrgnIcon; // Region which describes the icon for this item
  93. POINT ptRgn; // Location that this item's hrgnIcon was calculated for
  94. RECT rcTextRgn;
  95. LISTGROUP* pGroup;
  96. // Tile column info
  97. UINT cColumns;
  98. PUINT puColumns;
  99. DWORD dwId;
  100. } LISTITEM;
  101. // Report view sub-item structure
  102. typedef struct _LISTSUBITEM
  103. {
  104. LPTSTR pszText;
  105. short iImage;
  106. WORD state;
  107. SIZE sizeText;
  108. } LISTSUBITEM, *PLISTSUBITEM;
  109. #define COLUMN_VIEW
  110. #define LV_HDPA_GROW 16 // Grow chunk size for DPAs
  111. #define LV_HIML_GROW 8 // Grow chunk size for ImageLists
  112. typedef struct _LV
  113. {
  114. CCONTROLINFO ci; // common control header info
  115. BITBOOL fNoDismissEdit:1; // don't dismiss in-place edit control
  116. BITBOOL fButtonDown:1; // we're tracking the mouse with a button down
  117. BITBOOL fOneClickOK:1; // true from creation to double-click-timeout
  118. BITBOOL fOneClickHappened:1; // true from item-activate to double-click-timeout
  119. BITBOOL fPlaceTooltip:1; // should we do the placement of tooltip over the text?
  120. BITBOOL fImgCtxComplete:1; // TRUE if we have complete bk image
  121. BITBOOL fNoEmptyText:1; // we don't have text for an empty view.
  122. BITBOOL fGroupView:1;
  123. BITBOOL fIconsPositioned:1;
  124. BITBOOL fInsertAfter:1; // insert after (or before) iInsertSlot slot.
  125. BITBOOL fListviewAlphaSelect:1;
  126. BITBOOL fListviewShadowText:1;
  127. BITBOOL fListviewWatermarkBackgroundImages:1;
  128. BITBOOL fListviewEnableWatermark:1;
  129. BITBOOL fInFixIScrollPositions:1;
  130. WORD wView; // Which view are we in?
  131. HDPA hdpa; // item array structure
  132. DWORD flags; // LVF_ state bits
  133. DWORD exStyle; // the listview LVM_SETEXTENDEDSTYLE
  134. DWORD dwExStyle; // the windows ex style
  135. HFONT hfontLabel; // font to use for labels
  136. COLORREF clrBk; // Background color
  137. COLORREF clrBkSave; // Background color saved during disable
  138. COLORREF clrText; // text color
  139. COLORREF clrTextBk; // text background color
  140. COLORREF clrOutline; // focus rect outline color
  141. HBRUSH hbrBk;
  142. HANDLE hheap; // The heap to use to allocate memory from.
  143. int cyLabelChar; // height of '0' in hfont
  144. int cxLabelChar; // width of '0'
  145. int cxEllipses; // width of "..."
  146. int iDrag; // index of item being dragged
  147. int iFocus; // index of currently-focused item
  148. int iMark; // index of "mark" for range selection
  149. int iItemDrawing; // item currently being drawn
  150. int iFirstChangedNoRedraw; // Index of first item added during no redraw.
  151. UINT stateCallbackMask; // item state callback mask
  152. SIZE sizeClient; // current client rectangle
  153. int nWorkAreas; // Number of workareas
  154. LPRECT prcWorkAreas; // The workarea rectangles -- nWorkAreas of them.
  155. UINT nSelected;
  156. int iPuntChar;
  157. HRGN hrgnInval;
  158. HWND hwndToolTips; // handle of the tooltip window for this view
  159. int iTTLastHit; // last item hit for text
  160. int iTTLastSubHit; // last subitem hit for text
  161. LPTSTR pszTip; // buffer for tip
  162. #ifdef USE_SORT_FLARE
  163. int iSortFlare;
  164. #endif
  165. // Small icon view fields
  166. HIMAGELIST himlSmall; // small icons
  167. int cxSmIcon; // image list x-icon size
  168. int cySmIcon; // image list y-icon size
  169. int xOrigin; // Horizontal scroll posiiton
  170. int cxItem; // Width of small icon items
  171. int cyItem; // item height
  172. int cItemCol; // Number of items per column
  173. int cxIconSpacing;
  174. int cyIconSpacing;
  175. // Icon view fields
  176. HIMAGELIST himl;
  177. int cxIcon; // image list x-icon size
  178. int cyIcon; // image list y-icon size
  179. HDPA hdpaZOrder; // Large icon Z-order array
  180. // Some definitions, to help make sense of the next two variables:
  181. //
  182. // Lets call the pitem->pt coordinate values "listview coordinates".
  183. //
  184. // Lets use rcClient as short-hand for the client area of the listview window.
  185. //
  186. // (1) ptOrigin is defined as the listview coordinate that falls on rcClient's 0,0 position.
  187. //
  188. // i.e., here's how to calculate the x,y location on rcClient for some item:
  189. // * pitem->pt.x - ptOrigin.x , pitem->pt.y - ptOrigin.y
  190. // Let's call that these values "window coordinates".
  191. //
  192. // (2) rcView is defined as the bounding rect of: each item's unfolded rcview bounding rect and a bit of buffer
  193. // note: ListView_ValidatercView() checks this
  194. //
  195. // (3) For scrolling listviews (!LVS_NOSCROLL), there are two scrolling cases to consider:
  196. // First, where rcClient is smaller than rcView:
  197. // * rcView.left <= ptOrigin.x <= ptOrigin.x+RECTWIDTH(rcClient) <= rcView.right
  198. // Second, where rcClient is larger than rcView (no scrollbars visible):
  199. // * ptOrigin.x <= rcView.left <= rcView.right <= ptOrigin.x+RECTWIDTH(rcClient)
  200. // note: ListView_ValidateScrollPositions() checks this
  201. //
  202. // (4) For non scrolling listviews (LVS_NOSCROLL), we have some legacy behavior to consider:
  203. // For clients that persist icon positions but not the ptOrigin value, we must ensure:
  204. // * 0 == ptOrigin.x
  205. // note: ListView_ValidateScrollPositions() checks this
  206. //
  207. POINT ptOrigin; // Scroll position
  208. RECT rcView; // Bounds of all icons (ptOrigin relative)
  209. int iFreeSlot; // Most-recently found free icon slot since last reposition (-1 if none)
  210. int cSlots;
  211. HWND hwndEdit; // edit field for edit-label-in-place
  212. int iEdit; // item being edited
  213. WNDPROC pfnEditWndProc; // edit field subclass proc
  214. NMITEMACTIVATE nmOneClickHappened;
  215. #define SMOOTHSCROLLLIMIT 10
  216. int iScrollCount; // how many times have we gotten scroll messages before an endscroll?
  217. // Report view fields
  218. int iLastColSort;
  219. int cCol;
  220. HDPA hdpaSubItems;
  221. HWND hwndHdr; // Header control
  222. int yTop; // First usable pixel (below header)
  223. int xTotalColumnWidth; // Total width of all columns
  224. POINTL ptlRptOrigin; // Origin of Report.
  225. int iSelCol; // to handle column width changing. changing col
  226. int iSelOldWidth; // to handle column width changing. changing col width
  227. int cyItemSave; // in ownerdrawfixed mode, we put the height into cyItem. use this to save the old value
  228. // Tile View fields
  229. SIZE sizeTile; // the size of a tile
  230. int cSubItems; // Count of the number of sub items to display in a tile
  231. DWORD dwTileFlags; // LVTVIF_FIXEDHEIGHT | LVTVIF_FIXEDWIDTH
  232. RECT rcTileLabelMargin; // addition space to reserve around label
  233. // Group View fields
  234. HDPA hdpaGroups; // Groups
  235. RECT rcBorder; // Border thickness
  236. COLORREF crHeader;
  237. COLORREF crFooter;
  238. COLORREF crTop;
  239. COLORREF crBottom;
  240. COLORREF crLeft;
  241. COLORREF crRight;
  242. HFONT hfontGroup;
  243. UINT paddingLeft;
  244. UINT paddingTop;
  245. UINT paddingRight;
  246. UINT paddingBottom;
  247. TCHAR szItems[50];
  248. // state image stuff
  249. HIMAGELIST himlState;
  250. int cxState;
  251. int cyState;
  252. // OWNERDATA stuff
  253. ILVRange *plvrangeSel; // selection ranges
  254. ILVRange *plvrangeCut; // Cut Range
  255. int cTotalItems; // number of items in the ownerdata lists
  256. int iDropHilite; // which item is drop hilited, assume only 1
  257. int iMSAAMin, iMSAAMax; // keep track of what we told accessibility
  258. UINT uUnplaced; // items that have been added but not placed (pt.x == RECOMPUTE)
  259. int iHot; // which item is hot
  260. HFONT hFontHot; // the underlined font .. assume this has the same size metrics as hFont
  261. int iNoHover; // don't allow hover select on this guy because it's the one we just hover selected (avoids toggling)
  262. DWORD dwHoverTime; // Defaults to HOVER_DEFAULT
  263. HCURSOR hCurHot; // the cursor when we're over a hot item
  264. // BkImage stuff
  265. IImgCtx *pImgCtx; // Background image interface
  266. ULONG ulBkImageFlags; // LVBKIF_*
  267. HBITMAP hbmBkImage; // Background bitmap (LVBKIF_SOURCE_HBITMAP)
  268. LPTSTR pszBkImage; // Background URL (LVBKIF_SOURCE_URL)
  269. int xOffsetPercent; // X offset for LVBKIF_STYLE_NORMAL images
  270. int yOffsetPercent; // Y offset for LVBKIF_STYLE_NORMAL images
  271. HPALETTE hpalHalftone; // Palette for drawing bk images
  272. LPTSTR pszEmptyText; // buffer for empty view text.
  273. COLORREF clrHotlight; // Hot light color set explicitly for this listview.
  274. POINT ptCapture;
  275. //incremental search stuff
  276. ISEARCHINFO is;
  277. // Themes
  278. HTHEME hTheme;
  279. // Insertmark
  280. int iInsertItem; // The item to insert next to
  281. int clrim; // The color of the insert mark.
  282. int iTracking; // Used for tooltips via keyboard (current item in focus for info display, >= 0 is tracking active)
  283. LPARAM lLastMMove; // Filter out mouse move messages that didn't result in an actual move (for track tooltip canceling)
  284. // Frozen Slot
  285. int iFrozenSlot; // The slot that should not be used by anyone other than the frozen item
  286. LISTITEM *pFrozenItem; // Pointer to the frozen item.
  287. RECT rcViewMargin; // the EnsureVisible margine around an item -- the rcView margin
  288. RECT rcMarquee;
  289. // Watermarks
  290. HBITMAP hbmpWatermark;
  291. SIZE szWatermark;
  292. // Id Tracking
  293. DWORD idNext; // Stores the next ID.
  294. DWORD iLastId; // Stores the index to the previous item for searches
  295. DWORD iIncrement;
  296. } LV;
  297. #define LV_StateImageValue(pitem) ((int)(((DWORD)((pitem)->state) >> 12) & 0xF))
  298. #define LV_StateImageIndex(pitem) (LV_StateImageValue(pitem) - 1)
  299. // listview flag values
  300. #define LVF_FOCUSED 0x00000001
  301. #define LVF_VISIBLE 0x00000002
  302. #define LVF_ERASE 0x00000004 // is hrgnInval to be erased?
  303. #define LVF_NMEDITPEND 0x00000008
  304. #define LVF_REDRAW 0x00000010 // Value from WM_SETREDRAW message
  305. #define LVF_ICONPOSSML 0x00000020 // X, Y coords are in small icon view
  306. #define LVF_INRECOMPUTE 0x00000040 // Check to make sure we are not recursing
  307. #define LVF_UNFOLDED 0x00000080
  308. #define LVF_FONTCREATED 0x00000100 // we created the LV font
  309. #define LVF_SCROLLWAIT 0x00000200 // we're waiting to scroll
  310. #define LVF_COLSIZESET 0x00000400 // Has the caller explictly set width for list view
  311. #define LVF_USERBKCLR 0x00000800 // user set the bk color (don't follow syscolorchange)
  312. #define LVF_ICONSPACESET 0x00001000 // the user has set the icon spacing
  313. #define LVF_CUSTOMFONT 0x00002000 // there is at least one item with a custom font
  314. #define LVF_DONTDRAWCOMP 0x00004000 // do not draw IME composition if true
  315. #define LVF_INSERTINGCOMP 0x00008000 // Avoid recursion
  316. #define LVF_INRECALCREGION 0x00010000 // prevents recursion in RecalcRegion
  317. #define LVF_DRAGIMAGE 0x00020000 // Generating a drag image
  318. #define LVF_MARQUEE 0x00040000
  319. #define ENTIRE_REGION 1
  320. // listview DrawItem flags
  321. #define LVDI_NOIMAGE 0x0001 // don't draw image
  322. #define LVDI_TRANSTEXT 0x0002 // draw text transparently in black
  323. #define LVDI_NOWAYFOCUS 0x0004 // don't allow focus to drawing
  324. #define LVDI_FOCUS 0x0008 // focus is set (for drawing)
  325. #define LVDI_SELECTED 0x0010 // draw selected text
  326. #define LVDI_SELECTNOFOCUS 0x0020
  327. #define LVDI_HOTSELECTED 0x0040
  328. #define LVDI_UNFOLDED 0x0080 // draw the item unfolded (forced)
  329. #define LVDI_NOICONSELECT 0x0100
  330. #define LVDI_GLOW 0x0200
  331. #define LVDI_SHADOW 0x0400
  332. #define LVDI_NOEFFECTS 0x0800
  333. // listview private insertmark flags (Note: these must not conflict with the public ones in commctrl.w)
  334. #define LVIM_SETFROMINFO 0x80000000
  335. typedef struct {
  336. LV* plv;
  337. LPPOINT lpptOrg;
  338. LPRECT prcClip;
  339. UINT flags;
  340. LISTITEM* pitem;
  341. DWORD dwCustom;
  342. NMLVCUSTOMDRAW nmcd;
  343. } LVDRAWITEM, *PLVDRAWITEM;
  344. // listview child control ids
  345. #define LVID_HEADER 0
  346. // listview keyboard tooltip tracking
  347. #define LVKTT_NOTRACK -1
  348. // When there is no frozen slot, it is -1.
  349. #define LV_NOFROZENSLOT -1
  350. // When no item is frozen, the index of the frozen item is -1.
  351. #define LV_NOFROZENITEM -1
  352. // Instance data pointer access functions
  353. #define ListView_GetPtr(hwnd) (LV*)GetWindowPtr(hwnd, 0)
  354. #define ListView_SetPtr(hwnd, p) (LV*)SetWindowPtr(hwnd, 0, p)
  355. // view type check functions
  356. #define ListView_IsIconView(plv) ((plv)->wView == LV_VIEW_ICON)
  357. #define ListView_IsTileView(plv) ((plv)->wView == LV_VIEW_TILE)
  358. #define ListView_IsSmallView(plv) ((plv)->wView == LV_VIEW_SMALLICON)
  359. #define ListView_IsListView(plv) ((plv)->wView == LV_VIEW_LIST)
  360. #define ListView_IsReportView(plv) ((plv)->wView == LV_VIEW_DETAILS)
  361. #define ListView_IsAutoArrangeView(plv) ((((plv)->wView == LV_VIEW_ICON) || ((plv)->wView == LV_VIEW_SMALLICON) || ((plv)->wView == LV_VIEW_TILE)))
  362. #define ListView_IsSlotView(plv) ((((plv)->wView == LV_VIEW_ICON) || ((plv)->wView == LV_VIEW_SMALLICON) || ((plv)->wView == LV_VIEW_TILE)))
  363. #define ListView_UseLargeIcons(plv) (((plv)->wView == LV_VIEW_ICON) || ((plv)->wView == LV_VIEW_TILE))
  364. #define ListView_IsRearrangeableView(plv) (((plv)->wView == LV_VIEW_ICON) || ((plv)->wView == LV_VIEW_SMALLICON) || ((plv)->wView == LV_VIEW_TILE))
  365. #define ListView_IsIScrollView(plv) (((plv)->wView == LV_VIEW_ICON) || ((plv)->wView == LV_VIEW_SMALLICON) || ((plv)->wView == LV_VIEW_TILE))
  366. #define ListView_IsGroupedView(plv) ((plv)->wView != LV_VIEW_LIST)
  367. #define ListView_IsOwnerData( plv ) (plv->ci.style & (UINT)LVS_OWNERDATA)
  368. #define ListView_CheckBoxes(plv) (plv->exStyle & LVS_EX_CHECKBOXES)
  369. #define ListView_FullRowSelect(plv) (plv->exStyle & LVS_EX_FULLROWSELECT)
  370. #define ListView_IsInfoTip(plv) (plv->exStyle & LVS_EX_INFOTIP)
  371. #define ListView_OwnerDraw(plv) (plv->ci.style & LVS_OWNERDRAWFIXED)
  372. #define ListView_IsLabelTip(plv) (plv->exStyle & LVS_EX_LABELTIP)
  373. #define ListView_SingleRow(plv) (plv->exStyle & LVS_EX_SINGLEROW)
  374. #define ListView_HideLabels(plv) (plv->exStyle & LVS_EX_HIDELABELS)
  375. #define ListView_IsBorderSelect(plv) (plv->exStyle & LVS_EX_BORDERSELECT)
  376. #define ListView_IsWatermarked(plv) ((plv)->fListviewEnableWatermark && (plv)->hbmpWatermark)
  377. #define ListView_IsWatermarkedBackground(plv) ((plv)->fListviewWatermarkBackgroundImages && (plv)->pImgCtx && (plv)->fImgCtxComplete)
  378. #define ListView_IsSimpleSelect(plv) (plv->exStyle & LVS_EX_SIMPLESELECT)
  379. #ifdef DPITEST
  380. #define ListView_IsDPIScaled(plv) TRUE
  381. #else
  382. #define ListView_IsDPIScaled(plv) (CCDPIScale((plv)->ci))
  383. #endif
  384. #ifdef DEBUG_PAINT
  385. #define ListView_IsDoubleBuffer(plv) (FALSE)
  386. #else
  387. #define ListView_IsDoubleBuffer(plv) (plv->exStyle & LVS_EX_DOUBLEBUFFER)
  388. #endif
  389. #define ListView_IsKbdTipTracking(plv) (plv->iTracking != LVKTT_NOTRACK)
  390. // Some helper macros for checking some of the flags...
  391. #define ListView_RedrawEnabled(plv) ((plv->flags & (LVF_REDRAW | LVF_VISIBLE)) == (LVF_REDRAW|LVF_VISIBLE))
  392. // The hdpaZorder is acutally an array of DWORDS which contains the
  393. // indexes of the items and not actual pointers...
  394. // NOTE: linear search! this can be slow
  395. #define ListView_ZOrderIndex(plv, i) DPA_GetPtrIndex((plv)->hdpaZOrder, IntToPtr(i))
  396. // Message handler functions (listview.c):
  397. LRESULT CALLBACK _export ListView_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  398. BOOL ListView_NotifyCacheHint( LV* plv, int iFrom, int iTo );
  399. void ListView_NotifyRecreate(LV *plv);
  400. BOOL ListView_OnCreate(LV* plv, CREATESTRUCT* lpCreateStruct);
  401. void ListView_OnNCDestroy(LV* plv);
  402. void ListView_OnPaint(LV* plv, HDC hdc);
  403. BOOL ListView_OnEraseBkgnd(LV* plv, HDC hdc);
  404. void ListView_OnCommand(LV* plv, int id, HWND hwndCtl, UINT codeNotify);
  405. void ListView_OnEnable(LV* plv, BOOL fEnable);
  406. BOOL ListView_OnWindowPosChanging(LV* plv, WINDOWPOS* lpwpos);
  407. void ListView_OnWindowPosChanged(LV* plv, const WINDOWPOS* lpwpos);
  408. void ListView_OnSetFocus(LV* plv, HWND hwndOldFocus);
  409. void ListView_OnKillFocus(LV* plv, HWND hwndNewFocus);
  410. void ListView_OnKey(LV* plv, UINT vk, BOOL fDown, int cRepeat, UINT flags);
  411. BOOL ListView_OnImeComposition(LV* plv, WPARAM wParam, LPARAM lParam);
  412. void ListView_OnChar(LV* plv, UINT ch, int cRepeat);
  413. void ListView_OnButtonDown(LV* plv, BOOL fDoubleClick, int x, int y, UINT keyFlags);
  414. void ListView_OnLButtonUp(LV* plv, int x, int y, UINT keyFlags);
  415. void ListView_OnCancelMode(LV* plv);
  416. void ListView_OnTimer(LV* plv, UINT id);
  417. void ListView_SetupPendingNameEdit(LV* plv);
  418. #define ListView_CancelPendingEdit(plv) ListView_CancelPendingTimer(plv, LVF_NMEDITPEND, IDT_NAMEEDIT)
  419. #define ListView_CancelScrollWait(plv) ListView_CancelPendingTimer(plv, LVF_SCROLLWAIT, IDT_SCROLLWAIT)
  420. BOOL ListView_CancelPendingTimer(LV* plv, UINT fFlag, int idTimer);
  421. void ListView_OnHScroll(LV* plv, HWND hwndCtl, UINT code, int pos);
  422. void ListView_OnVScroll(LV* plv, HWND hwndCtl, UINT code, int pos);
  423. BOOL ListView_CommonArrange(LV* plv, UINT style, HDPA hdpaSort);
  424. BOOL ListView_CommonArrangeEx(LV* plv, UINT style, HDPA hdpaSort, int iWorkArea);
  425. BOOL ListView_OnSetCursor(LV* plv, HWND hwndCursor, UINT codeHitTest, UINT msg);
  426. UINT ListView_OnGetDlgCode(LV* plv, MSG* lpmsg);
  427. HBRUSH ListView_OnCtlColor(LV* plv, HDC hdc, HWND hwndChild, int type);
  428. void ListView_OnSetFont(LV* plvCtl, HFONT hfont, BOOL fRedraw);
  429. HFONT ListView_OnGetFont(LV* plv);
  430. void ListViews_OnTimer(LV* plv, UINT id);
  431. void ListView_OnWinIniChange(LV* plv, WPARAM wParam, LPARAM lParam);
  432. void ListView_OnSysColorChange(LV* plv);
  433. void ListView_OnSetRedraw(LV* plv, BOOL fRedraw);
  434. BOOL ListView_OnSetTileViewInfo(LV* plv, PLVTILEVIEWINFO pTileViewInfo);
  435. BOOL ListView_OnGetTileViewInfo(LV* plv, PLVTILEVIEWINFO pTileViewInfo);
  436. BOOL ListView_OnSetTileInfo(LV* plv, PLVTILEINFO pTileInfo);
  437. BOOL ListView_OnGetTileInfo(LV* plv, PLVTILEINFO pTileInfo);
  438. HIMAGELIST ListView_OnCreateDragImage(LV *plv, int iItem, LPPOINT lpptUpLeft);
  439. BOOL ListView_ISetColumnWidth(LV* plv, int iCol, int cx, BOOL fExplicit);
  440. typedef void (*SCROLLPROC)(LV*, int dx, int dy, UINT uSmooth);
  441. void ListView_ComOnScroll(LV* plv, UINT code, int posNew, int sb,
  442. int cLine, int cPage);
  443. BOOL ListView_OnGetItemA(LV* plv, LV_ITEMA* plvi);
  444. BOOL ListView_OnSetItemA(LV* plv, LV_ITEMA* plvi);
  445. int ListView_OnInsertItemA(LV* plv, LV_ITEMA* plvi);
  446. int ListView_OnFindItemA(LV* plv, int iStart, LV_FINDINFOA* plvfi);
  447. int ListView_OnGetStringWidthA(LV* plv, LPCSTR psz, HDC hdc);
  448. BOOL ListView_OnGetColumnA(LV* plv, int iCol, LV_COLUMNA* pcol);
  449. BOOL ListView_OnSetColumnA(LV* plv, int iCol, LV_COLUMNA* pcol);
  450. int ListView_OnInsertColumnA(LV* plv, int iCol, LV_COLUMNA* pcol);
  451. int ListView_OnGetItemTextA(LV* plv, int i, LV_ITEMA *lvitem);
  452. BOOL WINAPI ListView_OnSetItemTextA(LV* plv, int i, int iSubItem, LPCSTR pszText);
  453. BOOL WINAPI ListView_OnGetBkImageA(LV* plv, LPLVBKIMAGEA pbiA);
  454. BOOL WINAPI ListView_OnSetBkImageA(LV* plv, LPLVBKIMAGEA pbiA);
  455. BOOL ListView_IsItemUnfolded2(LV* plv, int iItem, int iSubItem, LPTSTR pszText, int cchTextMax);
  456. BOOL WINAPI ListView_OnSetBkImage(LV* plv, LPLVBKIMAGE pbi);
  457. BOOL WINAPI ListView_OnGetBkImage(LV* plv, LPLVBKIMAGE pbi);
  458. BOOL ListView_OnSetBkColor(LV* plv, COLORREF clrBk);
  459. HIMAGELIST ListView_OnSetImageList(LV* plv, HIMAGELIST himl, BOOL fSmallImages);
  460. BOOL ListView_OnDeleteAllItems(LV* plv);
  461. LISTITEM* ListView_InsertItemInternal(LV* plv, const LV_ITEM* plvi, int* pi);
  462. int ListView_OnInsertItem(LV* plv, const LV_ITEM* plvi);
  463. BOOL ListView_OnDeleteItem(LV* plv, int i);
  464. BOOL ListView_OnReplaceItem(LV* plv, const LV_ITEM* plvi);
  465. int ListView_OnFindItem(LV* plv, int iStart, const LV_FINDINFO* plvfi);
  466. BOOL ListView_OnSetItemPosition(LV* plv, int i, int x, int y);
  467. BOOL ListView_OnSetItem(LV* plv, const LV_ITEM* plvi);
  468. BOOL ListView_OnGetItem(LV* plv, LV_ITEM* plvi);
  469. BOOL ListView_OnGetItemPosition(LV* plv, int i, POINT* ppt);
  470. BOOL ListView_OnEnsureVisible(LV* plv, int i, BOOL fPartialOK);
  471. BOOL ListView_OnScroll(LV* plv, int dx, int dy);
  472. int ListView_OnHitTest(LV* plv, LV_HITTESTINFO* pinfo);
  473. int ListView_OnGetStringWidth(LV* plv, LPCTSTR psz, HDC hdc);
  474. BOOL ListView_OnGetItemRect(LV* plv, int i, RECT* prc);
  475. BOOL ListView_OnRedrawItems(LV* plv, int iFirst, int iLast);
  476. int ListView_OnGetNextItem(LV* plv, int i, UINT flags);
  477. BOOL ListView_OnSetColumnWidth(LV* plv, int iCol, int cx);
  478. int ListView_OnGetColumnWidth(LV* plv, int iCol);
  479. void ListView_OnStyleChanging(LV* plv, UINT gwl, LPSTYLESTRUCT pinfo);
  480. void ListView_OnStyleChanged(LV* plv, UINT gwl, LPSTYLESTRUCT pinfo);
  481. int ListView_OnGetTopIndex(LV* plv);
  482. int ListView_OnGetCountPerPage(LV* plv);
  483. BOOL ListView_OnGetOrigin(LV* plv, POINT* ppt);
  484. int ListView_OnGetItemText(LV* plv, int i, LV_ITEM *lvitem);
  485. BOOL WINAPI ListView_OnSetItemText(LV* plv, int i, int iSubItem, LPCTSTR pszText);
  486. HIMAGELIST ListView_OnGetImageList(LV* plv, int iImageList);
  487. UINT ListView_OnGetItemState(LV* plv, int i, UINT mask);
  488. BOOL ListView_OnSetItemState(LV* plv, int i, UINT data, UINT mask);
  489. LRESULT WINAPI ListView_OnSetInfoTip(LV *plv, PLVSETINFOTIP plvSetInfoTip);
  490. // Private functions (listview.c):
  491. #define QUERY_DEFAULT 0x0
  492. #define QUERY_FOLDED 0x1
  493. #define QUERY_UNFOLDED 0x2
  494. #define QUERY_RCVIEW 0x4
  495. #define IsQueryFolded(dw) (((dw)&(QUERY_FOLDED|QUERY_UNFOLDED)) == QUERY_FOLDED)
  496. #define IsQueryUnfolded(dw) (((dw)&(QUERY_FOLDED|QUERY_UNFOLDED)) == QUERY_UNFOLDED)
  497. #define IsQueryrcView(dw) (((dw)&(QUERY_RCVIEW)) == QUERY_RCVIEW)
  498. BOOL ListView_Notify(LV* plv, int i, int iSubItem, int code);
  499. void ListView_GetRects(LV* plv, int i, UINT fQueryLabelRects,
  500. RECT* prcIcon, RECT* prcLabel,
  501. RECT* prcBounds, RECT* prcSelectBounds);
  502. BOOL ListView_DrawItem(PLVDRAWITEM);
  503. #define ListView_InvalidateItem(p,i,s,r) ListView_InvalidateItemEx(p,i,s,r,0)
  504. void ListView_InvalidateItemEx(LV* plv, int i, BOOL fSelectionOnly,
  505. UINT fRedraw, UINT maskChanged);
  506. void ListView_TypeChange(LV* plv, WORD wViewOld, BOOL fOwnerDrawFixed);
  507. void ListView_DeleteHrgnInval(LV* plv);
  508. void ListView_Redraw(LV* plv, HDC hdc, RECT* prc);
  509. void ListView_RedrawSelection(LV* plv);
  510. BOOL ListView_FreeItem(LV* plv, LISTITEM* pitem);
  511. void ListView_FreeSubItem(PLISTSUBITEM plsi);
  512. LISTITEM* ListView_CreateItem(LV* plv, const LV_ITEM* plvi);
  513. void ListView_UpdateScrollBars(LV* plv);
  514. int ListView_SetFocusSel(LV* plv, int iNewFocus, BOOL fSelect, BOOL fDeselectAll, BOOL fToggleSel);
  515. void ListView_GetRectsOwnerData(LV* plv, int iItem,
  516. RECT* prcIcon, RECT* prcLabel, RECT* prcBounds,
  517. RECT* prcSelectBounds, LISTITEM* pitem);
  518. void ListView_CalcMinMaxIndex( LV* plv, PRECT prcBounding, int* iMin, int* iMax );
  519. int ListView_LCalcViewItem( LV* plv, int x, int y );
  520. void LVSeeThruScroll(LV *plv, LPRECT lprcUpdate);
  521. BOOL ListView_UnfoldRects(LV* plv, int iItem,
  522. RECT* prcIcon, RECT* prcLabel,
  523. RECT* prcBounds, RECT* prcSelectBounds);
  524. BOOL ListView_FindWorkArea(LV * plv, POINT pt, short * piWorkArea);
  525. __inline int ListView_Count(LV *plv)
  526. {
  527. ASSERT(ListView_IsOwnerData(plv) || plv->cTotalItems == DPA_GetPtrCount(plv->hdpa));
  528. return plv->cTotalItems;
  529. }
  530. // Forcing (i) to UINT lets us catch bogus negative numbers, too.
  531. #define ListView_IsValidItemNumber(plv, i) ((UINT)(i) < (UINT)ListView_Count(plv))
  532. #define ListView_GetItemPtr(plv, i) ((LISTITEM*)DPA_GetPtr((plv)->hdpa, (i)))
  533. #ifdef DEBUG
  534. #define ListView_FastGetItemPtr(plv, i) ((LISTITEM*)DPA_GetPtr((plv)->hdpa, (i)))
  535. #define ListView_FastGetZItemPtr(plv, i) ((LISTITEM*)DPA_GetPtr((plv)->hdpa, \
  536. (int)OFFSETOF(DPA_GetPtr((plv)->hdpaZOrder, (i)))))
  537. #else
  538. #define ListView_FastGetItemPtr(plv, i) ((LISTITEM*)DPA_FastGetPtr((plv)->hdpa, (i)))
  539. #define ListView_FastGetZItemPtr(plv, i) ((LISTITEM*)DPA_FastGetPtr((plv)->hdpa, \
  540. (int)OFFSETOF(DPA_FastGetPtr((plv)->hdpaZOrder, (i)))))
  541. #endif
  542. BOOL ListView_OnGetInsertMarkRect(LV* plv, LPRECT prc);
  543. COLORREF ListView_OnGetInsertMarkColor(LV* plv);
  544. void ListView_InvalidateMark(LV* plv);
  545. BOOL ListView_OnInsertMarkHitTest(LV* plv, int x, int y, LPLVINSERTMARK ptbim);
  546. LRESULT ListView_OnSetInsertMark(LV* plv, LPLVINSERTMARK plvim);
  547. BOOL ListView_CalcMetrics();
  548. void ListView_ColorChange();
  549. void ListView_DrawBackground(LV* plv, HDC hdc, RECT *prcClip);
  550. BOOL ListView_NeedsEllipses(HDC hdc, LPCTSTR pszText, RECT* prc, int* pcchDraw, int cxEllipses);
  551. int ListView_CompareString(LV* plv, int i, LPCTSTR pszFind, UINT flags, int iLen);
  552. int ListView_GetLinkedTextWidth(HDC hdc, LPCTSTR psz, UINT cch, BOOL bLink);
  553. int ListView_GetCxScrollbar(LV* plv);
  554. int ListView_GetCyScrollbar(LV* plv);
  555. DWORD ListView_GetWindowStyle(LV* plv);
  556. #define ListView_GetScrollInfo(plv, flag, lpsi) \
  557. ((plv)->exStyle & LVS_EX_FLATSB ? \
  558. FlatSB_GetScrollInfo((plv)->ci.hwnd, (flag), (lpsi)) : \
  559. GetScrollInfo((plv)->ci.hwnd, (flag), (lpsi)))
  560. int ListView_SetScrollInfo(LV *plv, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw);
  561. #define ListView_SetScrollRange(plv, flag, min, max, fredraw) \
  562. ((plv)->exStyle & LVS_EX_FLATSB ? \
  563. FlatSB_SetScrollRange((plv)->ci.hwnd, (flag), (min), (max), (fredraw)) : \
  564. SetScrollRange((plv)->ci.hwnd, (flag), (min), (max), (fredraw)))
  565. // lvicon.c functions
  566. BOOL ListView_OnArrange(LV* plv, UINT style);
  567. HWND ListView_OnEditLabel(LV* plv, int i, LPTSTR pszText);
  568. int ListView_IItemHitTest(LV* plv, int x, int y, UINT* pflags, int *piSubItem);
  569. void ListView_IGetRects(LV* plv, LISTITEM* pitem, UINT fQueryLabelRects, RECT* prcIcon,
  570. RECT* prcLabel, LPRECT prcBounds);
  571. void ListView_IGetRectsOwnerData(LV* plv, int iItem, RECT* prcIcon,
  572. RECT* prcLabel, LISTITEM* pitem, BOOL fUsepitem);
  573. void _ListView_GetRectsFromItem(LV* plv, BOOL bSmallIconView,
  574. LISTITEM *pitem, UINT fQueryLabelRects,
  575. LPRECT prcIcon, LPRECT prcLabel, LPRECT prcBounds, LPRECT prcSelectBounds);
  576. __inline void ListView_SetSRecompute(LISTITEM *pitem)
  577. {
  578. pitem->cxSingleLabel = SRECOMPUTE;
  579. pitem->cxMultiLabel = SRECOMPUTE;
  580. pitem->cyFoldedLabel = SRECOMPUTE;
  581. pitem->cyUnfoldedLabel = SRECOMPUTE;
  582. }
  583. void ListView_RecomputeLabelSize(LV* plv, LISTITEM FAR* pitem, int i, HDC hdc, BOOL fUsepitem);
  584. BOOL ListView_SetIconPos(LV* plv, LISTITEM* pitem, int iSlot, int cSlot);
  585. BOOL ListView_IsCleanRect(LV * plv, RECT * prc, int iExcept, UINT fQueryLabelRect, BOOL * pfUpdate, HDC hdc);
  586. int ListView_FindFreeSlot(LV* plv, int i, int iSlot, int cSlot, UINT fQueryLabelRect, BOOL* pfUpdateSB, BOOL* pfAppend, HDC hdc, int iWidth, int iHeight);
  587. int ListView_CalcHitSlot( LV* plv, POINT pt, int cslot, int iWidth, int iHeight );
  588. BOOL ListView_OnGetViewRect(LV* plv, RECT* prcView);
  589. void ListView_GetViewRect2(LV* plv, RECT* prcView, int cx, int cy);
  590. int CALLBACK ArrangeIconCompare(LISTITEM* pitem1, LISTITEM* pitem2, LPARAM lParam);
  591. int ListView_GetSlotCountEx(LV* plv, BOOL fWithoutScroll, int iWorkArea, int *piWidth, int *piHeight);
  592. int ListView_GetSlotCount(LV* plv, BOOL fWithoutScroll, int *piWidth, int *piHeight);
  593. void ListView_CalcSlotRect(LV* plv, LISTITEM *pItem, int iSlot, int cSlot, BOOL fBias, int iWidth, int iHeight, LPRECT lprc);
  594. void ListView_IUpdateScrollBars(LV* plv);
  595. DWORD ListView_GetStyleAndClientRectGivenViewRect(LV* plv, RECT *prcViewRect, RECT* prcClient);
  596. DWORD ListView_GetClientRect(LV* plv, RECT* prcClient, BOOL fSubScrolls, RECT *prcViewRect);
  597. void ListView_SetEditSize(LV* plv);
  598. BOOL ListView_DismissEdit(LV* plv, BOOL fCancel);
  599. LRESULT CALLBACK _export ListView_EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  600. UINT ListView_DrawImageEx(LV* plv, LV_ITEM* pitem, HDC hdc, int x, int y, COLORREF crBk, UINT fDraw, int xMax);
  601. UINT ListView_DrawImageEx2(LV* plv, LV_ITEM* pitem, HDC hdc, int x, int y, COLORREF crBk, UINT fDraw, int xMax, int iIconEffect, int iFrame);
  602. #define ListView_DrawImage(plv, pitem, hdc, x, y, fDraw) \
  603. ListView_DrawImageEx(plv, pitem, hdc, x, y, plv->clrBk, fDraw, -1)
  604. void ListView_SizeIME(HWND hwnd);
  605. void ListView_InsertComposition(HWND hwnd, WPARAM wParam, LPARAM lParam, LV *plv);
  606. void ListView_PaintComposition(HWND hwnd, LV *plv);
  607. // lvsmall.c functions:
  608. void ListView_SGetRects(LV* plv, LISTITEM* pitem, RECT* prcIcon,
  609. RECT* prcLabel, LPRECT prcBounds);
  610. void ListView_SGetRectsOwnerData(LV* plv, int iItem, RECT* prcIcon,
  611. RECT* prcLabel, LISTITEM* pitem, BOOL fUsepitem);
  612. int ListView_SItemHitTest(LV* plv, int x, int y, UINT* pflags, int *piSubItem);
  613. int ListView_LookupString(LV* plv, LPCTSTR lpszLookup, UINT flags, int iStart);
  614. // lvlist.c functions:
  615. void ListView_LGetRects(LV* plv, int i, RECT* prcIcon,
  616. RECT* prcLabel, RECT *prcBounds, RECT* prcSelectBounds);
  617. int ListView_LItemHitTest(LV* plv, int x, int y, UINT* pflags, int *piSubItem);
  618. void ListView_LUpdateScrollBars(LV* plv);
  619. BOOL ListView_MaybeResizeListColumns(LV* plv, int iFirst, int iLast);
  620. // lvrept.c functions:
  621. int ListView_OnSubItemHitTest(LV* plv, LPLVHITTESTINFO lParam);
  622. void ListView_GetSubItem(LV* plv, int i, int iSubItem, PLISTSUBITEM plsi);
  623. BOOL LV_ShouldItemDrawGray(LV* plv, UINT fText);
  624. int ListView_OnInsertColumn(LV* plv, int iCol, const LV_COLUMN* pcol);
  625. BOOL ListView_OnDeleteColumn(LV* plv, int iCol);
  626. BOOL ListView_OnGetColumn(LV* plv, int iCol, LV_COLUMN* pcol);
  627. BOOL ListView_OnSetColumn(LV* plv, int iCol, const LV_COLUMN* pcol);
  628. BOOL ListView_ROnEnsureVisible(LV* plv, int i, BOOL fPartialOK);
  629. void ListView_RInitialize(LV* plv, BOOL fInval);
  630. BOOL ListView_OnGetSubItemRect(LV* plv, int i, LPRECT lprc);
  631. int ListView_RYHitTest(plv, cy);
  632. BOOL ListView_SetSubItem(LV* plv, const LV_ITEM* plvi);
  633. void ListView_RAfterRedraw(LV* plv, HDC hdc);
  634. int ListView_RGetColumnWidth(LV* plv, int iCol);
  635. BOOL ListView_RSetColumnWidth(LV* plv, int iCol, int cx);
  636. LPTSTR ListView_GetSubItemText(LV* plv, int i, int iCol);
  637. void ListView_RDestroy(LV* plv);
  638. int ListView_RItemHitTest(LV* plv, int x, int y, UINT* pflags, int *piSubItem);
  639. void ListView_RUpdateScrollBars(LV* plv);
  640. void ListView_RGetRects(LV* plv, int iItem, RECT* prcIcon,
  641. RECT* prcLabel, RECT* prcBounds, RECT* prcSelectBounds);
  642. LRESULT ListView_HeaderNotify(LV* plv, HD_NOTIFY *pnm);
  643. int ListView_FreeColumnData(LPVOID d, LPVOID p);
  644. BOOL SameChars(LPTSTR lpsz, TCHAR c);
  645. #define ListView_GetSubItemDPA(plv, idpa) \
  646. ((HDPA)DPA_GetPtr((plv)->hdpaSubItems, (idpa)))
  647. int ListView_Arrow(LV* plv, int iStart, UINT vk);
  648. BOOL ListView_IsItemUnfolded(LV *plv, int item);
  649. BOOL ListView_IsItemUnfoldedPtr(LV *plv, LISTITEM *pitem);
  650. // lvtile.c functions:
  651. int ListView_TItemHitTest(LV* plv, int x, int y, UINT* pflags, int *piSubItem);
  652. void ListView_TGetRectsOwnerData( LV* plv,
  653. int iItem,
  654. RECT* prcIcon,
  655. RECT* prcLabel,
  656. LISTITEM* pitem,
  657. BOOL fUsepitem );
  658. void ListView_TGetRects(LV* plv, LISTITEM* pitem, RECT* prcIcon, RECT* prcLabel, LPRECT prcBounds);
  659. BOOL TCalculateSubItemRect(LV* plv, LISTITEM *pitem, LISTSUBITEM* plsi, int i, int iSubItem, HDC hdc, RECT* prc, BOOL *pbUnfolded);
  660. typedef struct LVTILECOLUMNSENUM
  661. {
  662. int iColumnsRemainingMax;
  663. int iTotalSpecifiedColumns;
  664. UINT *puSpecifiedColumns;
  665. int iCurrentSpecifiedColumn;
  666. int iSortedColumn;
  667. BOOL bUsedSortedColumn;
  668. } LVTILECOLUMNSENUM, *PLVTILECOLUMNSENUM;
  669. int _GetNextColumn(PLVTILECOLUMNSENUM plvtce);
  670. void _InitTileColumnsEnum(PLVTILECOLUMNSENUM plvtce, LV* plv, UINT cColumns, UINT *puColumns, BOOL fOneLessLine);
  671. BOOL Tile_Set(UINT **ppuColumns, UINT *pcColumns, UINT *puColumns, UINT cColumns);
  672. // Fake customdraw. See comment block in lvrept.c
  673. typedef struct LVFAKEDRAW {
  674. NMLVCUSTOMDRAW nmcd;
  675. LV* plv;
  676. DWORD dwCustomPrev;
  677. DWORD dwCustomItem;
  678. DWORD dwCustomSubItem;
  679. LV_ITEM *pitem;
  680. HFONT hfontPrev;
  681. } LVFAKEDRAW, *PLVFAKEDRAW;
  682. void ListView_BeginFakeCustomDraw(LV* plv, PLVFAKEDRAW plvfd, LV_ITEM *pitem);
  683. DWORD ListView_BeginFakeItemDraw(PLVFAKEDRAW plvfd);
  684. void ListView_EndFakeItemDraw(PLVFAKEDRAW plvfd);
  685. void ListView_EndFakeCustomDraw(PLVFAKEDRAW plvfd);
  686. //============ External declarations =======================================
  687. //extern HFONT g_hfontLabel;
  688. extern HBRUSH g_hbrActiveLabel;
  689. extern HBRUSH g_hbrInactiveLabel;
  690. extern HBRUSH g_hbrBackground;
  691. // function tables
  692. #define LV_TYPEINDEX(plv) ((plv)->wView)
  693. BOOL ListView_RDrawItem(PLVDRAWITEM);
  694. BOOL ListView_IDrawItem(PLVDRAWITEM);
  695. BOOL ListView_LDrawItem(PLVDRAWITEM);
  696. BOOL ListView_TDrawItem(PLVDRAWITEM);
  697. typedef BOOL (*PFNLISTVIEW_DRAWITEM)(PLVDRAWITEM);
  698. extern const PFNLISTVIEW_DRAWITEM pfnListView_DrawItem[5];
  699. #define _ListView_DrawItem(plvdi) \
  700. pfnListView_DrawItem[LV_TYPEINDEX(plvdi->plv)](plvdi)
  701. void ListView_RUpdateScrollBars(LV* plv);
  702. typedef void (*PFNLISTVIEW_UPDATESCROLLBARS)(LV* plv);
  703. extern const PFNLISTVIEW_UPDATESCROLLBARS pfnListView_UpdateScrollBars[5];
  704. #define _ListView_UpdateScrollBars(plv) \
  705. pfnListView_UpdateScrollBars[LV_TYPEINDEX(plv)](plv)
  706. typedef DWORD (*PFNLISTVIEW_APPROXIMATEVIEWRECT)(LV* plv, int, int, int);
  707. extern const PFNLISTVIEW_APPROXIMATEVIEWRECT pfnListView_ApproximateViewRect[5];
  708. #define _ListView_ApproximateViewRect(plv, iCount, iWidth, iHeight) \
  709. pfnListView_ApproximateViewRect[LV_TYPEINDEX(plv)](plv, iCount, iWidth, iHeight)
  710. typedef int (*PFNLISTVIEW_ITEMHITTEST)(LV* plv, int, int, UINT *, int *);
  711. extern const PFNLISTVIEW_ITEMHITTEST pfnListView_ItemHitTest[5];
  712. #define _ListView_ItemHitTest(plv, x, y, pflags, piSubItem) \
  713. pfnListView_ItemHitTest[LV_TYPEINDEX(plv)](plv, x, y, pflags, piSubItem)
  714. BOOL ListView_SendScrollNotify(LV* plv, BOOL fBegin, int dx, int dy);
  715. void ListView_IOnScroll(LV* plv, UINT code, int posNew, UINT fVert);
  716. void ListView_LOnScroll(LV* plv, UINT code, int posNew, UINT sb);
  717. void ListView_ROnScroll(LV* plv, UINT code, int posNew, UINT sb);
  718. typedef void (*PFNLISTVIEW_ONSCROLL)(LV* plv, UINT, int, UINT );
  719. extern const PFNLISTVIEW_ONSCROLL pfnListView_OnScroll[5];
  720. #define _ListView_OnScroll(plv, x, y, pflags) \
  721. pfnListView_OnScroll[LV_TYPEINDEX(plv)](plv, x, y, pflags)
  722. void ListView_IRecomputeLabelSize(LV* plv, LISTITEM* pitem, int i, HDC hdc, BOOL fUsepitem);
  723. void ListView_TRecomputeLabelSize(LV* plv, LISTITEM* pitem, int i, HDC hdc, BOOL fUsepitem);
  724. typedef void (*PFNLISTVIEW_RECOMPUTELABELSIZE)(LV* plv, LISTITEM* pitem, int i, HDC hdc, BOOL fUsepitem);
  725. extern const PFNLISTVIEW_RECOMPUTELABELSIZE pfnListView_RecomputeLabelSize[5];
  726. #define _ListView_RecomputeLabelSize(plv, pitem, i, hdc, fUsepitem) \
  727. pfnListView_RecomputeLabelSize[LV_TYPEINDEX(plv)](plv, pitem, i, hdc, fUsepitem)
  728. void ListView_Scroll2(LV* plv, int dx, int dy);
  729. void ListView_IScroll2(LV* plv, int dx, int dy, UINT uSmooth);
  730. void ListView_LScroll2(LV* plv, int dx, int dy, UINT uSmooth);
  731. void ListView_RScroll2(LV* plv, int dx, int dy, UINT uSmooth);
  732. typedef void (*PFNLISTVIEW_SCROLL2)(LV* plv, int, int, UINT );
  733. extern const PFNLISTVIEW_SCROLL2 pfnListView_Scroll2[5];
  734. #define _ListView_Scroll2(plv, x, y, pflags) \
  735. pfnListView_Scroll2[LV_TYPEINDEX(plv)](plv, x, y, pflags)
  736. int ListView_IGetScrollUnitsPerLine(LV* plv, UINT sb);
  737. int ListView_LGetScrollUnitsPerLine(LV* plv, UINT sb);
  738. int ListView_RGetScrollUnitsPerLine(LV* plv, UINT sb);
  739. typedef int (*PFNLISTVIEW_GETSCROLLUNITSPERLINE)(LV* plv, UINT sb);
  740. extern const PFNLISTVIEW_GETSCROLLUNITSPERLINE pfnListView_GetScrollUnitsPerLine[5];
  741. #define _ListView_GetScrollUnitsPerLine(plv, sb) \
  742. pfnListView_GetScrollUnitsPerLine[LV_TYPEINDEX(plv)](plv, sb)
  743. UINT ListView_GetTextSelectionFlags(LV* plv, LV_ITEM *pitem, UINT fDraw);
  744. BOOL NEAR ListView_IRecomputeEx(LV* plv, HDPA hdpaSort, int iFrom, BOOL fForce);
  745. BOOL NEAR ListView_RRecomputeEx(LV* plv, HDPA hdpaSort, int iFrom, BOOL fForce);
  746. BOOL NEAR ListView_NULLRecomputeEx(LV* plv, HDPA hdpaSort, int iFrom, BOOL fForce);
  747. typedef int (*PFNLISTVIEW_RECOMPUTEEX)(LV* plv, HDPA hdpaSort, int iFrom, BOOL fForce);
  748. extern const PFNLISTVIEW_RECOMPUTEEX pfnListView_RecomputeEx[5];
  749. #define _ListView_RecomputeEx(plv, hdpaSort, iFrom, fForce)\
  750. pfnListView_RecomputeEx[LV_TYPEINDEX(plv)](plv, hdpaSort, iFrom, fForce);
  751. #define ListView_Recompute(plv) _ListView_RecomputeEx(plv, NULL, 0, FALSE)
  752. LISTGROUP* ListView_FindFirstVisibleGroup(LV* plv);
  753. UINT LV_IsItemOnViewEdge(LV* plv, LISTITEM *pitem);
  754. void _GetCurrentItemSize(LV* plv, int * pcx, int *pcy);
  755. void ListView_CalcItemSlotAndRect(LV* plv, LISTITEM* pitem, int* piSlot, RECT* prcSlot);
  756. // Expand the "rcIcon" by this much for glow
  757. #define GLOW_EXPAND 10
  758. // pixel offset from the state image to the
  759. #define LV_ICONTOSTATECX 3
  760. // list view state offset, this is the gap between the icon and the
  761. #define LV_ICONTOSTATEOFFSET(plv) ((plv->cxState > 0) ? LV_ICONTOSTATECX:0)
  762. //#define DEBUG_PAINT
  763. #ifdef DEBUG_PAINT
  764. void ListView_DebugDrawInvalidRegion(LV* plv, RECT* prc, HRGN hrgn);
  765. void ListView_DebugDisplayClipRegion(LV* plv, RECT* prc, HRGN hrgn);
  766. #else
  767. #define ListView_DebugDrawInvalidRegion(plv, prc, hrgn)
  768. #define ListView_DebugDisplayClipRegion(plv, prc, hrgn)
  769. #endif
  770. #define LVMI_PLACEITEMS (WM_USER)
  771. int ListView_GetIconBufferX(LV* plv);
  772. int ListView_GetIconBufferY(LV* plv);
  773. BOOL ListView_ICalcViewRect(LV* plv, BOOL fNoRecalc, RECT* prcView);
  774. void ListView_CalcBounds(LV* plv, UINT fQueryLabelRects, RECT *prcIcon, RECT *prcLabel, RECT *prcBounds);
  775. void ListView_AddViewRectBuffer(LV* plv, RECT* prcView);
  776. BOOL ListView_FixIScrollPositions(LV *plv, BOOL fNoScrollbarUpdate, RECT* prcClient);
  777. void ListView_InvalidateWindow(LV* plv);
  778. BOOL ListView_OnScrollSelectSmooth(LV* plv, int dx, int dy, UINT uSmooth);
  779. #ifdef DEBUG
  780. BOOL ListView_ValidateScrollPositions(LV* plv, RECT* prcClient);
  781. BOOL ListView_ValidatercView(LV* plv, RECT* prcView, BOOL fRecalcDone);
  782. #endif
  783. #endif //!_INC_LISTVIEW