[4/4] comctl32/listview: Implement LVM_SETVIEW

Nikolay Sivov bunglehead at gmail.com
Wed Jun 3 05:37:34 CDT 2009


This patch makes use a view instead of current window style to
display content. It doesn't break pre 6.0 behaviour cause
LVM_SETVIEW is simply not implemented on older versions.

Changelog
   - Implement LVM_SETVIEW

>From e3036907ef7d7d9309b9d8f66b2c0b0b16dcf4c9 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 3 Jun 2009 08:05:27 +0400
Subject: Implement LVM_SETVIEW

---
 dlls/comctl32/listview.c |  434 +++++++++++++++++++++++++---------------------
 1 files changed, 236 insertions(+), 198 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d3f2303..5523901 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -122,7 +122,6 @@
  *   -- LVM_GETTILEINFO, LVM_SETTILEINFO
  *   -- LVM_GETTILEVIEWINFO, LVM_SETTILEVIEWINFO
  *   -- LVM_GETUNICODEFORMAT, LVM_SETUNICODEFORMAT
- *   -- LVM_SETVIEW
  *   -- LVM_GETWORKAREAS, LVM_SETWORKAREAS
  *   -- LVM_HASGROUP, LVM_INSERTGROUP, LVM_REMOVEGROUP, LVM_REMOVEALLGROUPS
  *   -- LVM_INSERTGROUPSORTED
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     RECT frame = *lprc, rcItem, rcTemp;
     POINT Origin;
     
@@ -1202,11 +1200,11 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
     TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
     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;
 	
-	if (uView == LVS_ICON && infoPtr->nFocusedItem != -1)
+	if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1)
 	{
 	    LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem);
 	    if (IntersectRect(&rcTemp, &rcItem, lprc))
@@ -1226,7 +1224,7 @@ static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, cons
 	}
 	return TRUE;
     }
-    else if (uView == LVS_REPORT)
+    else if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	RANGE range;
 	
@@ -1333,10 +1331,8 @@ static inline LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg,
 
 static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
-    
     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)
@@ -1460,7 +1456,7 @@ static inline void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT
     RECT rcBox;
     
     if(!is_redrawing(infoPtr)) return; 
-    assert ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT);
+    assert (infoPtr->uView == LV_VIEW_DETAILS);
     LISTVIEW_GetOrigin(infoPtr, &Origin);
     LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
     LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox);
@@ -1724,7 +1720,6 @@ static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScro
  */
 static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     SCROLLINFO horzInfo, vertInfo;
     INT dx, dy;
 
@@ -1735,7 +1730,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
     horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left;
 
     /* 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);
 	horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol;
@@ -1746,11 +1741,11 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
 
 	horzInfo.nPage /= infoPtr->nItemWidth;
     }
-    else if (uView == LVS_REPORT)
+    else if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	horzInfo.nMax = infoPtr->nItemWidth;
     }
-    else /* LVS_ICON, or LVS_SMALLICON */
+    else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
     {
 	RECT rcView;
 
@@ -1772,7 +1767,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
     vertInfo.cbSize = sizeof(SCROLLINFO);
     vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top;
 
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	vertInfo.nMax = infoPtr->nItemCount;
 	
@@ -1783,7 +1778,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
         if (infoPtr->nItemHeight > 0)
             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;
 
@@ -1806,7 +1801,7 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
     }
 
     /* Update the Header Control */
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	horzInfo.fMask = SIF_POS;
 	GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo);
@@ -1828,7 +1823,6 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr)
  */
 static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HDC hdc;
 
     TRACE("fShow=%d, nItem=%d\n", fShow, infoPtr->nFocusedItem);
@@ -1836,7 +1830,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
     if (infoPtr->nFocusedItem < 0) return;
 
     /* we need some gymnastics in ICON mode to handle large items */
-    if (uView == LVS_ICON)
+    if (infoPtr->uView == LV_VIEW_ICON)
     {
 	RECT rcBox;
 
@@ -1851,7 +1845,7 @@ static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
     if (!(hdc = GetDC(infoPtr->hwndSelf))) return;
 
     /* 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;
 	LVITEMW item;
@@ -1923,22 +1917,20 @@ static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
  */
 static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lpptPosition)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
-
     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->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);
 	lpptPosition->x = nItem / nCountPerColumn * infoPtr->nItemWidth;
 	lpptPosition->y = nItem % nCountPerColumn * infoPtr->nItemHeight;
     }
