Changeset 5811 for trunk/src/comctl32/listview.c
- Timestamp:
- May 27, 2001, 9:13:36 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/listview.c
r5780 r5811 4346 4346 * FAILURE : FALSE 4347 4347 */ 4348 #ifdef __WIN32OS2__ 4349 static VOID LISTVIEW_ScrollWindow(HWND hwnd,INT xScroll,INT yScroll); 4350 4351 static BOOL LISTVIEW_EnsureVisible(HWND hwnd,INT nItem,BOOL bPartialOk) 4352 { 4353 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 4354 DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE); 4355 UINT uView = dwStyle & LVS_TYPEMASK; 4356 INT nScrollPosHeight = 0; 4357 INT nScrollPosWidth = 0; 4358 RECT rcItem; 4359 POINT oldlefttop = infoPtr->lefttop; 4360 4361 rcItem.left = LVIR_BOUNDS; 4362 if (LISTVIEW_GetItemRect(hwnd, nItem, &rcItem)) 4363 { 4364 if (bPartialOk && IntersectRect(NULL,&rcItem,&infoPtr->rcList)) 4365 return TRUE; 4366 4367 if (rcItem.left < infoPtr->rcList.left) 4368 { 4369 if (dwStyle & WS_HSCROLL) 4370 { 4371 /* scroll left */ 4372 if (uView == LVS_LIST) 4373 { 4374 nScrollPosWidth = infoPtr->scrollStep.x; 4375 rcItem.left += infoPtr->rcList.left; 4376 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 4377 { 4378 nScrollPosWidth = infoPtr->scrollStep.x; 4379 rcItem.left += infoPtr->rcList.left; 4380 } 4381 4382 /* When in LVS_REPORT view, the scroll position should 4383 not be updated. */ 4384 if (nScrollPosWidth) 4385 { 4386 if (rcItem.left % nScrollPosWidth == 0) 4387 infoPtr->lefttop.x += rcItem.left / nScrollPosWidth; 4388 else 4389 infoPtr->lefttop.x += rcItem.left / nScrollPosWidth - 1; 4390 4391 if (infoPtr->lefttop.x != oldlefttop.x) 4392 { 4393 SCROLLINFO scrollInfo; 4394 4395 ZeroMemory(&scrollInfo,sizeof(SCROLLINFO)); 4396 scrollInfo.cbSize = sizeof(SCROLLINFO); 4397 scrollInfo.fMask = SIF_POS; 4398 scrollInfo.nPos = infoPtr->lefttop.x; 4399 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 4400 } 4401 } 4402 } 4403 } else if (rcItem.right > infoPtr->rcList.right) 4404 { 4405 if (dwStyle & WS_HSCROLL) 4406 { 4407 /* scroll right */ 4408 if (uView == LVS_LIST) 4409 { 4410 rcItem.right -= infoPtr->rcList.right; 4411 nScrollPosWidth = infoPtr->scrollStep.x; 4412 } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) 4413 { 4414 rcItem.right -= infoPtr->rcList.right; 4415 nScrollPosWidth = infoPtr->scrollStep.x; 4416 } 4417 4418 /* When in LVS_REPORT view, the scroll position should 4419 not be updated. */ 4420 if (nScrollPosWidth) 4421 { 4422 SCROLLINFO scrollInfo; 4423 4424 if (rcItem.right % nScrollPosWidth == 0) 4425 infoPtr->lefttop.x += rcItem.right / nScrollPosWidth; 4426 else 4427 infoPtr->lefttop.x += rcItem.right / nScrollPosWidth + 1; 4428 4429 if (infoPtr->lefttop.x != oldlefttop.x) 4430 { 4431 SCROLLINFO scrollInfo; 4432 4433 ZeroMemory(&scrollInfo,sizeof(SCROLLINFO)); 4434 scrollInfo.cbSize = sizeof(SCROLLINFO); 4435 scrollInfo.fMask = SIF_POS; 4436 scrollInfo.nPos = infoPtr->lefttop.x; 4437 SetScrollInfo(hwnd,SB_HORZ,&scrollInfo,TRUE); 4438 } 4439 } 4440 } 4441 } 4442 4443 if (rcItem.top < infoPtr->rcList.top) 4444 { 4445 /* scroll up */ 4446 if (dwStyle & WS_VSCROLL) 4447 { 4448 if (uView == LVS_REPORT) 4449 { 4450 rcItem.top -= infoPtr->rcList.top; 4451 nScrollPosHeight = infoPtr->scrollStep.y; 4452 } 4453 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 4454 { 4455 nScrollPosHeight = infoPtr->scrollStep.y; 4456 rcItem.top += infoPtr->rcList.top; 4457 } 4458 4459 if (rcItem.top % nScrollPosHeight == 0) 4460 infoPtr->lefttop.y += rcItem.top / nScrollPosHeight; 4461 else 4462 infoPtr->lefttop.y += rcItem.top / nScrollPosHeight - 1; 4463 4464 if (infoPtr->lefttop.y != oldlefttop.y) 4465 { 4466 SCROLLINFO scrollInfo; 4467 4468 ZeroMemory(&scrollInfo,sizeof(SCROLLINFO)); 4469 scrollInfo.cbSize = sizeof(SCROLLINFO); 4470 scrollInfo.fMask = SIF_POS; 4471 scrollInfo.nPos = infoPtr->lefttop.y; 4472 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 4473 } 4474 } 4475 } else if (rcItem.bottom > infoPtr->rcList.bottom) 4476 { 4477 /* scroll down */ 4478 if (dwStyle & WS_VSCROLL) 4479 { 4480 if (uView == LVS_REPORT) 4481 { 4482 rcItem.bottom -= infoPtr->rcList.bottom; 4483 nScrollPosHeight = infoPtr->scrollStep.y; 4484 } else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 4485 { 4486 nScrollPosHeight = infoPtr->scrollStep.x; 4487 rcItem.bottom -= infoPtr->rcList.bottom; 4488 } 4489 4490 if (rcItem.bottom % nScrollPosHeight == 0) 4491 infoPtr->lefttop.y += rcItem.bottom / nScrollPosHeight; 4492 else 4493 infoPtr->lefttop.y += rcItem.bottom / nScrollPosHeight + 1; 4494 if (infoPtr->lefttop.y != oldlefttop.y) 4495 { 4496 SCROLLINFO scrollInfo; 4497 4498 ZeroMemory(&scrollInfo,sizeof(SCROLLINFO)); 4499 scrollInfo.cbSize = sizeof(SCROLLINFO); 4500 scrollInfo.fMask = SIF_POS; 4501 scrollInfo.nPos = infoPtr->lefttop.y; 4502 SetScrollInfo(hwnd,SB_VERT,&scrollInfo,TRUE); 4503 } 4504 } 4505 } 4506 } 4507 4508 if ((oldlefttop.x != infoPtr->lefttop.x) || (oldlefttop.y != infoPtr->lefttop.y)) 4509 LISTVIEW_ScrollWindow(hwnd,(oldlefttop.x-infoPtr->lefttop.x)*infoPtr->scrollStep.x,(oldlefttop.y-infoPtr->lefttop.y)*infoPtr->scrollStep.y); 4510 4511 return TRUE; 4512 } 4513 #else 4348 4514 static BOOL LISTVIEW_EnsureVisible(HWND hwnd, INT nItem, BOOL bPartial) 4349 4515 { … … 4498 4664 return TRUE; 4499 4665 } 4500 4666 #endif 4501 4667 /*** 4502 4668 * DESCRIPTION: … … 8584 8750 InvalidateRect(hwnd, NULL, TRUE); 8585 8751 } 8752 #ifdef __WIN32OS2__ 8753 else 8754 if ((lpnmh->code == HDN_ITEMCHANGEDA) || (lpnmh->code == HDN_ITEMCHANGEDW)) 8755 { 8756 INT width; 8757 8758 width = LISTVIEW_GetItemWidth(hwnd); 8759 if (width != infoPtr->nItemWidth) 8760 { 8761 HDC hdc; 8762 8763 infoPtr->nItemWidth = width; 8764 LISTVIEW_UpdateScroll(hwnd); 8765 hdc = GetDC(hwnd); 8766 LISTVIEW_Refresh(hwnd, hdc); 8767 ReleaseDC(hwnd, hdc); 8768 } 8769 } 8770 #endif 8586 8771 else if(lpnmh->code == HDN_ITEMCLICKA) 8587 8772 {
Note:
See TracChangeset
for help on using the changeset viewer.