303 BOOL bDefaultBkColor;
341#define DEBUG_BUFFERS 20
343#define DEBUG_BUFFER_SIZE 256
346#define SB_INTERNAL -1
349#define DISP_TEXT_SIZE 260
352#define WIDTH_PADDING 12
355#define HEIGHT_PADDING 1
358#define REPORT_MARGINX 2
372#define ICON_TOP_PADDING_NOTHITABLE 2
373#define ICON_TOP_PADDING_HITABLE 2
374#define ICON_TOP_PADDING (ICON_TOP_PADDING_NOTHITABLE + ICON_TOP_PADDING_HITABLE)
375#define ICON_BOTTOM_PADDING 4
376#define LABEL_HOR_PADDING 5
377#define LABEL_VERT_PADDING 7
378#define ICON_LR_PADDING 16
379#define ICON_LR_HALF (ICON_LR_PADDING/2)
382#define DEFAULT_LABEL_WIDTH 40
384#define MAX_EMPTYTEXT_SELECT_WIDTH 80
387#define DEFAULT_COLUMN_WIDTH 128
390#define LISTVIEW_SCROLL_ICON_LINE_SIZE 37
393#define IMAGE_PADDING 2
396#define TRAILING_LABEL_PADDING 12
397#define TRAILING_HEADER_PADDING 11
400#define CAPTION_BORDER 2
403#define LV_ML_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
404#define LV_FL_DT_FLAGS (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_NOCLIP)
405#define LV_SL_DT_FLAGS (DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
408#define STATEIMAGEINDEX(x) (((x) & LVIS_STATEIMAGEMASK) >> 12)
414#define LISTVIEW_DUMP(iP) do { \
415 TRACE("hwndSelf=%p, clrBk=0x%06x, clrText=0x%06x, clrTextBk=0x%06x, ItemHeight=%d, ItemWidth=%d, Style=0x%08x\n", \
416 iP->hwndSelf, iP->clrBk, iP->clrText, iP->clrTextBk, \
417 iP->nItemHeight, iP->nItemWidth, iP->dwStyle); \
418 TRACE("hwndSelf=%p, himlNor=%p, himlSml=%p, himlState=%p, Focused=%d, Hot=%d, exStyle=0x%08x, Focus=%d\n", \
419 iP->hwndSelf, iP->himlNormal, iP->himlSmall, iP->himlState, \
420 iP->nFocusedItem, iP->nHotItem, iP->dwLvExStyle, iP->bFocus ); \
421 TRACE("hwndSelf=%p, ntmH=%d, icSz.cx=%d, icSz.cy=%d, icSp.cx=%d, icSp.cy=%d, notifyFmt=%d\n", \
422 iP->hwndSelf, iP->ntmHeight, iP->iconSize.cx, iP->iconSize.cy, \
423 iP->iconSpacing.cx, iP->iconSpacing.cy, iP->notifyFormat); \
424 TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, wine_dbgstr_rect(&iP->rcList)); \
531 if (!aw)
return bt ? -1 : 0;
563 static int index = 0;
570 if (!lprng)
return "(null)";
579 if (pScrollInfo ==
NULL)
return "(null)";
613 if (!plvnm)
return "(null)";
615 " uOldState=0x%x, uChanged=0x%x, ptAction=%s, lParam=%ld",
625 if (lpLVItem ==
NULL)
return "(null)";
667 if (lpColumn ==
NULL)
return "(null)";
711 if (!lpht)
return "(null)";
730 default:
return "unknown";
739 switch (unicodeNotificationCode)
770 FIXME(
"unknown notification %x\n", unicodeNotificationCode);
771 return unicodeNotificationCode;
947 ret_length =
pdi->item.cchTextMax;
948 ret_text =
pdi->item.pszText;
950 if (return_unicode || return_ansi)
961 *
pdi->item.pszText = 0;
983 TRACE(
" resulting code=%d\n",
pdi->hdr.code);
985 if (return_ansi || return_unicode)
989 strcpy((
char*)ret_text, (
char*)
pdi->item.pszText);
995 else if (return_ansi)
1002 ret_text, ret_length);
1004 pdi->item.pszText = ret_text;
1005 pdi->item.cchTextMax = ret_length;
1034 lpnmlvcd->
nmcd.
rc = *rcBounds;
1037 if (!lplvItem)
return;
1083 textcolor = lpnmlvcd->
clrText;
1212 i->nItem =
i->nSpecial;
1213 if (
i->nItem != -1)
return TRUE;
1215 if (
i->nItem ==
i->nSpecial)
1217 if (
i->ranges)
i->index = 0;
1223 if (
i->nItem ==
i->nSpecial)
i->nItem++;
1224 if (
i->nItem <
i->range.upper)
return TRUE;
1233 else if (
i->nItem >=
i->range.upper)
goto end;
1235 i->nItem =
i->range.lower;
1236 if (
i->nItem >= 0)
goto testitem;
1258 if (
i->nItem ==
i->nSpecial)
1266 if (
i->nItem ==
i->nSpecial)
i->nItem--;
1267 if (
i->nItem >=
i->range.lower)
return TRUE;
1276 else if (!
start &&
i->nItem <
i->range.lower)
goto end;
1278 i->nItem =
i->range.upper;
1279 if (
i->nItem > 0)
goto testitem;
1281 return (
i->nItem =
i->nSpecial) != -1;
1288 if (!
i->ranges)
return i->range;
1314 i->nItem =
i->nSpecial =
i->range.lower =
i->range.upper = -1;
1343 RECT rcItem, rcTemp;
1367 TRACE(
"building icon ranges:\n");
1368 for (nItem = 0; nItem < infoPtr->
nItemCount; nItem++)
1410 nFirstCol =
max(frame->
left, 0);
1414 lower = nFirstCol * nPerCol + nFirstRow;
1416 TRACE(
"nPerCol=%d, nFirstRow=%d, nLastRow=%d, nFirstCol=%d, nLastCol=%d, lower=%d\n",
1417 nPerCol, nFirstRow, nLastRow, nFirstCol, nLastCol, lower);
1419 if (nLastCol < nFirstCol || nLastRow < nFirstRow)
return TRUE;
1423 TRACE(
"building list ranges:\n");
1424 for (nCol = nFirstCol; nCol <= nLastCol; nCol++)
1426 item_range.lower = nCol * nPerCol + nFirstRow;
1427 if(item_range.lower >= infoPtr->
nItemCount)
break;
1428 item_range.upper =
min(nCol * nPerCol + nLastRow + 1, infoPtr->
nItemCount);
1459 RECT rcItem, rcClip;
1472 if (
i->nSpecial != -1)
1480 TRACE(
"building visible range:\n");
1481 if (!
i->ranges &&
i->range.lower <
i->range.upper)
1519 ERR(
"result is not a one range iterator\n");
1529 if(lower < iter2->
range.lower)
1554 int delete = iter1->
nItem;
1629 return lpID->
id + 1;
1703 infoPtr->
dwLvExStyle & LVS_EX_HEADERINALLVIEWS) &&
1720 DWORD dwOldBkColor, dwOldTextColor;
1879 if (!charCode || !keyData || infoPtr->
nItemCount == 0)
return 0;
1883 charCode !=
'.' && charCode !=
'`' && charCode !=
'!' &&
1884 charCode !=
'@' && charCode !=
'#' && charCode !=
'$' &&
1885 charCode !=
'%' && charCode !=
'^' && charCode !=
'&' &&
1886 charCode !=
'*' && charCode !=
'(' && charCode !=
')' &&
1887 charCode !=
'-' && charCode !=
'_' && charCode !=
'+' &&
1888 charCode !=
'=' && charCode !=
'\\'&& charCode !=
']' &&
1889 charCode !=
'}' && charCode !=
'[' && charCode !=
'{' &&
1890 charCode !=
'/' && charCode !=
'?' && charCode !=
'>' &&
1891 charCode !=
'<' && charCode !=
',' && charCode !=
'~')
1922 if (startidx == infoPtr->
nItemCount) startidx = 0;
1943 int i = startidx, endidx;
1959 for (
i = startidx;
i < endidx;
i++)
1986 (startidx == 0 && endidx == infoPtr->
nItemCount) )
2014 TRACE(
"nNewScrollPos=%d\n", nNewScrollPos);
2025 point[0].
x = -nNewScrollPos;
2026 point[1].
x += nNewScrollPos;
2079 TRACE(
"horzInfo.nMax=%d\n", horzInfo.
nMax);
2120 if (vertInfo.
nPage != 0)
2183 if (
dx != 0 ||
dy != 0)
2186 listRect = infoPtr->
rcList;
2303 assert(nItem >= 0 && nItem < infoPtr->nItemCount);
2313 lpptPosition->
x = nItem / nCountPerColumn * infoPtr->
nItemWidth;
2314 lpptPosition->
y = nItem % nCountPerColumn * infoPtr->
nItemHeight;
2375 SIZE labelSize = { 0, 0 };
2386 if (lprcSelectBox) doSelectBox =
TRUE;
2387 if (lprcLabel) doLabel =
TRUE;
2388 if (doLabel || lprcIcon || lprcStateIcon) doIcon =
TRUE;
2418 LONG state_width = 0;
2425 Icon.left = Box.
left + state_width;
2439 Icon.left = Box.
left + state_width;
2451 (!lpColumnInfo || lpLVItem->
iSubItem == 0 ||
2456 if(lprcIcon) *lprcIcon =
Icon;
2462 lprcStateIcon->
left =
Icon.left - state_width;
2464 lprcStateIcon->
top =
Icon.top;
2469 else Icon.right = 0;
2537 if (!oversizedBox && labelSize.
cy > infoPtr->
ntmHeight)
2541 labelSize.
cy =
max(labelSize.
cy, 1);
2562 if (lprcLabel) *lprcLabel =
Label;
2586 if (lprcSelectBox) *lprcSelectBox = SelectBox;
2594 else *lprcBox = Box;
2623 lvItem.
iItem = nItem;
2651 if (id1->
id == id2->
id)
return 0;
2653 return (id1->
id < id2->
id) ? -1 : 1;
2672 TRACE(
"iID=%d\n", iID);
2705 TRACE(
"iItem=%d\n", iItem);
2708 if (iItem < 0 || iItem >= infoPtr->
nItemCount)
return -1;
2713 return lpItem->
id->
id;
2810 if ((*lpPos).x > nListWidth) (*lpPos).x = nMaxColumns * infoPtr->
nItemWidth;
2811 if ((*lpPos).y > nListHeight) (*lpPos).y = nMaxRows * infoPtr->
nItemHeight;
2840 if (lppt->
x == old.
x && lppt->
y == old.
y)
return TRUE;
2878 TRACE(
"nAlignCode=%d\n", nAlignCode);
2895 default:
return FALSE;
2902 next_pos(infoPtr, &
pos,
i);
2904 next_pos(infoPtr, &
pos);
2931 switch (infoPtr->
uView)
2975 TRACE(
"(lprcView=%p)\n", lprcView);
2977 if (!lprcView)
return FALSE;
3013 if (lpSubItem->
iSubItem == nSubItem)
3050 nItemWidth = rcHeader.
right;
3111 return max(nItemHeight, 1);
3181 if (((
RANGE*)range1)->upper <= ((
RANGE*)range2)->lower)
3183 else if (((
RANGE*)range2)->upper <= ((
RANGE*)range1)->lower)
3193#define ranges_check(ranges, desc) if (TRACE_ON(listview)) ranges_assert(ranges, desc, __FILE__, __LINE__)
3207 assert (prev->lower >= 0 && prev->lower < prev->upper);
3211 assert (prev->upper <= curr->lower);
3212 assert (curr->lower < curr->upper);
3216 TRACE(
"--- Done checking---\n");
3222 if (!ranges)
return NULL;
3224 if (ranges->
hdpa)
return ranges;
3241 if (!ranges)
return;
3253 if (!ranges || !ranges->
hdpa)
3268 if (!newrng)
goto fail;
3279 TRACE (
"clone failed\n");
3304 RANGE srchrng = { nItem, nItem + 1 };
3306 TRACE(
"(nItem=%d)\n", nItem);
3318 count += sel->upper - sel->lower;
3326 RANGE srchrng = { nItem, nItem + 1 }, *chkrng;
3335 if (chkrng->lower >= nItem)
3336 chkrng->lower =
max(
min(chkrng->lower + delta, nUpper - 1), 0);
3337 if (chkrng->upper > nItem)
3338 chkrng->upper =
max(
min(chkrng->upper + delta, nUpper), 0);
3352 srchrgn.lower =
range.lower - 1;
3353 srchrgn.upper =
range.upper + 1;
3360 TRACE(
"Adding new range\n");
3364 if(!newrgn)
goto fail;
3381 RANGE *chkrgn, *mrgrgn;
3382 INT fromindex, mergeindex;
3387 chkrgn->lower =
min(
range.lower, chkrgn->lower);
3388 chkrgn->upper =
max(
range.upper, chkrgn->upper);
3394 srchrgn.lower = chkrgn->lower - 1;
3395 srchrgn.upper = chkrgn->upper + 1;
3400 if (mergeindex == -1)
break;
3401 if (mergeindex ==
index)
3403 fromindex =
index + 1;
3407 TRACE(
"Merge with index %i\n", mergeindex);
3410 chkrgn->lower =
min(chkrgn->lower, mrgrgn->lower);
3411 chkrgn->upper =
max(chkrgn->upper, mrgrgn->upper);
3444 if ( (chkrgn->upper ==
range.upper) &&
3445 (chkrgn->lower ==
range.lower) )
3452 else if ( (chkrgn->upper <=
range.upper) &&
3453 (chkrgn->lower >=
range.lower) )
3459 else if ( (chkrgn->upper <=
range.upper) &&
3460 (chkrgn->lower <
range.lower) )
3462 chkrgn->upper =
range.lower;
3465 else if ( (chkrgn->upper >
range.upper) &&
3466 (chkrgn->lower >=
range.lower) )
3468 chkrgn->lower =
range.upper;
3476 if (!(newrgn =
Alloc(
sizeof(
RANGE))))
goto fail;
3477 newrgn->lower = chkrgn->lower;
3478 newrgn->upper =
range.lower;
3479 chkrgn->lower =
range.upper;
3561 INT nSelectedCount = 0;
3575 TRACE(
"nSelectedCount=%d\n", nSelectedCount);
3576 return nSelectedCount;
3607 if (nShiftItem < nItem)
return nShiftItem;
3609 if (nShiftItem > nItem)
return nShiftItem + direction;
3611 if (direction > 0)
return nShiftItem + direction;
3648 TRACE(
"Shifting %i, %i steps\n", nItem, direction);
3687 if (nFirst == -1) nFirst = nItem;
3692 for (
i = nFirst;
i <= nLast;
i++)
3696 nmlv.
iFrom = nFirst;
3750 RECT rcItem, rcSel, rcSelMark;
3807 TRACE(
"nItem=%d\n", nItem);
3838 TRACE(
"nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl);
3839 if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
3874 ZeroMemory(&lvHitTestInfo,
sizeof(lvHitTestInfo));
3875 lvHitTestInfo.
pt.
x =
pt.x;
3876 lvHitTestInfo.
pt.
y =
pt.y;
3935#define SCROLL_LEFT 0x1
3936#define SCROLL_RIGHT 0x2
3937#define SCROLL_UP 0x4
3938#define SCROLL_DOWN 0x8
3977 rect.right = coords_offs.
x;
3981 rect.left = coords_offs.
x;
3988 rect.bottom = coords_offs.
y;
3992 rect.top = coords_offs.
y;
4008 if ((scroll &
SCROLL_UP) && (coords_orig->
y <= 0))