-    else /* LVS_REPORT */
+    else /* LV_VIEW_DETAILS */
     {
 	lpptPosition->x = REPORT_MARGINX;
 	/* item is always at zero indexed column */
@@ -1994,7 +1986,6 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
 				    LPRECT lprcBox, LPRECT lprcSelectBox,
 				    LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     BOOL doSelectBox = FALSE, doIcon = FALSE, doLabel = FALSE, oversizedBox = FALSE;
     RECT Box, SelectBox, Icon, Label;
     COLUMN_INFO *lpColumnInfo = NULL;
@@ -2003,8 +1994,8 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
     TRACE("(lpLVItem=%s)\n", debuglvitem_t(lpLVItem, TRUE));
 
     /* Be smart and try to figure out the minimum we have to do */
-    if (lpLVItem->iSubItem) assert(uView == LVS_REPORT);
-    if (uView == LVS_ICON && (lprcBox || lprcLabel))
+    if (lpLVItem->iSubItem) assert(infoPtr->uView == LV_VIEW_DETAILS);
+    if (infoPtr->uView == LV_VIEW_ICON && (lprcBox || lprcLabel))
     {
 	assert((lpLVItem->mask & LVIF_STATE) && (lpLVItem->stateMask & LVIS_FOCUSED));
 	if (lpLVItem->state & LVIS_FOCUSED) oversizedBox = doLabel = TRUE;
@@ -2021,7 +2012,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
     /************************************************************/
     /* 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);
 
     if (lpLVItem->iSubItem)    
@@ -2046,7 +2037,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
 	if (infoPtr->himlState && lpLVItem->iSubItem == 0)
 	    state_width = infoPtr->iconStateSize.cx;
 
-	if (uView == LVS_ICON)
+	if (infoPtr->uView == LV_VIEW_ICON)
 	{
 	    Icon.left   = Box.left + state_width;
 	    if (infoPtr->himlNormal)
@@ -2060,11 +2051,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
 		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;
 
-	    if (uView == LVS_REPORT && lpLVItem->iSubItem == 0)
+	    if (infoPtr->uView == LV_VIEW_DETAILS && lpLVItem->iSubItem == 0)
 	    {
 		/* we need the indent in report mode */
 		assert(lpLVItem->mask & LVIF_INDENT);
@@ -2101,12 +2092,12 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
     {
 	/* calculate how far to the right can the label stretch */
 	Label.right = Box.right;
-	if (uView == LVS_REPORT)
+	if (infoPtr->uView == LV_VIEW_DETAILS)
 	{
 	    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.cy = infoPtr->nItemHeight;
@@ -2127,11 +2118,11 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
 	    SetRectEmpty(&rcText);
 	    rcText.right = infoPtr->nItemWidth - TRAILING_LABEL_PADDING;
 	    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;
 
 	    /* 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;
 	    else
 		uFormat = LV_SL_DT_FLAGS;
@@ -2146,7 +2137,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
 	}
 
 calc_label:
-	if (uView == LVS_ICON)
+	if (infoPtr->uView == LV_VIEW_ICON)
 	{
 	    Label.left = Box.left + (infoPtr->nItemWidth - labelSize.cx) / 2;
 	    Label.top  = Box.top + ICON_TOP_PADDING_HITABLE +
@@ -2162,14 +2153,14 @@ calc_label:
 	     }
 	     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.top = Box.top;
 	    Label.right = lpColumnInfo->rcHeader.right;
 	    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.top = Box.top;
@@ -2186,7 +2177,7 @@ calc_label:
     /************************************************************/
     if (doSelectBox)
     {
-	if (uView == LVS_REPORT)
+	if (infoPtr->uView == LV_VIEW_DETAILS)
 	{
 	    SelectBox.left = Icon.left;
 	    SelectBox.top = Box.top;
@@ -2223,7 +2214,6 @@ calc_label:
  */
 static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprcBox)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     POINT Position, Origin;
     LVITEMW lvItem;
@@ -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 */
     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.iItem = nItem;
     lvItem.iSubItem = 0;
     lvItem.pszText = szDispText;
     lvItem.cchTextMax = DISP_TEXT_SIZE;
     if (lvItem.mask) LISTVIEW_GetItemW(infoPtr, &lvItem);
-    if (uView == LVS_ICON)
+    if (infoPtr->uView == LV_VIEW_ICON)
     {
 	lvItem.mask |= LVIF_STATE;
 	lvItem.stateMask = LVIS_FOCUSED;
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     void (*next_pos)(LISTVIEW_INFO *, LPPOINT);
     POINT pos;
     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);
 
@@ -2409,10 +2398,10 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 
     SetRectEmpty(lprcView);
 
-    switch (infoPtr->dwStyle & LVS_TYPEMASK)
+    switch (infoPtr->uView)
     {
-    case LVS_ICON:
-    case LVS_SMALLICON:
+    case LV_VIEW_ICON:
+    case LV_VIEW_SMALLICON:
 	for (i = 0; i < infoPtr->nItemCount; i++)
 	{
 	    x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, i);
@@ -2427,7 +2416,7 @@ static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 	}
 	break;
 
-    case LVS_LIST:
+    case LV_VIEW_LIST:
 	y = LISTVIEW_GetCountPerColumn(infoPtr);
 	x = infoPtr->nItemCount / y;
 	if (infoPtr->nItemCount % y) x++;
@@ -2459,7 +2448,7 @@ static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 
     LISTVIEW_GetAreaRect(infoPtr, lprcView);
 
-    if ((infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT)
+    if (infoPtr->uView != LV_VIEW_DETAILS)
     {
         LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
         OffsetRect(lprcView, ptOrigin.x, ptOrigin.y);
@@ -2511,14 +2500,13 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
  */
 static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     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;
-    else if (uView == LVS_REPORT)
+    else if (infoPtr->uView == LV_VIEW_DETAILS)
     {
 	RECT rcHeader;
 
@@ -2528,7 +2516,7 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
             nItemWidth = rcHeader.right;
 	}
     }
-    else /* LVS_SMALLICON, or LVS_LIST */
+    else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
     {
 	INT i;
 	
@@ -2556,17 +2544,16 @@ static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
  */
 static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     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;
     else
     {
 	nItemHeight = infoPtr->ntmHeight; 
-        if (uView == LVS_REPORT && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
+        if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
             nItemHeight++;
 	if (infoPtr->himlState)
 	    nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy);
@@ -3175,7 +3162,6 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
  */
 static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     RANGES selection;
     LVITEMW item;
     ITERATOR i;
@@ -3186,7 +3172,7 @@ static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
     item.state = 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)
 	{
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HWND hwndSelf = infoPtr->hwndSelf;
     LPWSTR pszText = NULL;
     BOOL bResult, bChanged = FALSE;
@@ -3777,7 +3762,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is
     if (bChanged && !infoPtr->bIsDrawing)
     {
 	/* 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) &&
              lpLVItem->iSubItem > 0 && lpLVItem->iSubItem <= DPA_GetPtrCount(infoPtr->hdpaColumns) )
 	    LISTVIEW_InvalidateSubItem(infoPtr, lpLVItem->iItem, lpLVItem->iSubItem);
@@ -3806,19 +3791,18 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL is
  */
 static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *infoPtr)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nItem = 0;
     SCROLLINFO scrollInfo;
 
     scrollInfo.cbSize = sizeof(SCROLLINFO);
     scrollInfo.fMask = SIF_POS;
 
-    if (uView == LVS_LIST)
+    if (infoPtr->uView == LV_VIEW_LIST)
     {
 	if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
 	    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))
 	    nItem = scrollInfo.nPos;
@@ -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)
 {
-    UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK;
+    UINT uFormat;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     static WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
     DWORD cdsubitemmode = CDRF_DODEFAULT;
@@ -3891,7 +3875,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     /* get information needed for drawing the item */
     lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
     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.iItem = nItem;
     lvItem.iSubItem = nSubItem;
@@ -3941,7 +3925,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
         prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
 
     /* 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;
 
     /* state icons */
@@ -3957,7 +3941,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     }
 
     /* 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))
     {
         TRACE("iImage=%d\n", lvItem.iImage);
@@ -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
          * background for */
-        if (uView == LVS_ICON)
+        if (infoPtr->uView == LV_VIEW_ICON)
 	    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;
 
     	if (nmlvcd.clrTextBk != CLR_NONE) 
@@ -3990,8 +3974,8 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS
     }
    
     /* figure out the text drawing flags */
-    uFormat = (uView == LVS_ICON ? (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);
-    if (uView == LVS_ICON)
+    uFormat = (infoPtr->uView == LV_VIEW_ICON ? (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);
+    if (infoPtr->uView == LV_VIEW_ICON)
 	uFormat = (lprcFocus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS);
     else if (nSubItem)
     {
@@ -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;
 
     /* 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--;
 
     DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat);
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     COLORREF oldTextColor = 0, oldBkColor = 0, oldClrTextBk, oldClrText;
     NMLVCUSTOMDRAW nmlvcd;
     HFONT hOldFont = 0;
@@ -4395,13 +4378,13 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcEra
     	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);
     else
     {
-    	if (uView == LVS_REPORT)
+	if (infoPtr->uView == LV_VIEW_DETAILS)
             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);
 
 	/* 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
 enddraw:
     /* For LVS_EX_GRIDLINES go and draw lines */
     /*  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);
 
     if (cdmode & CDRF_NOTIFYPOSTPAINT)
@@ -4458,7 +4441,6 @@ enddraw:
 static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount,
                                             WORD wWidth, WORD wHeight)
 {
-  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   INT nItemCountPerColumn = 1;
   INT nColumnCount = 0;
   DWORD dwViewRect = 0;
@@ -4466,7 +4448,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
   if (nItemCount == -1)
     nItemCount = infoPtr->nItemCount;
 
-  if (uView == LVS_LIST)
+  if (infoPtr->uView == LV_VIEW_LIST)
   {
     if (wHeight == 0xFFFF)
     {
@@ -4498,7 +4480,7 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
 
     dwViewRect = MAKELONG(wWidth, wHeight);
   }
-  else if (uView == LVS_REPORT)
+  else if (infoPtr->uView == LV_VIEW_DETAILS)
   {
     RECT rcBox;
 
@@ -4519,10 +4501,10 @@ static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nIte
 
     dwViewRect = MAKELONG(wWidth, wHeight);
   }
-  else if (uView == LVS_SMALLICON)
-    FIXME("uView == LVS_SMALLICON: not implemented\n");
-  else if (uView == LVS_ICON)
-    FIXME("uView == LVS_ICON: not implemented\n");
+  else if (infoPtr->uView == LV_VIEW_SMALLICON)
+    FIXME("uView == LV_VIEW_SMALLICON: not implemented\n");
+  else if (infoPtr->uView == LV_VIEW_ICON)
+    FIXME("uView == LV_VIEW_ICON: not implemented\n");
 
   return dwViewRect;
 }
@@ -4693,7 +4675,7 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
     }
 
     /* 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 */
     infoPtr->nItemWidth += dx;
@@ -4833,7 +4815,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
 	nPerCol = infoPtr->nItemCount + 1;
     else if (uView == LVS_LIST)
 	nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
-    else /* LVS_ICON, or LVS_SMALLICON */
+    else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
 	return;
     
     nItemCol = nItem / nPerCol;
@@ -4883,8 +4865,7 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
 static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
 {
     LVITEMW item;
-    const UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
-    const BOOL is_icon = (uView == LVS_SMALLICON || uView == LVS_ICON);
+    const BOOL is_icon = (infoPtr->uView == LV_VIEW_SMALLICON || infoPtr->uView == LV_VIEW_ICON);
 
     TRACE("(nItem=%d)\n", nItem);
 
@@ -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,
                               const LVFINDINFOW *lpFindInfo)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     BOOL bWrap = FALSE, bNearest = FALSE;
     INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1;
@@ -5253,7 +5233,7 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
         bWrap = TRUE;
 
     if ((lpFindInfo->flags & LVFI_NEARESTXY) && 
-	(uView == LVS_ICON || uView ==LVS_SMALLICON))
+	(infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON))
     {
 	POINT Origin;
 	RECT rcArea;
@@ -5485,12 +5465,12 @@ static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
     TRACE("nColumn=%d\n", nColumn);
 
     /* 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;
 	break;
-    case LVS_REPORT:
+    case LV_VIEW_DETAILS:
 	/* 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
 	 * 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)
  */
 static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr)
 {
-    switch (infoPtr->dwStyle & LVS_TYPEMASK)
+    switch (infoPtr->uView)
     {
-    case LVS_ICON:
-    case LVS_SMALLICON:
+    case LV_VIEW_ICON:
+    case LV_VIEW_SMALLICON:
 	return infoPtr->nItemCount;
-    case LVS_REPORT:
+    case LV_VIEW_DETAILS:
 	return LISTVIEW_GetCountPerColumn(infoPtr);
-    case LVS_LIST:
+    case LV_VIEW_LIST:
 	return LISTVIEW_GetCountPerRow(infoPtr) * LISTVIEW_GetCountPerColumn(infoPtr);
     }
     assert(FALSE);
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     POINT Origin;
 
     TRACE("(nItem=%d, lpptPosition=%p)\n", nItem, lpptPosition);
@@ -5905,7 +5884,7 @@ static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *infoPtr, INT nItem, LP
     LISTVIEW_GetOrigin(infoPtr, &Origin);
     LISTVIEW_GetItemOrigin(infoPtr, nItem, lpptPosition);
 
-    if (uView == LVS_ICON)
+    if (infoPtr->uView == LV_VIEW_ICON)
     {
         lpptPosition->x += (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
         lpptPosition->y += ICON_TOP_PADDING;
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
     BOOL doLabel = TRUE, oversizedBox = FALSE;
     POINT Position, Origin;
@@ -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 */
     if (lprc->left == LVIR_ICON) doLabel = FALSE;
-    if (uView == LVS_REPORT && lprc->left == LVIR_BOUNDS) doLabel = FALSE;
-    if (uView == LVS_ICON && lprc->left != LVIR_ICON &&
+    if (infoPtr->uView == LV_VIEW_DETAILS && lprc->left == LVIR_BOUNDS) doLabel = FALSE;
+    if (infoPtr->uView == LV_VIEW_ICON && lprc->left != LVIR_ICON &&
 	infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED))
 	oversizedBox = TRUE;
 
@@ -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
      * is stored on the app side */
     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;
     lvItem.iItem = nItem;
     lvItem.iSubItem = 0;
@@ -6013,14 +5991,14 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
     lvItem.cchTextMax = DISP_TEXT_SIZE;
     if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
     /* 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.stateMask = LVIS_FOCUSED;
 	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;
     switch(lprc->left)
     {
@@ -6045,7 +6023,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
 	return FALSE;
     }
 
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
         OffsetRect(lprc, Origin.x, Position.y + Origin.y);
     else
         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
     if (lprc->top == 0)
         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 */
     if (nItem == -1)
@@ -6187,7 +6165,7 @@ static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall)
   }
   else
   {
-    if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_ICON)
+    if (infoPtr->uView == LV_VIEW_ICON)
       lResult = MAKELONG(DEFAULT_COLUMN_WIDTH, GetSystemMetrics(SM_CXSMICON)+HEIGHT_PADDING);
     else
       lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight);
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     UINT uMask = 0;
     LVFINDINFOW lvFindInfo;
     INT nCountPerColumn;
@@ -6296,7 +6273,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
     
     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)
         {
@@ -6331,7 +6308,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
     }
     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)
         {
@@ -6366,7 +6343,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
     }
     else if (uFlags & LVNI_TOLEFT)
     {
-      if (uView == LVS_LIST)
+      if (infoPtr->uView == LV_VIEW_LIST)
       {
         nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
         while (nItem - nCountPerColumn >= 0)
@@ -6376,7 +6353,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
             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 */
         if (is_autoarrange(infoPtr))
@@ -6402,7 +6379,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
     }
     else if (uFlags & LVNI_TORIGHT)
     {
-      if (uView == LVS_LIST)
+      if (infoPtr->uView == LV_VIEW_LIST)
       {
         nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
         while (nItem + nCountPerColumn < infoPtr->nItemCount)
@@ -6412,7 +6389,7 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
             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 */
         if (is_autoarrange(infoPtr))
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nHorzPos = 0, nVertPos = 0;
     SCROLLINFO scrollInfo;
 
@@ -6482,9 +6458,9 @@ static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *infoPtr, LPPOINT lpptOrigin)
 
     lpptOrigin->x = infoPtr->rcList.left;
     lpptOrigin->y = infoPtr->rcList.top;
-    if (uView == LVS_LIST)
+    if (infoPtr->uView == LV_VIEW_LIST)
 	nHorzPos *= infoPtr->nItemWidth;
-    else if (uView == LVS_REPORT)
+    else if (infoPtr->uView == LV_VIEW_DETAILS)
 	nVertPos *= infoPtr->nItemHeight;
     
     lpptOrigin->x -= nHorzPos;
@@ -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)
 {
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     RECT rcBox, rcBounds, rcState, rcIcon, rcLabel, rcSearch;
     POINT Origin, Position, opt;
     LVITEMW lvItem;
@@ -6593,7 +6568,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
     TRACE("lpht->iItem=%d\n", iItem); 
     if (iItem == -1) return -1;
 
-    if (uView == LVS_REPORT && subitem)
+    if (infoPtr->uView == LV_VIEW_DETAILS && subitem)
     {
 	RECT  bounds, *pRect;
 	INT j;
@@ -6618,9 +6593,9 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
     }
 
     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;
-    if (uView == LVS_ICON) lvItem.stateMask |= LVIS_FOCUSED;
+    if (infoPtr->uView == LV_VIEW_ICON) lvItem.stateMask |= LVIS_FOCUSED;
     lvItem.iItem = iItem;
     lvItem.iSubItem = subitem ? lpht->iSubItem : 0;
     lvItem.pszText = szDispText;
@@ -6633,7 +6608,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
     opt.x = lpht->pt.x - Position.x - Origin.x;
     opt.y = lpht->pt.y - Position.y - Origin.y;
     
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
 	rcBounds = rcBox;
     else
     {
@@ -6650,7 +6625,7 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
     else if (infoPtr->himlState && PtInRect(&rcState, opt))
 	lpht->flags |= LVHT_ONITEMSTATEICON;
     /* 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 | LVHT_ABOVE;
@@ -6659,11 +6634,11 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
 	lpht->flags &= ~LVHT_NOWHERE;
     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->dwStyle & LVS_OWNERDRAWFIXED))))
     {
-        if (uView == LVS_REPORT)
+        if (infoPtr->uView == LV_VIEW_DETAILS)
         {
             /* get main item bounds */
             lvItem.iSubItem = 0;
@@ -6866,33 +6841,33 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT n
  *   FAILURE : FALSE
  *
  * 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
  *  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 passed, then the scroll will be 0.  (per MSDN 7/2002)
  *
  *  For:  (per experimentation with native control and CSpy ListView)
- *     LVS_ICON       dy=1 = 1 pixel  (vertical only)
- *                    dx ignored
- *     LVS_SMALLICON  dy=1 = 1 pixel  (vertical only)
- *                    dx ignored
- *     LVS_LIST       dx=1 = 1 column (horizontal only)
+ *     LV_VIEW_ICON       dy=1 = 1 pixel  (vertical only)
+ *                        dx ignored
+ *     LV_VIEW_SMALLICON  dy=1 = 1 pixel  (vertical only)
+ *                        dx ignored
+ *     LV_VIEW_LIST       dx=1 = 1 column (horizontal only)
  *                           but will only scroll 1 column per message
  *                           no matter what the value.
- *                    dy must be 0 or FALSE returned.
- *     LVS_REPORT     dx=1 = 1 pixel
- *                    dy=  see above
+ *                        dy must be 0 or FALSE returned.
+ *     LV_VIEW_DETAILS    dx=1 = 1 pixel
+ *                        dy=  see above
  *
  */
 static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
 {
-    switch(infoPtr->dwStyle & LVS_TYPEMASK) {
-    case LVS_REPORT:
+    switch(infoPtr->uView) {
+    case LV_VIEW_DETAILS:
 	dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2;
         dy /= infoPtr->nItemHeight;
 	break;
-    case LVS_LIST:
+    case LV_VIEW_LIST:
     	if (dy != 0) return FALSE;
 	break;
     default: /* icon */
@@ -7031,7 +7006,6 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn,
     COLUMN_INFO *lpColumnInfo;
     INT nNewColumn;
     HDITEMW hdi;
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
 
     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,
     /* create header if not present */
     LISTVIEW_CreateHeader(infoPtr);
     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);
     }
@@ -7164,8 +7138,7 @@ static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn,
 	lpColumnInfo->fmt = lpColumn->fmt;
 	if ((oldFmt ^ lpColumn->fmt) & (LVCFMT_JUSTIFYMASK | LVCFMT_IMAGE))
 	{
-	    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
-	    if (uView == LVS_REPORT) LISTVIEW_InvalidateColumn(infoPtr, nColumn);
+	    if (infoPtr->uView == LV_VIEW_DETAILS) LISTVIEW_InvalidateColumn(infoPtr, nColumn);
 	}
     }
 
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
     INT max_cx = 0;
     HDITEMW hdi;
@@ -7219,14 +7191,14 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
     TRACE("(nColumn=%d, cx=%d\n", nColumn, cx);
 
     /* 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 */
-    if(uView == LVS_REPORT && cx < -2) cx = LVSCW_AUTOSIZE;
-    else if (uView == LVS_LIST && cx < 1) return FALSE;
+    if(infoPtr->uView == LV_VIEW_DETAILS && cx < -2) cx = LVSCW_AUTOSIZE;
+    else if (infoPtr->uView == LV_VIEW_LIST && cx < 1) return FALSE;
 
-    /* resize all columns if in LVS_LIST mode */
-    if(uView == LVS_LIST) 
+    /* resize all columns if in LV_VIEW_LIST mode */
+    if(infoPtr->uView == LV_VIEW_LIST)
     {
 	infoPtr->nItemWidth = cx;
 	LISTVIEW_InvalidateList(infoPtr);
@@ -7500,12 +7472,11 @@ static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
 static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
 {
     DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
 
     TRACE("requested=(%d,%d)\n", cx, cy);
     
     /* 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 */
     if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING);
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT oldHeight = infoPtr->nItemHeight;
     HIMAGELIST himlOld = 0;
 
@@ -7579,14 +7549,14 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
     case LVSIL_NORMAL:
         himlOld = infoPtr->himlNormal;
         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);
     break;
 
     case LVSIL_SMALL:
         himlOld = infoPtr->himlSmall;
         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;
 
     case LVSIL_STATE:
@@ -7627,7 +7597,6 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
 
     if (infoPtr->dwStyle & LVS_OWNERDATA)
     {
-	UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
 	INT nOldCount = infoPtr->nItemCount;
 
 	if (nItems < nOldCount)
@@ -7645,7 +7614,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
 	LISTVIEW_UpdateScroll(infoPtr);
 
 	/* 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)
 	    LISTVIEW_EnsureVisible(infoPtr, infoPtr->nFocusedItem, FALSE);
@@ -7662,7 +7631,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
     	    nFrom = min(nOldCount, nItems);
 	    nTo = max(nOldCount, nItems);
     
-	    if (uView == LVS_REPORT)
+	    if (infoPtr->uView == LV_VIEW_DETAILS)
 	    {
 		rcErase.left = 0;
 		rcErase.top = nFrom * infoPtr->nItemHeight;
@@ -7672,7 +7641,7 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
 		if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
 		    LISTVIEW_InvalidateRect(infoPtr, &rcErase);
 	    }
-	    else /* LVS_LIST */
+	    else /* LV_VIEW_LIST */
 	    {
 		INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
 
@@ -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)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     POINT Origin;
 
     TRACE("(nItem=%d, &pt=%s\n", nItem, wine_dbgstr_point(&pt));
 
     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);
 
@@ -7739,7 +7707,7 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt
     if ((pt.x == -1) && (pt.y == -1))
 	pt = Origin;
     
-    if (uView == LVS_ICON)
+    if (infoPtr->uView == LV_VIEW_ICON)
     {
 	pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
 	pt.y -= ICON_TOP_PADDING;
@@ -7964,6 +7932,84 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL fUnicode)
   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 */
 
 /***
@@ -8031,7 +8077,6 @@ static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM
 static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
                                LPARAM lParamSort, BOOL IsEx)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HDPA hdpaSubItems;
     ITEM_INFO *lpItem;
     LPVOID selectionMarkItem = NULL;
@@ -8080,7 +8125,7 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
     /* I believe nHotItem should be left alone, see LISTVIEW_ShiftIndices */
 
     /* refresh the display */
-    if (uView != LVS_ICON && uView != LVS_SMALLICON)
+    if (infoPtr->uView != LV_VIEW_ICON && infoPtr->uView != LV_VIEW_SMALLICON)
 	LISTVIEW_InvalidateList(infoPtr);
 
     return TRUE;
@@ -8219,6 +8264,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
 
   infoPtr->hwndSelf = hwnd;
   infoPtr->dwStyle = lpcs->style;    /* Note: may be changed in WM_CREATE */
+  map_style_view(infoPtr);
   /* determine the type of structures to use */
   infoPtr->hwndNotify = lpcs->hwndParent;
   /* infoPtr->notifyFormat will be filled in WM_CREATE */
@@ -8292,6 +8338,8 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
   TRACE("(lpcs=%p)\n", lpcs);
 
   infoPtr->dwStyle = lpcs->style;
+  map_style_view(infoPtr);
+
   infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
                                        (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
 
@@ -8314,8 +8362,6 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
     LISTVIEW_UpdateScroll(infoPtr);
   }
 
-  map_style_view(infoPtr);
-
   OpenThemeData(hwnd, themeClass);
 
   /* initialize the icon sizes */
@@ -8434,7 +8480,6 @@ static void scroll_list(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
 static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, 
 				INT nScrollDiff, HWND hScrollWnd)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nOldScrollPos, nNewScrollPos;
     SCROLLINFO scrollInfo;
     BOOL is_an_icon;
@@ -8447,7 +8492,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
     scrollInfo.cbSize = sizeof(SCROLLINFO);
     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;
 
@@ -8507,7 +8552,7 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
     
     /* now adjust to client coordinates */
     nScrollDiff = nOldScrollPos - nNewScrollPos;
-    if (uView == LVS_REPORT) nScrollDiff *= infoPtr->nItemHeight;
+    if (infoPtr->uView == LV_VIEW_DETAILS) nScrollDiff *= infoPtr->nItemHeight;
    
     /* and scroll the window */ 
     scroll_list(infoPtr, 0, nScrollDiff);
@@ -8539,7 +8584,6 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
 static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
                                 INT nScrollDiff, HWND hScrollWnd)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nOldScrollPos, nNewScrollPos;
     SCROLLINFO scrollInfo;
 
@@ -8608,12 +8652,12 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
     /* carry on only if it really changed */
     if (nNewScrollPos == nOldScrollPos) return 0;
     
-    if(uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
         LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos);
       
     /* now adjust to client coordinates */
     nScrollDiff = nOldScrollPos - nNewScrollPos;
-    if (uView == LVS_LIST) nScrollDiff *= infoPtr->nItemWidth;
+    if (infoPtr->uView == LV_VIEW_LIST) nScrollDiff *= infoPtr->nItemWidth;
    
     /* and scroll the window */
     scroll_list(infoPtr, nScrollDiff, 0);
@@ -8623,7 +8667,6 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
 
 static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
 {
-    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT gcWheelDelta = 0;
     INT pulScrollLines = 3;
     SCROLLINFO scrollInfo;
@@ -8636,10 +8679,10 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
     scrollInfo.cbSize = sizeof(SCROLLINFO);
     scrollInfo.fMask = SIF_POS;
 
-    switch(uView)
+    switch(infoPtr->uView)
     {
-    case LVS_ICON:
-    case LVS_SMALLICON:
+    case LV_VIEW_ICON:
+    case LV_VIEW_SMALLICON:
        /*
         *  listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number
         *  should be fixed in the future.
@@ -8648,7 +8691,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
                 -LISTVIEW_SCROLL_ICON_LINE_SIZE : LISTVIEW_SCROLL_ICON_LINE_SIZE, 0);
         break;
 
-    case LVS_REPORT:
+    case LV_VIEW_DETAILS:
         if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines)
         {
             int cLineScroll = min(LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
@@ -8657,7 +8700,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
         }
         break;
 
-    case LVS_LIST:
+    case LV_VIEW_LIST:
         LISTVIEW_HScroll(infoPtr, (gcWheelDelta < 0) ? SB_LINELEFT : SB_LINERIGHT, 0, 0);
         break;
     }
@@ -8678,7 +8721,6 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
  */
 static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
 {
-  UINT uView =  infoPtr->dwStyle & LVS_TYPEMASK;
   HWND hwndSelf = infoPtr->hwndSelf;
   INT nItem = -1;
   NMLVKEYDOWN nmKeyDown;
@@ -8735,7 +8777,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
     break;
 
   case VK_PRIOR:
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
     {
       INT topidx = LISTVIEW_GetTopIndex(infoPtr);
       if (infoPtr->nFocusedItem == topidx)
@@ -8750,7 +8792,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
     break;
 
   case VK_NEXT:
-    if (uView == LVS_REPORT)
+    if (infoPtr->uView == LV_VIEW_DETAILS)
     {
       INT topidx = LISTVIEW_GetTopIndex(infoPtr);
       INT cnt = LISTVIEW_GetCountPerColumn(infoPtr);
@@ -9082,7 +9124,6 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
  */
 static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh)
 {
-    UINT uView =  infoPtr->dwStyle & LVS_TYPEMASK;
     HWND hwndSelf = infoPtr->hwndSelf;
     
     TRACE("(lpnmh=%p)\n", lpnmh);
@@ -9164,7 +9205,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
 		    LISTVIEW_UpdateScroll(infoPtr);
 		}
 		LISTVIEW_UpdateItemSize(infoPtr);
-		if (uView == LVS_REPORT && is_redrawing(infoPtr))
+		if (infoPtr->uView == LV_VIEW_DETAILS && is_redrawing(infoPtr))
 		{
 		    POINT ptOrigin;
 		    RECT rcCol = lpColumnInfo->rcHeader;
@@ -9313,11 +9354,9 @@ static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
 
     if (infoPtr->bNoItemMetrics && infoPtr->nItemCount)
     {
-	UINT uView =  infoPtr->dwStyle & LVS_TYPEMASK;
-	
 	infoPtr->bNoItemMetrics = FALSE;
 	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_UpdateScroll(infoPtr);
     }
@@ -9575,7 +9614,7 @@ static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedra
     
     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));
         LISTVIEW_UpdateSize(infoPtr);
@@ -9652,7 +9691,7 @@ static LRESULT LISTVIEW_Size(LISTVIEW_INFO *infoPtr, int Width, int Height)
     LISTVIEW_UpdateScroll(infoPtr);
 
     /* 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 !=
 	(infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight)
 	LISTVIEW_InvalidateList(infoPtr);
@@ -9737,6 +9776,7 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
     if (wStyleType != GWL_STYLE) return 0;
 
     infoPtr->dwStyle = lpss->styleNew;
+    map_style_view(infoPtr);
 
     if (((lpss->styleOld & WS_HSCROLL) != 0)&&
         ((lpss->styleNew & WS_HSCROLL) == 0))
@@ -9746,8 +9786,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
         ((lpss->styleNew & WS_VSCROLL) == 0))
        ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE);
 
-    map_style_view(infoPtr);
-
     if (uNewView != uOldView)
     {
     	SIZE oldIconSize = infoPtr->iconSize;
@@ -10074,8 +10112,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
   case LVM_GETORIGIN:
     if (!lParam) return FALSE;
-    if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT ||
-        (infoPtr->dwStyle & LVS_TYPEMASK) == LVS_LIST) return FALSE;
+    if (infoPtr->uView == LV_VIEW_DETAILS ||
+        infoPtr->uView == LV_VIEW_LIST) return FALSE;
     LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam);
     return TRUE;
 
@@ -10277,7 +10315,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
   case LVM_SETUNICODEFORMAT:
     return LISTVIEW_SetUnicodeFormat(infoPtr, wParam);
 
-  /* case LVM_SETVIEW: */
+  case LVM_SETVIEW:
+    return LISTVIEW_SetView(infoPtr, wParam);
 
   /* case LVM_SETWORKAREAS: */
 
@@ -10429,11 +10468,10 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
   case WM_WINDOWPOSCHANGED:
       if (!(((WINDOWPOS *)lParam)->flags & SWP_NOSIZE)) 
       {
-      UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
-	  SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
-		       SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
+      SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
+	           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;
           mis.CtlType = ODT_LISTVIEW;
-- 
1.5.6.5





More information about the wine-patches mailing list