Commit 6a3ac63c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/listview: Implement LVM_SETVIEW.

parent d5f9f27c
...@@ -122,7 +122,6 @@ ...@@ -122,7 +122,6 @@
* -- LVM_GETTILEINFO, LVM_SETTILEINFO * -- LVM_GETTILEINFO, LVM_SETTILEINFO
* -- LVM_GETTILEVIEWINFO, LVM_SETTILEVIEWINFO * -- LVM_GETTILEVIEWINFO, LVM_SETTILEVIEWINFO
* -- LVM_GETUNICODEFORMAT, LVM_SETUNICODEFORMAT * -- LVM_GETUNICODEFORMAT, LVM_SETUNICODEFORMAT
* -- LVM_SETVIEW
* -- LVM_GETWORKAREAS, LVM_SETWORKAREAS * -- LVM_GETWORKAREAS, LVM_SETWORKAREAS
* -- LVM_HASGROUP, LVM_INSERTGROUP, LVM_REMOVEGROUP, LVM_REMOVEALLGROUPS * -- LVM_HASGROUP, LVM_INSERTGROUP, LVM_REMOVEGROUP, LVM_REMOVEALLGROUPS
* -- LVM_INSERTGROUPSORTED * -- LVM_INSERTGROUPSORTED
...@@ -1190,7 +1189,6 @@ static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges) ...@@ -1190,7 +1189,6 @@ static inline BOOL iterator_rangesitems(ITERATOR* i, RANGES ranges)
*/ */
static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc) static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
RECT frame = *lprc, rcItem, rcTemp; RECT frame = *lprc, rcItem, rcTemp;
POINT Origin; POINT Origin;
...@@ -1202,11 +1200,11 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons ...@@ -1202,11 +1200,11 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc)); TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
OffsetRect(&frame, -Origin.x, -Origin.y); OffsetRect(&frame, -Origin.x, -Origin.y);
if (uView == LVS_ICON || uView == LVS_SMALLICON) if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
{ {
INT nItem; INT nItem;
if (uView == LVS_ICON && infoPtr->nFocusedItem != -1) if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1)
{ {
LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem); LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem);
if (IntersectRect(&rcTemp, &rcItem, lprc)) if (IntersectRect(&rcTemp, &rcItem, lprc))
...@@ -1226,7 +1224,7 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons ...@@ -1226,7 +1224,7 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
} }
return TRUE; return TRUE;
} }
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
RANGE range; RANGE range;
...@@ -1333,10 +1331,8 @@ static inline LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg, ...@@ -1333,10 +1331,8 @@ static inline LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg,
static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr) static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
return ((infoPtr->dwStyle & LVS_AUTOARRANGE) || infoPtr->bAutoarrange) && return ((infoPtr->dwStyle & LVS_AUTOARRANGE) || infoPtr->bAutoarrange) &&
(uView == LVS_ICON || uView == LVS_SMALLICON); (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON);
} }
static void toggle_checkbox_state(LISTVIEW_INFO *infoPtr, INT nItem) static void toggle_checkbox_state(LISTVIEW_INFO *infoPtr, INT nItem)
...@@ -1460,7 +1456,7 @@ static inline void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT ...@@ -1460,7 +1456,7 @@ static inline void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT
RECT rcBox; RECT rcBox;
if(!is_redrawing(infoPtr)) return; if(!is_redrawing(infoPtr)) return;
assert ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT); assert (infoPtr->uView == LV_VIEW_DETAILS);
LISTVIEW_GetOrigin(infoPtr, &Origin); LISTVIEW_GetOrigin(infoPtr, &Origin);
LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position); LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox); LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox);
...@@ -1724,7 +1720,6 @@ static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScro ...@@ -1724,7 +1720,6 @@ static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScro
*/ */
static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
SCROLLINFO horzInfo, vertInfo; SCROLLINFO horzInfo, vertInfo;
INT dx, dy; INT dx, dy;
...@@ -1735,7 +1730,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1735,7 +1730,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left; horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left;
/* for now, we'll set info.nMax to the _count_, and adjust it later */ /* for now, we'll set info.nMax to the _count_, and adjust it later */
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
{ {
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr); INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol; horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol;
...@@ -1746,11 +1741,11 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1746,11 +1741,11 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
horzInfo.nPage /= infoPtr->nItemWidth; horzInfo.nPage /= infoPtr->nItemWidth;
} }
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
horzInfo.nMax = infoPtr->nItemWidth; horzInfo.nMax = infoPtr->nItemWidth;
} }
else /* LVS_ICON, or LVS_SMALLICON */ else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
{ {
RECT rcView; RECT rcView;
...@@ -1772,7 +1767,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1772,7 +1767,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
vertInfo.cbSize = sizeof(SCROLLINFO); vertInfo.cbSize = sizeof(SCROLLINFO);
vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top; vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top;
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
vertInfo.nMax = infoPtr->nItemCount; vertInfo.nMax = infoPtr->nItemCount;
...@@ -1783,7 +1778,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1783,7 +1778,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
if (infoPtr->nItemHeight > 0) if (infoPtr->nItemHeight > 0)
vertInfo.nPage /= infoPtr->nItemHeight; vertInfo.nPage /= infoPtr->nItemHeight;
} }
else if (uView != LVS_LIST) /* LVS_ICON, or LVS_SMALLICON */ else if (infoPtr->uView != LV_VIEW_LIST) /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
{ {
RECT rcView; RECT rcView;
...@@ -1806,7 +1801,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1806,7 +1801,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
} }
/* Update the Header Control */ /* Update the Header Control */
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
horzInfo.fMask = SIF_POS; horzInfo.fMask = SIF_POS;
GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo); GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo);
...@@ -1828,7 +1823,6 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) ...@@ -1828,7 +1823,6 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
*/ */
static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow) static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
HDC hdc; HDC hdc;
TRACE("fShow=%d, nItem=%d\n", fShow, infoPtr->nFocusedItem); TRACE("fShow=%d, nItem=%d\n", fShow, infoPtr->nFocusedItem);
...@@ -1836,7 +1830,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow) ...@@ -1836,7 +1830,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
if (infoPtr->nFocusedItem < 0) return; if (infoPtr->nFocusedItem < 0) return;
/* we need some gymnastics in ICON mode to handle large items */ /* we need some gymnastics in ICON mode to handle large items */
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
RECT rcBox; RECT rcBox;
...@@ -1851,7 +1845,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow) ...@@ -1851,7 +1845,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
if (!(hdc = GetDC(infoPtr->hwndSelf))) return; if (!(hdc = GetDC(infoPtr->hwndSelf))) return;
/* for some reason, owner draw should work only in report mode */ /* for some reason, owner draw should work only in report mode */
if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (uView == LVS_REPORT)) if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
LVITEMW item; LVITEMW item;
...@@ -1923,22 +1917,20 @@ static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr) ...@@ -1923,22 +1917,20 @@ static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
*/ */
static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition) static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
assert(nItem >= 0 && nItem < infoPtr->nItemCount); assert(nItem >= 0 && nItem < infoPtr->nItemCount);
if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
{ {
lpptPosition->x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem); lpptPosition->x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
lpptPosition->y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem); lpptPosition->y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
} }
else if (uView == LVS_LIST) else if (infoPtr->uView == LV_VIEW_LIST)
{ {
INT nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr); INT nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
lpptPosition->x = nItem / nCountPerColumn * infoPtr->nItemWidth; lpptPosition->x = nItem / nCountPerColumn * infoPtr->nItemWidth;
lpptPosition->y = nItem % nCountPerColumn * infoPtr->nItemHeight; lpptPosition->y = nItem % nCountPerColumn * infoPtr->nItemHeight;
} }
else /* LVS_REPORT */ else /* LV_VIEW_DETAILS */
{ {
lpptPosition->x = REPORT_MARGINX; lpptPosition->x = REPORT_MARGINX;
/* item is always at zero indexed column */ /* item is always at zero indexed column */
...@@ -1994,7 +1986,6 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -1994,7 +1986,6 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
LPRECT lprcBox, LPRECT lprcSelectBox, LPRECT lprcBox, LPRECT lprcSelectBox,
LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel) LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
BOOL doSelectBox = FALSE, doIcon = FALSE, doLabel = FALSE, oversizedBox = FALSE; BOOL doSelectBox = FALSE, doIcon = FALSE, doLabel = FALSE, oversizedBox = FALSE;
RECT Box, SelectBox, Icon, Label; RECT Box, SelectBox, Icon, Label;
COLUMN_INFO *lpColumnInfo = NULL; COLUMN_INFO *lpColumnInfo = NULL;
...@@ -2003,8 +1994,8 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2003,8 +1994,8 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
TRACE("(lpLVItem=%s)\n", debuglvitem_t(lpLVItem, TRUE)); TRACE("(lpLVItem=%s)\n", debuglvitem_t(lpLVItem, TRUE));
/* Be smart and try to figure out the minimum we have to do */ /* Be smart and try to figure out the minimum we have to do */
if (lpLVItem->iSubItem) assert(uView == LVS_REPORT); if (lpLVItem->iSubItem) assert(infoPtr->uView == LV_VIEW_DETAILS);
if (uView == LVS_ICON && (lprcBox || lprcLabel)) if (infoPtr->uView == LV_VIEW_ICON && (lprcBox || lprcLabel))
{ {
assert((lpLVItem->mask & LVIF_STATE) && (lpLVItem->stateMask & LVIS_FOCUSED)); assert((lpLVItem->mask & LVIF_STATE) && (lpLVItem->stateMask & LVIS_FOCUSED));
if (lpLVItem->state & LVIS_FOCUSED) oversizedBox = doLabel = TRUE; if (lpLVItem->state & LVIS_FOCUSED) oversizedBox = doLabel = TRUE;
...@@ -2021,7 +2012,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2021,7 +2012,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
/************************************************************/ /************************************************************/
/* compute the box rectangle (it should be cheap to do) */ /* compute the box rectangle (it should be cheap to do) */
/************************************************************/ /************************************************************/
if (lpLVItem->iSubItem || uView == LVS_REPORT) if (lpLVItem->iSubItem || infoPtr->uView == LV_VIEW_DETAILS)
lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, lpLVItem->iSubItem); lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, lpLVItem->iSubItem);
if (lpLVItem->iSubItem) if (lpLVItem->iSubItem)
...@@ -2046,7 +2037,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2046,7 +2037,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
if (infoPtr->himlState && lpLVItem->iSubItem == 0) if (infoPtr->himlState && lpLVItem->iSubItem == 0)
state_width = infoPtr->iconStateSize.cx; state_width = infoPtr->iconStateSize.cx;
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
Icon.left = Box.left + state_width; Icon.left = Box.left + state_width;
if (infoPtr->himlNormal) if (infoPtr->himlNormal)
...@@ -2060,11 +2051,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2060,11 +2051,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
Icon.bottom += infoPtr->iconSize.cy; Icon.bottom += infoPtr->iconSize.cy;
} }
} }
else /* LVS_SMALLICON, LVS_LIST or LVS_REPORT */ else /* LV_VIEW_SMALLICON, LV_VIEW_LIST or LV_VIEW_DETAILS */
{ {
Icon.left = Box.left + state_width; Icon.left = Box.left + state_width;
if (uView == LVS_REPORT && lpLVItem->iSubItem == 0) if (infoPtr->uView == LV_VIEW_DETAILS && lpLVItem->iSubItem == 0)
{ {
/* we need the indent in report mode */ /* we need the indent in report mode */
assert(lpLVItem->mask & LVIF_INDENT); assert(lpLVItem->mask & LVIF_INDENT);
...@@ -2101,12 +2092,12 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2101,12 +2092,12 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
{ {
/* calculate how far to the right can the label stretch */ /* calculate how far to the right can the label stretch */
Label.right = Box.right; Label.right = Box.right;
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
if (lpLVItem->iSubItem == 0) Label = lpColumnInfo->rcHeader; if (lpLVItem->iSubItem == 0) Label = lpColumnInfo->rcHeader;
} }
if (lpLVItem->iSubItem || ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && uView == LVS_REPORT)) if (lpLVItem->iSubItem || ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && infoPtr->uView == LV_VIEW_DETAILS))
{ {
labelSize.cx = infoPtr->nItemWidth; labelSize.cx = infoPtr->nItemWidth;
labelSize.cy = infoPtr->nItemHeight; labelSize.cy = infoPtr->nItemHeight;
...@@ -2127,11 +2118,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2127,11 +2118,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
SetRectEmpty(&rcText); SetRectEmpty(&rcText);
rcText.right = infoPtr->nItemWidth - TRAILING_LABEL_PADDING; rcText.right = infoPtr->nItemWidth - TRAILING_LABEL_PADDING;
rcText.bottom = infoPtr->nItemHeight; rcText.bottom = infoPtr->nItemHeight;
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
rcText.bottom -= ICON_TOP_PADDING + infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; rcText.bottom -= ICON_TOP_PADDING + infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
/* now figure out the flags */ /* now figure out the flags */
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
uFormat = oversizedBox ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS; uFormat = oversizedBox ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS;
else else
uFormat = LV_SL_DT_FLAGS; uFormat = LV_SL_DT_FLAGS;
...@@ -2146,7 +2137,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW ...@@ -2146,7 +2137,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
} }
calc_label: calc_label:
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
Label.left = Box.left + (infoPtr->nItemWidth - labelSize.cx) / 2; Label.left = Box.left + (infoPtr->nItemWidth - labelSize.cx) / 2;
Label.top = Box.top + ICON_TOP_PADDING_HITABLE + Label.top = Box.top + ICON_TOP_PADDING_HITABLE +
...@@ -2162,14 +2153,14 @@ calc_label: ...@@ -2162,14 +2153,14 @@ calc_label:
} }
Label.bottom = Label.top + labelSize.cy + HEIGHT_PADDING; Label.bottom = Label.top + labelSize.cy + HEIGHT_PADDING;
} }
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
Label.left = Icon.right; Label.left = Icon.right;
Label.top = Box.top; Label.top = Box.top;
Label.right = lpColumnInfo->rcHeader.right; Label.right = lpColumnInfo->rcHeader.right;
Label.bottom = Label.top + infoPtr->nItemHeight; Label.bottom = Label.top + infoPtr->nItemHeight;
} }
else /* LVS_SMALLICON or LVS_LIST */ else /* LV_VIEW_SMALLICON or LV_VIEW_LIST */
{ {
Label.left = Icon.right; Label.left = Icon.right;
Label.top = Box.top; Label.top = Box.top;
...@@ -2186,7 +2177,7 @@ calc_label: ...@@ -2186,7 +2177,7 @@ calc_label:
/************************************************************/ /************************************************************/
if (doSelectBox) if (doSelectBox)
{ {
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
SelectBox.left = Icon.left; SelectBox.left = Icon.left;
SelectBox.top = Box.top; SelectBox.top = Box.top;
...@@ -2223,7 +2214,6 @@ calc_label: ...@@ -2223,7 +2214,6 @@ calc_label:
*/ */
static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprcBox) static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprcBox)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
POINT Position, Origin; POINT Position, Origin;
LVITEMW lvItem; LVITEMW lvItem;
...@@ -2233,14 +2223,14 @@ static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT ...@@ -2233,14 +2223,14 @@ static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
/* Be smart and try to figure out the minimum we have to do */ /* Be smart and try to figure out the minimum we have to do */
lvItem.mask = 0; lvItem.mask = 0;
if (uView == LVS_ICON && infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED)) if (infoPtr->uView == LV_VIEW_ICON && infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED))
lvItem.mask |= LVIF_TEXT; lvItem.mask |= LVIF_TEXT;
lvItem.iItem = nItem; lvItem.iItem = nItem;
lvItem.iSubItem = 0; lvItem.iSubItem = 0;
lvItem.pszText = szDispText; lvItem.pszText = szDispText;
lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.cchTextMax = DISP_TEXT_SIZE;
if (lvItem.mask) LISTVIEW_GetItemW(infoPtr, &lvItem); if (lvItem.mask) LISTVIEW_GetItemW(infoPtr, &lvItem);
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
lvItem.mask |= LVIF_STATE; lvItem.mask |= LVIF_STATE;
lvItem.stateMask = LVIS_FOCUSED; lvItem.stateMask = LVIS_FOCUSED;
...@@ -2356,12 +2346,11 @@ static BOOL LISTVIEW_MoveIconTo(const LISTVIEW_INFO *infoPtr, INT nItem, const P ...@@ -2356,12 +2346,11 @@ static BOOL LISTVIEW_MoveIconTo(const LISTVIEW_INFO *infoPtr, INT nItem, const P
*/ */
static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode) static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
void (*next_pos)(LISTVIEW_INFO *, LPPOINT); void (*next_pos)(LISTVIEW_INFO *, LPPOINT);
POINT pos; POINT pos;
INT i; INT i;
if (uView != LVS_ICON && uView != LVS_SMALLICON) return FALSE; if (infoPtr->uView != LV_VIEW_ICON && infoPtr->uView != LV_VIEW_SMALLICON) return FALSE;
TRACE("nAlignCode=%d\n", nAlignCode); TRACE("nAlignCode=%d\n", nAlignCode);
...@@ -2409,10 +2398,10 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView) ...@@ -2409,10 +2398,10 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
SetRectEmpty(lprcView); SetRectEmpty(lprcView);
switch (infoPtr->dwStyle & LVS_TYPEMASK) switch (infoPtr->uView)
{ {
case LVS_ICON: case LV_VIEW_ICON:
case LVS_SMALLICON: case LV_VIEW_SMALLICON:
for (i = 0; i < infoPtr->nItemCount; i++) for (i = 0; i < infoPtr->nItemCount; i++)
{ {
x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, i); x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, i);
...@@ -2427,7 +2416,7 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView) ...@@ -2427,7 +2416,7 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
} }
break; break;
case LVS_LIST: case LV_VIEW_LIST:
y = LISTVIEW_GetCountPerColumn(infoPtr); y = LISTVIEW_GetCountPerColumn(infoPtr);
x = infoPtr->nItemCount / y; x = infoPtr->nItemCount / y;
if (infoPtr->nItemCount % y) x++; if (infoPtr->nItemCount % y) x++;
...@@ -2459,7 +2448,7 @@ static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView) ...@@ -2459,7 +2448,7 @@ static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
LISTVIEW_GetAreaRect(infoPtr, lprcView); LISTVIEW_GetAreaRect(infoPtr, lprcView);
if ((infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) if (infoPtr->uView != LV_VIEW_DETAILS)
{ {
LISTVIEW_GetOrigin(infoPtr, &ptOrigin); LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
OffsetRect(lprcView, ptOrigin.x, ptOrigin.y); OffsetRect(lprcView, ptOrigin.x, ptOrigin.y);
...@@ -2511,14 +2500,13 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem) ...@@ -2511,14 +2500,13 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
*/ */
static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr) static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nItemWidth = 0; INT nItemWidth = 0;
TRACE("uView=%d\n", uView); TRACE("uView=%d\n", infoPtr->uView);
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
nItemWidth = infoPtr->iconSpacing.cx; nItemWidth = infoPtr->iconSpacing.cx;
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
RECT rcHeader; RECT rcHeader;
...@@ -2528,7 +2516,7 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr) ...@@ -2528,7 +2516,7 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
nItemWidth = rcHeader.right; nItemWidth = rcHeader.right;
} }
} }
else /* LVS_SMALLICON, or LVS_LIST */ else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
{ {
INT i; INT i;
...@@ -2556,17 +2544,16 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr) ...@@ -2556,17 +2544,16 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
*/ */
static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr) static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nItemHeight; INT nItemHeight;
TRACE("uView=%d\n", uView); TRACE("uView=%d\n", infoPtr->uView);
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
nItemHeight = infoPtr->iconSpacing.cy; nItemHeight = infoPtr->iconSpacing.cy;
else else
{ {
nItemHeight = infoPtr->ntmHeight; nItemHeight = infoPtr->ntmHeight;
if (uView == LVS_REPORT && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
nItemHeight++; nItemHeight++;
if (infoPtr->himlState) if (infoPtr->himlState)
nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy); nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy);
...@@ -3175,7 +3162,6 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) ...@@ -3175,7 +3162,6 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
*/ */
static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
RANGES selection; RANGES selection;
LVITEMW item; LVITEMW item;
ITERATOR i; ITERATOR i;
...@@ -3186,7 +3172,7 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem) ...@@ -3186,7 +3172,7 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
item.state = LVIS_SELECTED; item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
if ((uView == LVS_LIST) || (uView == LVS_REPORT)) if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
{ {
if (infoPtr->nSelectionMark == -1) if (infoPtr->nSelectionMark == -1)
{ {
...@@ -3746,7 +3732,6 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, ...@@ -3746,7 +3732,6 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
*/ */
static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL isW) static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL isW)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
HWND hwndSelf = infoPtr->hwndSelf; HWND hwndSelf = infoPtr->hwndSelf;
LPWSTR pszText = NULL; LPWSTR pszText = NULL;
BOOL bResult, bChanged = FALSE; BOOL bResult, bChanged = FALSE;
...@@ -3777,7 +3762,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is ...@@ -3777,7 +3762,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is
if (bChanged && !infoPtr->bIsDrawing) if (bChanged && !infoPtr->bIsDrawing)
{ {
/* this little optimization eliminates some nasty flicker */ /* this little optimization eliminates some nasty flicker */
if ( uView == LVS_REPORT && !(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && if ( infoPtr->uView == LV_VIEW_DETAILS && !(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) &&
!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && !(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) &&
lpLVItem->iSubItem > 0 && lpLVItem->iSubItem <= DPA_GetPtrCount(infoPtr->hdpaColumns) ) lpLVItem->iSubItem > 0 && lpLVItem->iSubItem <= DPA_GetPtrCount(infoPtr->hdpaColumns) )
LISTVIEW_InvalidateSubItem(infoPtr, lpLVItem->iItem, lpLVItem->iSubItem); LISTVIEW_InvalidateSubItem(infoPtr, lpLVItem->iItem, lpLVItem->iSubItem);
...@@ -3806,19 +3791,18 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is ...@@ -3806,19 +3791,18 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is
*/ */
static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *infoPtr) static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *infoPtr)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nItem = 0; INT nItem = 0;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
scrollInfo.cbSize = sizeof(SCROLLINFO); scrollInfo.cbSize = sizeof(SCROLLINFO);
scrollInfo.fMask = SIF_POS; scrollInfo.fMask = SIF_POS;
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
{ {
if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo)) if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
nItem = scrollInfo.nPos * LISTVIEW_GetCountPerColumn(infoPtr); nItem = scrollInfo.nPos * LISTVIEW_GetCountPerColumn(infoPtr);
} }
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo)) if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
nItem = scrollInfo.nPos; nItem = scrollInfo.nPos;
...@@ -3875,7 +3859,7 @@ static inline BOOL LISTVIEW_FillBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc, con ...@@ -3875,7 +3859,7 @@ static inline BOOL LISTVIEW_FillBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc, con
*/ */
static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nSubItem, POINT pos, DWORD cdmode) static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nSubItem, POINT pos, DWORD cdmode)
{ {
UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK; UINT uFormat;
WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
static WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 }; static WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
DWORD cdsubitemmode = CDRF_DODEFAULT; DWORD cdsubitemmode = CDRF_DODEFAULT;
...@@ -3891,7 +3875,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -3891,7 +3875,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
/* get information needed for drawing the item */ /* get information needed for drawing the item */
lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
if (nSubItem == 0) lvItem.mask |= LVIF_STATE; if (nSubItem == 0) lvItem.mask |= LVIF_STATE;
if (uView == LVS_REPORT) lvItem.mask |= LVIF_INDENT; if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK; lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK;
lvItem.iItem = nItem; lvItem.iItem = nItem;
lvItem.iSubItem = nSubItem; lvItem.iSubItem = nSubItem;
...@@ -3941,7 +3925,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -3941,7 +3925,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE); prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
/* in full row select, subitems, will just use main item's colors */ /* in full row select, subitems, will just use main item's colors */
if (nSubItem && uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) if (nSubItem && infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
nmlvcd.clrTextBk = CLR_NONE; nmlvcd.clrTextBk = CLR_NONE;
/* state icons */ /* state icons */
...@@ -3957,7 +3941,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -3957,7 +3941,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
} }
/* small icons */ /* small icons */
himl = (uView == LVS_ICON ? infoPtr->himlNormal : infoPtr->himlSmall); himl = (infoPtr->uView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon)) if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon))
{ {
TRACE("iImage=%d\n", lvItem.iImage); TRACE("iImage=%d\n", lvItem.iImage);
...@@ -3977,10 +3961,10 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -3977,10 +3961,10 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
{ {
/* in icon mode, the label rect is really what we want to draw the /* in icon mode, the label rect is really what we want to draw the
* background for */ * background for */
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
rcSelect = rcLabel; rcSelect = rcLabel;
if (uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
rcSelect.right = rcBox.right; rcSelect.right = rcBox.right;
if (nmlvcd.clrTextBk != CLR_NONE) if (nmlvcd.clrTextBk != CLR_NONE)
...@@ -3990,8 +3974,8 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -3990,8 +3974,8 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
} }
/* figure out the text drawing flags */ /* figure out the text drawing flags */
uFormat = (uView == LVS_ICON ? (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS); uFormat = (infoPtr->uView == LV_VIEW_ICON ? (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
uFormat = (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS); uFormat = (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS);
else if (nSubItem) else if (nSubItem)
{ {
...@@ -4010,7 +3994,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS ...@@ -4010,7 +3994,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
else if (uFormat & DT_RIGHT) rcLabel.right -= LABEL_HOR_PADDING; else if (uFormat & DT_RIGHT) rcLabel.right -= LABEL_HOR_PADDING;
/* for GRIDLINES reduce the bottom so the text formats correctly */ /* for GRIDLINES reduce the bottom so the text formats correctly */
if (uView == LVS_REPORT && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
rcLabel.bottom--; rcLabel.bottom--;
DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat); DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat);
...@@ -4306,7 +4290,6 @@ static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, D ...@@ -4306,7 +4290,6 @@ static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, D
*/ */
static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase) static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
COLORREF oldTextColor = 0, oldBkColor = 0, oldClrTextBk, oldClrText; COLORREF oldTextColor = 0, oldBkColor = 0, oldClrTextBk, oldClrText;
NMLVCUSTOMDRAW nmlvcd; NMLVCUSTOMDRAW nmlvcd;
HFONT hOldFont = 0; HFONT hOldFont = 0;
...@@ -4395,13 +4378,13 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra ...@@ -4395,13 +4378,13 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
notify_hdr(infoPtr, LVN_ODCACHEHINT, &nmlv.hdr); notify_hdr(infoPtr, LVN_ODCACHEHINT, &nmlv.hdr);
} }
if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (uView == LVS_REPORT)) if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
LISTVIEW_RefreshOwnerDraw(infoPtr, &i, hdc, cdmode); LISTVIEW_RefreshOwnerDraw(infoPtr, &i, hdc, cdmode);
else else
{ {
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
LISTVIEW_RefreshReport(infoPtr, &i, hdc, cdmode); LISTVIEW_RefreshReport(infoPtr, &i, hdc, cdmode);
else /* LVS_LIST, LVS_ICON or LVS_SMALLICON */ else /* LV_VIEW_LIST, LV_VIEW_ICON or LV_VIEW_SMALLICON */
LISTVIEW_RefreshList(infoPtr, &i, hdc, cdmode); LISTVIEW_RefreshList(infoPtr, &i, hdc, cdmode);
/* if we have a focus rect and it's visible, draw it */ /* if we have a focus rect and it's visible, draw it */
...@@ -4414,7 +4397,7 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra ...@@ -4414,7 +4397,7 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
enddraw: enddraw:
/* For LVS_EX_GRIDLINES go and draw lines */ /* For LVS_EX_GRIDLINES go and draw lines */
/* This includes the case where there were *no* items */ /* This includes the case where there were *no* items */
if ((uView == LVS_REPORT) && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) if ((infoPtr->uView == LV_VIEW_DETAILS) && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
LISTVIEW_RefreshReportGrid(infoPtr, hdc); LISTVIEW_RefreshReportGrid(infoPtr, hdc);
if (cdmode & CDRF_NOTIFYPOSTPAINT) if (cdmode & CDRF_NOTIFYPOSTPAINT)
...@@ -4458,7 +4441,6 @@ enddraw: ...@@ -4458,7 +4441,6 @@ enddraw:
static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount, static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount,
WORD wWidth, WORD wHeight) WORD wWidth, WORD wHeight)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nItemCountPerColumn = 1; INT nItemCountPerColumn = 1;
INT nColumnCount = 0; INT nColumnCount = 0;
DWORD dwViewRect = 0; DWORD dwViewRect = 0;
...@@ -4466,7 +4448,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte ...@@ -4466,7 +4448,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
if (nItemCount == -1) if (nItemCount == -1)
nItemCount = infoPtr->nItemCount; nItemCount = infoPtr->nItemCount;
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
{ {
if (wHeight == 0xFFFF) if (wHeight == 0xFFFF)
{ {
...@@ -4498,7 +4480,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte ...@@ -4498,7 +4480,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
dwViewRect = MAKELONG(wWidth, wHeight); dwViewRect = MAKELONG(wWidth, wHeight);
} }
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
RECT rcBox; RECT rcBox;
...@@ -4519,10 +4501,10 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte ...@@ -4519,10 +4501,10 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
dwViewRect = MAKELONG(wWidth, wHeight); dwViewRect = MAKELONG(wWidth, wHeight);
} }
else if (uView == LVS_SMALLICON) else if (infoPtr->uView == LV_VIEW_SMALLICON)
FIXME("uView == LVS_SMALLICON: not implemented\n"); FIXME("uView == LV_VIEW_SMALLICON: not implemented\n");
else if (uView == LVS_ICON) else if (infoPtr->uView == LV_VIEW_ICON)
FIXME("uView == LVS_ICON: not implemented\n"); FIXME("uView == LV_VIEW_ICON: not implemented\n");
return dwViewRect; return dwViewRect;
} }
...@@ -4693,7 +4675,7 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx) ...@@ -4693,7 +4675,7 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
} }
/* do not update screen if not in report mode */ /* do not update screen if not in report mode */
if (!is_redrawing(infoPtr) || (infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return; if (!is_redrawing(infoPtr) || infoPtr->uView != LV_VIEW_DETAILS) return;
/* Need to reset the item width when inserting a new column */ /* Need to reset the item width when inserting a new column */
infoPtr->nItemWidth += dx; infoPtr->nItemWidth += dx;
...@@ -4833,7 +4815,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir) ...@@ -4833,7 +4815,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
nPerCol = infoPtr->nItemCount + 1; nPerCol = infoPtr->nItemCount + 1;
else if (uView == LVS_LIST) else if (uView == LVS_LIST)
nPerCol = LISTVIEW_GetCountPerColumn(infoPtr); nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
else /* LVS_ICON, or LVS_SMALLICON */ else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
return; return;
nItemCol = nItem / nPerCol; nItemCol = nItem / nPerCol;
...@@ -4883,8 +4865,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir) ...@@ -4883,8 +4865,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem) static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
{ {
LVITEMW item; LVITEMW item;
const UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; const BOOL is_icon = (infoPtr->uView == LV_VIEW_SMALLICON || infoPtr->uView == LV_VIEW_ICON);
const BOOL is_icon = (uView == LVS_SMALLICON || uView == LVS_ICON);
TRACE("(nItem=%d)\n", nItem); TRACE("(nItem=%d)\n", nItem);
...@@ -5220,7 +5201,6 @@ static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *infoPtr, INT nItem, BOOL bPart ...@@ -5220,7 +5201,6 @@ static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *infoPtr, INT nItem, BOOL bPart
static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
const LVFINDINFOW *lpFindInfo) const LVFINDINFOW *lpFindInfo)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
BOOL bWrap = FALSE, bNearest = FALSE; BOOL bWrap = FALSE, bNearest = FALSE;
INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1; INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1;
...@@ -5253,7 +5233,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, ...@@ -5253,7 +5233,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
bWrap = TRUE; bWrap = TRUE;
if ((lpFindInfo->flags & LVFI_NEARESTXY) && if ((lpFindInfo->flags & LVFI_NEARESTXY) &&
(uView == LVS_ICON || uView ==LVS_SMALLICON)) (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON))
{ {
POINT Origin; POINT Origin;
RECT rcArea; RECT rcArea;
...@@ -5485,12 +5465,12 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn) ...@@ -5485,12 +5465,12 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
TRACE("nColumn=%d\n", nColumn); TRACE("nColumn=%d\n", nColumn);
/* we have a 'column' in LIST and REPORT mode only */ /* we have a 'column' in LIST and REPORT mode only */
switch(infoPtr->dwStyle & LVS_TYPEMASK) switch(infoPtr->uView)
{ {
case LVS_LIST: case LV_VIEW_LIST:
nColumnWidth = infoPtr->nItemWidth; nColumnWidth = infoPtr->nItemWidth;
break; break;
case LVS_REPORT: case LV_VIEW_DETAILS:
/* We are not using LISTVIEW_GetHeaderRect as this data is updated only after a HDM_ITEMCHANGED. /* We are not using LISTVIEW_GetHeaderRect as this data is updated only after a HDM_ITEMCHANGED.
* There is an application that subclasses the listview, calls LVM_GETCOLUMNWIDTH in the * There is an application that subclasses the listview, calls LVM_GETCOLUMNWIDTH in the
* HDM_ITEMCHANGED handler and goes into infinite recursion if it receives old data. * HDM_ITEMCHANGED handler and goes into infinite recursion if it receives old data.
...@@ -5525,14 +5505,14 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn) ...@@ -5525,14 +5505,14 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
*/ */
static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr) static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr)
{ {
switch (infoPtr->dwStyle & LVS_TYPEMASK) switch (infoPtr->uView)
{ {
case LVS_ICON: case LV_VIEW_ICON:
case LVS_SMALLICON: case LV_VIEW_SMALLICON:
return infoPtr->nItemCount; return infoPtr->nItemCount;
case LVS_REPORT: case LV_VIEW_DETAILS:
return LISTVIEW_GetCountPerColumn(infoPtr); return LISTVIEW_GetCountPerColumn(infoPtr);
case LVS_LIST: case LV_VIEW_LIST:
return LISTVIEW_GetCountPerRow(infoPtr) * LISTVIEW_GetCountPerColumn(infoPtr); return LISTVIEW_GetCountPerRow(infoPtr) * LISTVIEW_GetCountPerColumn(infoPtr);
} }
assert(FALSE); assert(FALSE);
...@@ -5895,7 +5875,6 @@ static BOOL LISTVIEW_GetItemExtT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte ...@@ -5895,7 +5875,6 @@ static BOOL LISTVIEW_GetItemExtT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte
*/ */
static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition) static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
POINT Origin; POINT Origin;
TRACE("(nItem=%d, lpptPosition=%p)\n", nItem, lpptPosition); TRACE("(nItem=%d, lpptPosition=%p)\n", nItem, lpptPosition);
...@@ -5905,7 +5884,7 @@ static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LP ...@@ -5905,7 +5884,7 @@ static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LP
LISTVIEW_GetOrigin(infoPtr, &Origin); LISTVIEW_GetOrigin(infoPtr, &Origin);
LISTVIEW_GetItemOrigin(infoPtr, nItem, lpptPosition); LISTVIEW_GetItemOrigin(infoPtr, nItem, lpptPosition);
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
lpptPosition->x += (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2; lpptPosition->x += (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
lpptPosition->y += ICON_TOP_PADDING; lpptPosition->y += ICON_TOP_PADDING;
...@@ -5981,7 +5960,6 @@ static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LP ...@@ -5981,7 +5960,6 @@ static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LP
*/ */
static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc) static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
BOOL doLabel = TRUE, oversizedBox = FALSE; BOOL doLabel = TRUE, oversizedBox = FALSE;
POINT Position, Origin; POINT Position, Origin;
...@@ -5996,8 +5974,8 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT ...@@ -5996,8 +5974,8 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
/* Be smart and try to figure out the minimum we have to do */ /* Be smart and try to figure out the minimum we have to do */
if (lprc->left == LVIR_ICON) doLabel = FALSE; if (lprc->left == LVIR_ICON) doLabel = FALSE;
if (uView == LVS_REPORT && lprc->left == LVIR_BOUNDS) doLabel = FALSE; if (infoPtr->uView == LV_VIEW_DETAILS && lprc->left == LVIR_BOUNDS) doLabel = FALSE;
if (uView == LVS_ICON && lprc->left != LVIR_ICON && if (infoPtr->uView == LV_VIEW_ICON && lprc->left != LVIR_ICON &&
infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED)) infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED))
oversizedBox = TRUE; oversizedBox = TRUE;
...@@ -6005,7 +5983,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT ...@@ -6005,7 +5983,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
* only one request. This can speed up things, if data * only one request. This can speed up things, if data
* is stored on the app side */ * is stored on the app side */
lvItem.mask = 0; lvItem.mask = 0;
if (uView == LVS_REPORT) lvItem.mask |= LVIF_INDENT; if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
if (doLabel) lvItem.mask |= LVIF_TEXT; if (doLabel) lvItem.mask |= LVIF_TEXT;
lvItem.iItem = nItem; lvItem.iItem = nItem;
lvItem.iSubItem = 0; lvItem.iSubItem = 0;
...@@ -6013,14 +5991,14 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT ...@@ -6013,14 +5991,14 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
lvItem.cchTextMax = DISP_TEXT_SIZE; lvItem.cchTextMax = DISP_TEXT_SIZE;
if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
/* we got the state already up, simulate it here, to avoid a reget */ /* we got the state already up, simulate it here, to avoid a reget */
if (uView == LVS_ICON && (lprc->left != LVIR_ICON)) if (infoPtr->uView == LV_VIEW_ICON && (lprc->left != LVIR_ICON))
{ {
lvItem.mask |= LVIF_STATE; lvItem.mask |= LVIF_STATE;
lvItem.stateMask = LVIS_FOCUSED; lvItem.stateMask = LVIS_FOCUSED;
lvItem.state = (oversizedBox ? LVIS_FOCUSED : 0); lvItem.state = (oversizedBox ? LVIS_FOCUSED : 0);
} }
if (uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && lprc->left == LVIR_SELECTBOUNDS) if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && lprc->left == LVIR_SELECTBOUNDS)
lprc->left = LVIR_BOUNDS; lprc->left = LVIR_BOUNDS;
switch(lprc->left) switch(lprc->left)
{ {
...@@ -6045,7 +6023,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT ...@@ -6045,7 +6023,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
return FALSE; return FALSE;
} }
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
OffsetRect(lprc, Origin.x, Position.y + Origin.y); OffsetRect(lprc, Origin.x, Position.y + Origin.y);
else else
OffsetRect(lprc, Position.x + Origin.x, Position.y + Origin.y); OffsetRect(lprc, Position.x + Origin.x, Position.y + Origin.y);
...@@ -6088,7 +6066,7 @@ static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPR ...@@ -6088,7 +6066,7 @@ static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPR
if (lprc->top == 0) if (lprc->top == 0)
return LISTVIEW_GetItemRect(infoPtr, nItem, lprc); return LISTVIEW_GetItemRect(infoPtr, nItem, lprc);
if ((infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return FALSE; if (infoPtr->uView != LV_VIEW_DETAILS) return FALSE;
/* special case for header items */ /* special case for header items */
if (nItem == -1) if (nItem == -1)
...@@ -6187,7 +6165,7 @@ static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall) ...@@ -6187,7 +6165,7 @@ static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall)
} }
else else
{ {
if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
lResult = MAKELONG(DEFAULT_COLUMN_WIDTH, GetSystemMetrics(SM_CXSMICON)+HEIGHT_PADDING); lResult = MAKELONG(DEFAULT_COLUMN_WIDTH, GetSystemMetrics(SM_CXSMICON)+HEIGHT_PADDING);
else else
lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight); lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight);
...@@ -6262,7 +6240,6 @@ static INT LISTVIEW_GetItemTextT(const LISTVIEW_INFO *infoPtr, INT nItem, LPLVIT ...@@ -6262,7 +6240,6 @@ static INT LISTVIEW_GetItemTextT(const LISTVIEW_INFO *infoPtr, INT nItem, LPLVIT
*/ */
static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags) static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
UINT uMask = 0; UINT uMask = 0;
LVFINDINFOW lvFindInfo; LVFINDINFOW lvFindInfo;
INT nCountPerColumn; INT nCountPerColumn;
...@@ -6296,7 +6273,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6296,7 +6273,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
if (uFlags & LVNI_ABOVE) if (uFlags & LVNI_ABOVE)
{ {
if ((uView == LVS_LIST) || (uView == LVS_REPORT)) if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
{ {
while (nItem >= 0) while (nItem >= 0)
{ {
...@@ -6331,7 +6308,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6331,7 +6308,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
} }
else if (uFlags & LVNI_BELOW) else if (uFlags & LVNI_BELOW)
{ {
if ((uView == LVS_LIST) || (uView == LVS_REPORT)) if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
{ {
while (nItem < infoPtr->nItemCount) while (nItem < infoPtr->nItemCount)
{ {
...@@ -6366,7 +6343,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6366,7 +6343,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
} }
else if (uFlags & LVNI_TOLEFT) else if (uFlags & LVNI_TOLEFT)
{ {
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
{ {
nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr); nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
while (nItem - nCountPerColumn >= 0) while (nItem - nCountPerColumn >= 0)
...@@ -6376,7 +6353,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6376,7 +6353,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
return nItem; return nItem;
} }
} }
else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) else if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
{ {
/* Special case for autoarrange - move 'til the beginning of a row */ /* Special case for autoarrange - move 'til the beginning of a row */
if (is_autoarrange(infoPtr)) if (is_autoarrange(infoPtr))
...@@ -6402,7 +6379,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6402,7 +6379,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
} }
else if (uFlags & LVNI_TORIGHT) else if (uFlags & LVNI_TORIGHT)
{ {
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
{ {
nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr); nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
while (nItem + nCountPerColumn < infoPtr->nItemCount) while (nItem + nCountPerColumn < infoPtr->nItemCount)
...@@ -6412,7 +6389,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6412,7 +6389,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
return nItem; return nItem;
} }
} }
else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) else if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
{ {
/* Special case for autoarrange - move 'til the end of a row */ /* Special case for autoarrange - move 'til the end of a row */
if (is_autoarrange(infoPtr)) if (is_autoarrange(infoPtr))
...@@ -6466,7 +6443,6 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF ...@@ -6466,7 +6443,6 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
*/ */
static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin) static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nHorzPos = 0, nVertPos = 0; INT nHorzPos = 0, nVertPos = 0;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
...@@ -6482,9 +6458,9 @@ static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin) ...@@ -6482,9 +6458,9 @@ static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
lpptOrigin->x = infoPtr->rcList.left; lpptOrigin->x = infoPtr->rcList.left;
lpptOrigin->y = infoPtr->rcList.top; lpptOrigin->y = infoPtr->rcList.top;
if (uView == LVS_LIST) if (infoPtr->uView == LV_VIEW_LIST)
nHorzPos *= infoPtr->nItemWidth; nHorzPos *= infoPtr->nItemWidth;
else if (uView == LVS_REPORT) else if (infoPtr->uView == LV_VIEW_DETAILS)
nVertPos *= infoPtr->nItemHeight; nVertPos *= infoPtr->nItemHeight;
lpptOrigin->x -= nHorzPos; lpptOrigin->x -= nHorzPos;
...@@ -6549,7 +6525,6 @@ static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *infoPtr, LPCWSTR lpszTe ...@@ -6549,7 +6525,6 @@ static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *infoPtr, LPCWSTR lpszTe
static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select) static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select)
{ {
WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
RECT rcBox, rcBounds, rcState, rcIcon, rcLabel, rcSearch; RECT rcBox, rcBounds, rcState, rcIcon, rcLabel, rcSearch;
POINT Origin, Position, opt; POINT Origin, Position, opt;
LVITEMW lvItem; LVITEMW lvItem;
...@@ -6593,7 +6568,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, ...@@ -6593,7 +6568,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
TRACE("lpht->iItem=%d\n", iItem); TRACE("lpht->iItem=%d\n", iItem);
if (iItem == -1) return -1; if (iItem == -1) return -1;
if (uView == LVS_REPORT && subitem) if (infoPtr->uView == LV_VIEW_DETAILS && subitem)
{ {
RECT bounds, *pRect; RECT bounds, *pRect;
INT j; INT j;
...@@ -6618,9 +6593,9 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, ...@@ -6618,9 +6593,9 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
} }
lvItem.mask = LVIF_STATE | LVIF_TEXT; lvItem.mask = LVIF_STATE | LVIF_TEXT;
if (uView == LVS_REPORT) lvItem.mask |= LVIF_INDENT; if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
lvItem.stateMask = LVIS_STATEIMAGEMASK; lvItem.stateMask = LVIS_STATEIMAGEMASK;
if (uView == LVS_ICON) lvItem.stateMask |= LVIS_FOCUSED; if (infoPtr->uView == LV_VIEW_ICON) lvItem.stateMask |= LVIS_FOCUSED;
lvItem.iItem = iItem; lvItem.iItem = iItem;
lvItem.iSubItem = subitem ? lpht->iSubItem : 0; lvItem.iSubItem = subitem ? lpht->iSubItem : 0;
lvItem.pszText = szDispText; lvItem.pszText = szDispText;
...@@ -6633,7 +6608,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, ...@@ -6633,7 +6608,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
opt.x = lpht->pt.x - Position.x - Origin.x; opt.x = lpht->pt.x - Position.x - Origin.x;
opt.y = lpht->pt.y - Position.y - Origin.y; opt.y = lpht->pt.y - Position.y - Origin.y;
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
rcBounds = rcBox; rcBounds = rcBox;
else else
{ {
...@@ -6650,7 +6625,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, ...@@ -6650,7 +6625,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
else if (infoPtr->himlState && PtInRect(&rcState, opt)) else if (infoPtr->himlState && PtInRect(&rcState, opt))
lpht->flags |= LVHT_ONITEMSTATEICON; lpht->flags |= LVHT_ONITEMSTATEICON;
/* special case for LVS_EX_FULLROWSELECT */ /* special case for LVS_EX_FULLROWSELECT */
if (uView == LVS_REPORT && infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT && if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT &&
!(lpht->flags & LVHT_ONITEM)) !(lpht->flags & LVHT_ONITEM))
{ {
lpht->flags = LVHT_ONITEM | LVHT_ABOVE; lpht->flags = LVHT_ONITEM | LVHT_ABOVE;
...@@ -6659,11 +6634,11 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, ...@@ -6659,11 +6634,11 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
lpht->flags &= ~LVHT_NOWHERE; lpht->flags &= ~LVHT_NOWHERE;
TRACE("lpht->flags=0x%x\n", lpht->flags); TRACE("lpht->flags=0x%x\n", lpht->flags);
if (select && !(uView == LVS_REPORT && if (select && !(infoPtr->uView == LV_VIEW_DETAILS &&
((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) || ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) ||
(infoPtr->dwStyle & LVS_OWNERDRAWFIXED)))) (infoPtr->dwStyle & LVS_OWNERDRAWFIXED))))
{ {
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
/* get main item bounds */ /* get main item bounds */
lvItem.iSubItem = 0; lvItem.iSubItem = 0;
...@@ -6866,33 +6841,33 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT n ...@@ -6866,33 +6841,33 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT n
* FAILURE : FALSE * FAILURE : FALSE
* *
* COMMENTS: * COMMENTS:
* If the control is in report mode (LVS_REPORT) the control can * If the control is in report view (LV_VIEW_DETAILS) the control can
* be scrolled only in line increments. "dy" will be rounded to the * be scrolled only in line increments. "dy" will be rounded to the
* nearest number of pixels that are a whole line. Ex: if line height * nearest number of pixels that are a whole line. Ex: if line height
* is 16 and an 8 is passed, the list will be scrolled by 16. If a 7 * is 16 and an 8 is passed, the list will be scrolled by 16. If a 7
* is passed, then the scroll will be 0. (per MSDN 7/2002) * is passed, then the scroll will be 0. (per MSDN 7/2002)
* *
* For: (per experimentation with native control and CSpy ListView) * For: (per experimentation with native control and CSpy ListView)
* LVS_ICON dy=1 = 1 pixel (vertical only) * LV_VIEW_ICON dy=1 = 1 pixel (vertical only)
* dx ignored * dx ignored
* LVS_SMALLICON dy=1 = 1 pixel (vertical only) * LV_VIEW_SMALLICON dy=1 = 1 pixel (vertical only)
* dx ignored * dx ignored
* LVS_LIST dx=1 = 1 column (horizontal only) * LV_VIEW_LIST dx=1 = 1 column (horizontal only)
* but will only scroll 1 column per message * but will only scroll 1 column per message
* no matter what the value. * no matter what the value.
* dy must be 0 or FALSE returned. * dy must be 0 or FALSE returned.
* LVS_REPORT dx=1 = 1 pixel * LV_VIEW_DETAILS dx=1 = 1 pixel
* dy= see above * dy= see above
* *
*/ */
static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *infoPtr, INT dx, INT dy) static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
{ {
switch(infoPtr->dwStyle & LVS_TYPEMASK) { switch(infoPtr->uView) {
case LVS_REPORT: case LV_VIEW_DETAILS:
dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2; dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2;
dy /= infoPtr->nItemHeight; dy /= infoPtr->nItemHeight;
break; break;
case LVS_LIST: case LV_VIEW_LIST:
if (dy != 0) return FALSE; if (dy != 0) return FALSE;
break; break;
default: /* icon */ default: /* icon */
...@@ -7031,7 +7006,6 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, ...@@ -7031,7 +7006,6 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
COLUMN_INFO *lpColumnInfo; COLUMN_INFO *lpColumnInfo;
INT nNewColumn; INT nNewColumn;
HDITEMW hdi; HDITEMW hdi;
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW); TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW);
...@@ -7063,7 +7037,7 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, ...@@ -7063,7 +7037,7 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
/* create header if not present */ /* create header if not present */
LISTVIEW_CreateHeader(infoPtr); LISTVIEW_CreateHeader(infoPtr);
if (!(LVS_NOCOLUMNHEADER & infoPtr->dwStyle) && if (!(LVS_NOCOLUMNHEADER & infoPtr->dwStyle) &&
(LVS_REPORT == uView) && (WS_VISIBLE & infoPtr->dwStyle)) (infoPtr->uView == LV_VIEW_DETAILS) && (WS_VISIBLE & infoPtr->dwStyle))
{ {
ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL); ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL);
} }
...@@ -7164,8 +7138,7 @@ static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, ...@@ -7164,8 +7138,7 @@ static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn,
lpColumnInfo->fmt = lpColumn->fmt; lpColumnInfo->fmt = lpColumn->fmt;
if ((oldFmt ^ lpColumn->fmt) & (LVCFMT_JUSTIFYMASK | LVCFMT_IMAGE)) if ((oldFmt ^ lpColumn->fmt) & (LVCFMT_JUSTIFYMASK | LVCFMT_IMAGE))
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; if (infoPtr->uView == LV_VIEW_DETAILS) LISTVIEW_InvalidateColumn(infoPtr, nColumn);
if (uView == LVS_REPORT) LISTVIEW_InvalidateColumn(infoPtr, nColumn);
} }
} }
...@@ -7211,7 +7184,6 @@ static BOOL LISTVIEW_SetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCoun ...@@ -7211,7 +7184,6 @@ static BOOL LISTVIEW_SetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCoun
*/ */
static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
WCHAR szDispText[DISP_TEXT_SIZE] = { 0 }; WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
INT max_cx = 0; INT max_cx = 0;
HDITEMW hdi; HDITEMW hdi;
...@@ -7219,14 +7191,14 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) ...@@ -7219,14 +7191,14 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
TRACE("(nColumn=%d, cx=%d\n", nColumn, cx); TRACE("(nColumn=%d, cx=%d\n", nColumn, cx);
/* set column width only if in report or list mode */ /* set column width only if in report or list mode */
if (uView != LVS_REPORT && uView != LVS_LIST) return FALSE; if (infoPtr->uView != LV_VIEW_DETAILS && infoPtr->uView != LV_VIEW_LIST) return FALSE;
/* take care of invalid cx values */ /* take care of invalid cx values */
if(uView == LVS_REPORT && cx < -2) cx = LVSCW_AUTOSIZE; if(infoPtr->uView == LV_VIEW_DETAILS && cx < -2) cx = LVSCW_AUTOSIZE;
else if (uView == LVS_LIST && cx < 1) return FALSE; else if (infoPtr->uView == LV_VIEW_LIST && cx < 1) return FALSE;
/* resize all columns if in LVS_LIST mode */ /* resize all columns if in LV_VIEW_LIST mode */
if(uView == LVS_LIST) if(infoPtr->uView == LV_VIEW_LIST)
{ {
infoPtr->nItemWidth = cx; infoPtr->nItemWidth = cx;
LISTVIEW_InvalidateList(infoPtr); LISTVIEW_InvalidateList(infoPtr);
...@@ -7500,12 +7472,11 @@ static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime) ...@@ -7500,12 +7472,11 @@ static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy) static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
{ {
DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy); DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
TRACE("requested=(%d,%d)\n", cx, cy); TRACE("requested=(%d,%d)\n", cx, cy);
/* this is supported only for LVS_ICON style */ /* this is supported only for LVS_ICON style */
if (uView != LVS_ICON) return oldspacing; if (infoPtr->uView != LV_VIEW_ICON) return oldspacing;
/* set to defaults, if instructed to */ /* set to defaults, if instructed to */
if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING); if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING);
...@@ -7568,7 +7539,6 @@ static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL small) ...@@ -7568,7 +7539,6 @@ static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL small)
*/ */
static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAGELIST himl) static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAGELIST himl)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT oldHeight = infoPtr->nItemHeight; INT oldHeight = infoPtr->nItemHeight;
HIMAGELIST himlOld = 0; HIMAGELIST himlOld = 0;
...@@ -7579,14 +7549,14 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG ...@@ -7579,14 +7549,14 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
case LVSIL_NORMAL: case LVSIL_NORMAL:
himlOld = infoPtr->himlNormal; himlOld = infoPtr->himlNormal;
infoPtr->himlNormal = himl; infoPtr->himlNormal = himl;
if (uView == LVS_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE); if (infoPtr->uView == LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE);
LISTVIEW_SetIconSpacing(infoPtr, 0, 0); LISTVIEW_SetIconSpacing(infoPtr, 0, 0);
break; break;
case LVSIL_SMALL: case LVSIL_SMALL:
himlOld = infoPtr->himlSmall; himlOld = infoPtr->himlSmall;
infoPtr->himlSmall = himl; infoPtr->himlSmall = himl;
if (uView != LVS_ICON) set_icon_size(&infoPtr->iconSize, himl, TRUE); if (infoPtr->uView != LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, TRUE);
break; break;
case LVSIL_STATE: case LVSIL_STATE:
...@@ -7627,7 +7597,6 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl ...@@ -7627,7 +7597,6 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
if (infoPtr->dwStyle & LVS_OWNERDATA) if (infoPtr->dwStyle & LVS_OWNERDATA)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nOldCount = infoPtr->nItemCount; INT nOldCount = infoPtr->nItemCount;
if (nItems < nOldCount) if (nItems < nOldCount)
...@@ -7645,7 +7614,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl ...@@ -7645,7 +7614,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
LISTVIEW_UpdateScroll(infoPtr); LISTVIEW_UpdateScroll(infoPtr);
/* the flags are valid only in ownerdata report and list modes */ /* the flags are valid only in ownerdata report and list modes */
if (uView == LVS_ICON || uView == LVS_SMALLICON) dwFlags = 0; if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON) dwFlags = 0;
if (!(dwFlags & LVSICF_NOSCROLL) && infoPtr->nFocusedItem != -1) if (!(dwFlags & LVSICF_NOSCROLL) && infoPtr->nFocusedItem != -1)
LISTVIEW_EnsureVisible(infoPtr, infoPtr->nFocusedItem, FALSE); LISTVIEW_EnsureVisible(infoPtr, infoPtr->nFocusedItem, FALSE);
...@@ -7662,7 +7631,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl ...@@ -7662,7 +7631,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
nFrom = min(nOldCount, nItems); nFrom = min(nOldCount, nItems);
nTo = max(nOldCount, nItems); nTo = max(nOldCount, nItems);
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
rcErase.left = 0; rcErase.left = 0;
rcErase.top = nFrom * infoPtr->nItemHeight; rcErase.top = nFrom * infoPtr->nItemHeight;
...@@ -7672,7 +7641,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl ...@@ -7672,7 +7641,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList)) if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
LISTVIEW_InvalidateRect(infoPtr, &rcErase); LISTVIEW_InvalidateRect(infoPtr, &rcErase);
} }
else /* LVS_LIST */ else /* LV_VIEW_LIST */
{ {
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr); INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
...@@ -7723,13 +7692,12 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl ...@@ -7723,13 +7692,12 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
*/ */
static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt) static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
POINT Origin; POINT Origin;
TRACE("(nItem=%d, &pt=%s\n", nItem, wine_dbgstr_point(&pt)); TRACE("(nItem=%d, &pt=%s\n", nItem, wine_dbgstr_point(&pt));
if (nItem < 0 || nItem >= infoPtr->nItemCount || if (nItem < 0 || nItem >= infoPtr->nItemCount ||
!(uView == LVS_ICON || uView == LVS_SMALLICON)) return FALSE; !(infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)) return FALSE;
LISTVIEW_GetOrigin(infoPtr, &Origin); LISTVIEW_GetOrigin(infoPtr, &Origin);
...@@ -7739,7 +7707,7 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt ...@@ -7739,7 +7707,7 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt
if ((pt.x == -1) && (pt.y == -1)) if ((pt.x == -1) && (pt.y == -1))
pt = Origin; pt = Origin;
if (uView == LVS_ICON) if (infoPtr->uView == LV_VIEW_ICON)
{ {
pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2; pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
pt.y -= ICON_TOP_PADDING; pt.y -= ICON_TOP_PADDING;
...@@ -7964,6 +7932,84 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL fUnicode) ...@@ -7964,6 +7932,84 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL fUnicode)
return rc; return rc;
} }
/*
* DESCRIPTION:
* sets the control view mode
* PARAMETER(S):
* [I] infoPtr :valid pointer to the listview structure
* [I] nView :new view mode value
*
* RETURN:
* SUCCESS: 1
* FAILURE: -1
*/
static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
{
SIZE oldIconSize = infoPtr->iconSize;
HIMAGELIST himl;
if (infoPtr->uView == nView) return 1;
if ((INT)nView < 0 || nView > LV_VIEW_MAX) return -1;
if (nView == LV_VIEW_TILE)
{
FIXME("View LV_VIEW_TILE unimplemented\n");
return -1;
}
infoPtr->uView = nView;
SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
ShowWindow(infoPtr->hwndHeader, SW_HIDE);
ShowScrollBar(infoPtr->hwndSelf, SB_BOTH, FALSE);
SetRectEmpty(&infoPtr->rcFocus);
himl = (nView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
set_icon_size(&infoPtr->iconSize, himl, nView != LV_VIEW_ICON);
switch (nView)
{
case LV_VIEW_ICON:
if ((infoPtr->iconSize.cx != oldIconSize.cx) || (infoPtr->iconSize.cy != oldIconSize.cy))
{
TRACE("icon old size=(%d,%d), new size=(%d,%d)\n",
oldIconSize.cx, oldIconSize.cy, infoPtr->iconSize.cx, infoPtr->iconSize.cy);
LISTVIEW_SetIconSpacing(infoPtr, 0, 0);
}
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
break;
case LV_VIEW_SMALLICON:
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
break;
case LV_VIEW_DETAILS:
{
HDLAYOUT hl;
WINDOWPOS wp;
LISTVIEW_CreateHeader( infoPtr );
hl.prc = &infoPtr->rcList;
hl.pwpos = &wp;
SendMessageW(infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl);
SetWindowPos(infoPtr->hwndHeader, infoPtr->hwndSelf, wp.x, wp.y, wp.cx, wp.cy,
wp.flags | ((infoPtr->dwStyle & LVS_NOCOLUMNHEADER) ? SWP_HIDEWINDOW : SWP_SHOWWINDOW));
break;
}
case LV_VIEW_LIST:
break;
}
LISTVIEW_UpdateItemSize(infoPtr);
LISTVIEW_UpdateSize(infoPtr);
LISTVIEW_UpdateScroll(infoPtr);
LISTVIEW_InvalidateList(infoPtr);
TRACE("nView=%d\n", nView);
return 1;
}
/* LISTVIEW_SetWorkAreas */ /* LISTVIEW_SetWorkAreas */
/*** /***
...@@ -8031,7 +8077,6 @@ static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM ...@@ -8031,7 +8077,6 @@ static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
LPARAM lParamSort, BOOL IsEx) LPARAM lParamSort, BOOL IsEx)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
HDPA hdpaSubItems; HDPA hdpaSubItems;
ITEM_INFO *lpItem; ITEM_INFO *lpItem;
LPVOID selectionMarkItem = NULL; LPVOID selectionMarkItem = NULL;
...@@ -8080,7 +8125,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, ...@@ -8080,7 +8125,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
/* I believe nHotItem should be left alone, see LISTVIEW_ShiftIndices */ /* I believe nHotItem should be left alone, see LISTVIEW_ShiftIndices */
/* refresh the display */ /* refresh the display */
if (uView != LVS_ICON && uView != LVS_SMALLICON) if (infoPtr->uView != LV_VIEW_ICON && infoPtr->uView != LV_VIEW_SMALLICON)
LISTVIEW_InvalidateList(infoPtr); LISTVIEW_InvalidateList(infoPtr);
return TRUE; return TRUE;
...@@ -8219,6 +8264,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -8219,6 +8264,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->hwndSelf = hwnd; infoPtr->hwndSelf = hwnd;
infoPtr->dwStyle = lpcs->style; /* Note: may be changed in WM_CREATE */ infoPtr->dwStyle = lpcs->style; /* Note: may be changed in WM_CREATE */
map_style_view(infoPtr);
/* determine the type of structures to use */ /* determine the type of structures to use */
infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->hwndNotify = lpcs->hwndParent;
/* infoPtr->notifyFormat will be filled in WM_CREATE */ /* infoPtr->notifyFormat will be filled in WM_CREATE */
...@@ -8292,6 +8338,8 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -8292,6 +8338,8 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
TRACE("(lpcs=%p)\n", lpcs); TRACE("(lpcs=%p)\n", lpcs);
infoPtr->dwStyle = lpcs->style; infoPtr->dwStyle = lpcs->style;
map_style_view(infoPtr);
infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
(WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY); (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
...@@ -8314,8 +8362,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -8314,8 +8362,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
LISTVIEW_UpdateScroll(infoPtr); LISTVIEW_UpdateScroll(infoPtr);
} }
map_style_view(infoPtr);
OpenThemeData(hwnd, themeClass); OpenThemeData(hwnd, themeClass);
/* initialize the icon sizes */ /* initialize the icon sizes */
...@@ -8434,7 +8480,6 @@ static void scroll_list(LISTVIEW_INFO *infoPtr, INT dx, INT dy) ...@@ -8434,7 +8480,6 @@ static void scroll_list(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
INT nScrollDiff, HWND hScrollWnd) INT nScrollDiff, HWND hScrollWnd)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nOldScrollPos, nNewScrollPos; INT nOldScrollPos, nNewScrollPos;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
BOOL is_an_icon; BOOL is_an_icon;
...@@ -8447,7 +8492,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -8447,7 +8492,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
scrollInfo.cbSize = sizeof(SCROLLINFO); scrollInfo.cbSize = sizeof(SCROLLINFO);
scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS; scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
is_an_icon = ((uView == LVS_ICON) || (uView == LVS_SMALLICON)); is_an_icon = ((infoPtr->uView == LV_VIEW_ICON) || (infoPtr->uView == LV_VIEW_SMALLICON));
if (!GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo)) return 1; if (!GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo)) return 1;
...@@ -8507,7 +8552,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -8507,7 +8552,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
/* now adjust to client coordinates */ /* now adjust to client coordinates */
nScrollDiff = nOldScrollPos - nNewScrollPos; nScrollDiff = nOldScrollPos - nNewScrollPos;
if (uView == LVS_REPORT) nScrollDiff *= infoPtr->nItemHeight; if (infoPtr->uView == LV_VIEW_DETAILS) nScrollDiff *= infoPtr->nItemHeight;
/* and scroll the window */ /* and scroll the window */
scroll_list(infoPtr, 0, nScrollDiff); scroll_list(infoPtr, 0, nScrollDiff);
...@@ -8539,7 +8584,6 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -8539,7 +8584,6 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
INT nScrollDiff, HWND hScrollWnd) INT nScrollDiff, HWND hScrollWnd)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT nOldScrollPos, nNewScrollPos; INT nOldScrollPos, nNewScrollPos;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
...@@ -8608,12 +8652,12 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -8608,12 +8652,12 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
/* carry on only if it really changed */ /* carry on only if it really changed */
if (nNewScrollPos == nOldScrollPos) return 0; if (nNewScrollPos == nOldScrollPos) return 0;
if(uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos); LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos);
/* now adjust to client coordinates */ /* now adjust to client coordinates */
nScrollDiff = nOldScrollPos - nNewScrollPos; nScrollDiff = nOldScrollPos - nNewScrollPos;
if (uView == LVS_LIST) nScrollDiff *= infoPtr->nItemWidth; if (infoPtr->uView == LV_VIEW_LIST) nScrollDiff *= infoPtr->nItemWidth;
/* and scroll the window */ /* and scroll the window */
scroll_list(infoPtr, nScrollDiff, 0); scroll_list(infoPtr, nScrollDiff, 0);
...@@ -8623,7 +8667,6 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -8623,7 +8667,6 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
INT gcWheelDelta = 0; INT gcWheelDelta = 0;
INT pulScrollLines = 3; INT pulScrollLines = 3;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
...@@ -8636,10 +8679,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) ...@@ -8636,10 +8679,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
scrollInfo.cbSize = sizeof(SCROLLINFO); scrollInfo.cbSize = sizeof(SCROLLINFO);
scrollInfo.fMask = SIF_POS; scrollInfo.fMask = SIF_POS;
switch(uView) switch(infoPtr->uView)
{ {
case LVS_ICON: case LV_VIEW_ICON:
case LVS_SMALLICON: case LV_VIEW_SMALLICON:
/* /*
* listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number * listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number
* should be fixed in the future. * should be fixed in the future.
...@@ -8648,7 +8691,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) ...@@ -8648,7 +8691,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
-LISTVIEW_SCROLL_ICON_LINE_SIZE : LISTVIEW_SCROLL_ICON_LINE_SIZE, 0); -LISTVIEW_SCROLL_ICON_LINE_SIZE : LISTVIEW_SCROLL_ICON_LINE_SIZE, 0);
break; break;
case LVS_REPORT: case LV_VIEW_DETAILS:
if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines)
{ {
int cLineScroll = min(LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines); int cLineScroll = min(LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
...@@ -8657,7 +8700,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) ...@@ -8657,7 +8700,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
} }
break; break;
case LVS_LIST: case LV_VIEW_LIST:
LISTVIEW_HScroll(infoPtr, (gcWheelDelta < 0) ? SB_LINELEFT : SB_LINERIGHT, 0, 0); LISTVIEW_HScroll(infoPtr, (gcWheelDelta < 0) ? SB_LINELEFT : SB_LINERIGHT, 0, 0);
break; break;
} }
...@@ -8678,7 +8721,6 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) ...@@ -8678,7 +8721,6 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
*/ */
static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData) static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
HWND hwndSelf = infoPtr->hwndSelf; HWND hwndSelf = infoPtr->hwndSelf;
INT nItem = -1; INT nItem = -1;
NMLVKEYDOWN nmKeyDown; NMLVKEYDOWN nmKeyDown;
...@@ -8735,7 +8777,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK ...@@ -8735,7 +8777,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
break; break;
case VK_PRIOR: case VK_PRIOR:
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
INT topidx = LISTVIEW_GetTopIndex(infoPtr); INT topidx = LISTVIEW_GetTopIndex(infoPtr);
if (infoPtr->nFocusedItem == topidx) if (infoPtr->nFocusedItem == topidx)
...@@ -8750,7 +8792,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK ...@@ -8750,7 +8792,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
break; break;
case VK_NEXT: case VK_NEXT:
if (uView == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
INT topidx = LISTVIEW_GetTopIndex(infoPtr); INT topidx = LISTVIEW_GetTopIndex(infoPtr);
INT cnt = LISTVIEW_GetCountPerColumn(infoPtr); INT cnt = LISTVIEW_GetCountPerColumn(infoPtr);
...@@ -9082,7 +9124,6 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr) ...@@ -9082,7 +9124,6 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
*/ */
static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh) static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
HWND hwndSelf = infoPtr->hwndSelf; HWND hwndSelf = infoPtr->hwndSelf;
TRACE("(lpnmh=%p)\n", lpnmh); TRACE("(lpnmh=%p)\n", lpnmh);
...@@ -9164,7 +9205,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE ...@@ -9164,7 +9205,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
LISTVIEW_UpdateScroll(infoPtr); LISTVIEW_UpdateScroll(infoPtr);
} }
LISTVIEW_UpdateItemSize(infoPtr); LISTVIEW_UpdateItemSize(infoPtr);
if (uView == LVS_REPORT && is_redrawing(infoPtr)) if (infoPtr->uView == LV_VIEW_DETAILS && is_redrawing(infoPtr))
{ {
POINT ptOrigin; POINT ptOrigin;
RECT rcCol = lpColumnInfo->rcHeader; RECT rcCol = lpColumnInfo->rcHeader;
...@@ -9313,11 +9354,9 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc) ...@@ -9313,11 +9354,9 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
if (infoPtr->bNoItemMetrics && infoPtr->nItemCount) if (infoPtr->bNoItemMetrics && infoPtr->nItemCount)
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
infoPtr->bNoItemMetrics = FALSE; infoPtr->bNoItemMetrics = FALSE;
LISTVIEW_UpdateItemSize(infoPtr); LISTVIEW_UpdateItemSize(infoPtr);
if (uView == LVS_ICON || uView == LVS_SMALLICON) if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
LISTVIEW_Arrange(infoPtr, LVA_DEFAULT); LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
LISTVIEW_UpdateScroll(infoPtr); LISTVIEW_UpdateScroll(infoPtr);
} }
...@@ -9575,7 +9614,7 @@ static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedra ...@@ -9575,7 +9614,7 @@ static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedra
LISTVIEW_SaveTextMetrics(infoPtr); LISTVIEW_SaveTextMetrics(infoPtr);
if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT) if (infoPtr->uView == LV_VIEW_DETAILS)
{ {
SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0)); SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0));
LISTVIEW_UpdateSize(infoPtr); LISTVIEW_UpdateSize(infoPtr);
...@@ -9652,7 +9691,7 @@ static LRESULT LISTVIEW_Size(LISTVIEW_INFO *infoPtr, int Width, int Height) ...@@ -9652,7 +9691,7 @@ static LRESULT LISTVIEW_Size(LISTVIEW_INFO *infoPtr, int Width, int Height)
LISTVIEW_UpdateScroll(infoPtr); LISTVIEW_UpdateScroll(infoPtr);
/* refresh all only for lists whose height changed significantly */ /* refresh all only for lists whose height changed significantly */
if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_LIST && if ((infoPtr->uView == LV_VIEW_LIST) &&
(rcOld.bottom - rcOld.top) / infoPtr->nItemHeight != (rcOld.bottom - rcOld.top) / infoPtr->nItemHeight !=
(infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight) (infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight)
LISTVIEW_InvalidateList(infoPtr); LISTVIEW_InvalidateList(infoPtr);
...@@ -9737,6 +9776,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, ...@@ -9737,6 +9776,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
if (wStyleType != GWL_STYLE) return 0; if (wStyleType != GWL_STYLE) return 0;
infoPtr->dwStyle = lpss->styleNew; infoPtr->dwStyle = lpss->styleNew;
map_style_view(infoPtr);
if (((lpss->styleOld & WS_HSCROLL) != 0)&& if (((lpss->styleOld & WS_HSCROLL) != 0)&&
((lpss->styleNew & WS_HSCROLL) == 0)) ((lpss->styleNew & WS_HSCROLL) == 0))
...@@ -9746,8 +9786,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, ...@@ -9746,8 +9786,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
((lpss->styleNew & WS_VSCROLL) == 0)) ((lpss->styleNew & WS_VSCROLL) == 0))
ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE); ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE);
map_style_view(infoPtr);
if (uNewView != uOldView) if (uNewView != uOldView)
{ {
SIZE oldIconSize = infoPtr->iconSize; SIZE oldIconSize = infoPtr->iconSize;
...@@ -10074,8 +10112,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -10074,8 +10112,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case LVM_GETORIGIN: case LVM_GETORIGIN:
if (!lParam) return FALSE; if (!lParam) return FALSE;
if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT || if (infoPtr->uView == LV_VIEW_DETAILS ||
(infoPtr->dwStyle & LVS_TYPEMASK) == LVS_LIST) return FALSE; infoPtr->uView == LV_VIEW_LIST) return FALSE;
LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam); LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam);
return TRUE; return TRUE;
...@@ -10277,7 +10315,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -10277,7 +10315,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case LVM_SETUNICODEFORMAT: case LVM_SETUNICODEFORMAT:
return LISTVIEW_SetUnicodeFormat(infoPtr, wParam); return LISTVIEW_SetUnicodeFormat(infoPtr, wParam);
/* case LVM_SETVIEW: */ case LVM_SETVIEW:
return LISTVIEW_SetView(infoPtr, wParam);
/* case LVM_SETWORKAREAS: */ /* case LVM_SETWORKAREAS: */
...@@ -10429,11 +10468,10 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -10429,11 +10468,10 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
if (!(((WINDOWPOS *)lParam)->flags & SWP_NOSIZE)) if (!(((WINDOWPOS *)lParam)->flags & SWP_NOSIZE))
{ {
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (uView == LVS_REPORT)) if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
{ {
MEASUREITEMSTRUCT mis; MEASUREITEMSTRUCT mis;
mis.CtlType = ODT_LISTVIEW; mis.CtlType = ODT_LISTVIEW;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment