Changes for Icon and SmallIcon modes:

- fix typo causing wrong scroll boundaries
 - reverse mouse wheel scroll directions
 - fix navigation with keyboard when auto arranged
This commit is contained in:
Vitaliy Margolen 2003-03-15 00:05:46 +00:00 committed by Alexandre Julliard
parent 803b5686ef
commit eded087e4e
1 changed files with 51 additions and 2 deletions

View File

@ -2167,7 +2167,7 @@ static void LISTVIEW_GetAreaRect(LISTVIEW_INFO *infoPtr, LPRECT lprcView)
for (i = 0; i < infoPtr->nItemCount; i++) for (i = 0; i < infoPtr->nItemCount; i++)
{ {
x = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, i); x = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, i);
y = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, i); y = (LONG)DPA_GetPtr(infoPtr->hdpaPosY, i);
lprcView->right = max(lprcView->right, x); lprcView->right = max(lprcView->right, x);
lprcView->bottom = max(lprcView->bottom, y); lprcView->bottom = max(lprcView->bottom, y);
} }
@ -5426,6 +5426,7 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
UINT uMask = 0; UINT uMask = 0;
LVFINDINFOW lvFindInfo; LVFINDINFOW lvFindInfo;
INT nCountPerColumn; INT nCountPerColumn;
INT nCountPerRow;
INT i; INT i;
TRACE("nItem=%d, uFlags=%x, nItemCount=%d\n", nItem, uFlags, infoPtr->nItemCount); TRACE("nItem=%d, uFlags=%x, nItemCount=%d\n", nItem, uFlags, infoPtr->nItemCount);
@ -5466,6 +5467,18 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
} }
else else
{ {
/* Special case for autoarrange - move 'til the top of a list */
if (is_autoarrange(infoPtr))
{
nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
while (nItem - nCountPerRow >= 0)
{
nItem -= nCountPerRow;
if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
return nItem;
}
return -1;
}
lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.flags = LVFI_NEARESTXY;
lvFindInfo.vkDirection = VK_UP; lvFindInfo.vkDirection = VK_UP;
ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt);
@ -5489,6 +5502,18 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
} }
else else
{ {
/* Special case for autoarrange - move 'til the bottom of a list */
if (is_autoarrange(infoPtr))
{
nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
while (nItem + nCountPerRow < infoPtr->nItemCount )
{
nItem += nCountPerRow;
if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
return nItem;
}
return -1;
}
lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.flags = LVFI_NEARESTXY;
lvFindInfo.vkDirection = VK_DOWN; lvFindInfo.vkDirection = VK_DOWN;
ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt);
@ -5513,6 +5538,18 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
} }
else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
{ {
/* Special case for autoarrange - move 'ti the beginning of a row */
if (is_autoarrange(infoPtr))
{
nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
while (nItem % nCountPerRow > 0)
{
nItem --;
if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
return nItem;
}
return -1;
}
lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.flags = LVFI_NEARESTXY;
lvFindInfo.vkDirection = VK_LEFT; lvFindInfo.vkDirection = VK_LEFT;
ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt);
@ -5537,6 +5574,18 @@ static INT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
} }
else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
{ {
/* Special case for autoarrange - move 'til the end of a row */
if (is_autoarrange(infoPtr))
{
nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
while (nItem % nCountPerRow < nCountPerRow - 1 )
{
nItem ++;
if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
return nItem;
}
return -1;
}
lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.flags = LVFI_NEARESTXY;
lvFindInfo.vkDirection = VK_RIGHT; lvFindInfo.vkDirection = VK_RIGHT;
ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt);
@ -7403,7 +7452,7 @@ static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
* should be fixed in the future. * should be fixed in the future.
*/ */
LISTVIEW_VScroll(infoPtr, SB_INTERNAL, (gcWheelDelta < 0) ? LISTVIEW_VScroll(infoPtr, SB_INTERNAL, (gcWheelDelta < 0) ?
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 LVS_REPORT: