| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 7 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
| 8 #include "fpdfsdk/include/fxedit/fxet_list.h" | 8 #include "fpdfsdk/include/fxedit/fxet_list.h" |
| 9 | 9 |
| 10 CFX_ListItem::CFX_ListItem() | 10 CFX_ListItem::CFX_ListItem() |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return pListItem->GetEdit(); | 148 return pListItem->GetEdit(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 return NULL; | 151 return NULL; |
| 152 } | 152 } |
| 153 | 153 |
| 154 int32_t CFX_List::GetCount() const { | 154 int32_t CFX_List::GetCount() const { |
| 155 return m_aListItems.GetSize(); | 155 return m_aListItems.GetSize(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 CFX_FloatRect CFX_List::GetPlateRect() const { | 158 CPDF_Rect CFX_List::GetPlateRect() const { |
| 159 return CFX_ListContainer::GetPlateRect(); | 159 return CFX_ListContainer::GetPlateRect(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 CFX_FloatRect CFX_List::GetContentRect() const { | 162 CPDF_Rect CFX_List::GetContentRect() const { |
| 163 return InnerToOuter(CFX_ListContainer::GetContentRect()); | 163 return InnerToOuter(CFX_ListContainer::GetContentRect()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 FX_FLOAT CFX_List::GetFontSize() const { | 166 FX_FLOAT CFX_List::GetFontSize() const { |
| 167 return m_fFontSize; | 167 return m_fFontSize; |
| 168 } | 168 } |
| 169 | 169 |
| 170 int32_t CFX_List::GetItemIndex(const CFX_FloatPoint& point) const { | 170 int32_t CFX_List::GetItemIndex(const CPDF_Point& point) const { |
| 171 CFX_FloatPoint pt = OuterToInner(point); | 171 CPDF_Point pt = OuterToInner(point); |
| 172 | 172 |
| 173 FX_BOOL bFirst = TRUE; | 173 FX_BOOL bFirst = TRUE; |
| 174 FX_BOOL bLast = TRUE; | 174 FX_BOOL bLast = TRUE; |
| 175 | 175 |
| 176 for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { | 176 for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { |
| 177 if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { | 177 if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { |
| 178 CLST_Rect rcListItem = pListItem->GetRect(); | 178 CLST_Rect rcListItem = pListItem->GetRect(); |
| 179 | 179 |
| 180 if (FX_EDIT_IsFloatBigger(pt.y, rcListItem.top)) { | 180 if (FX_EDIT_IsFloatBigger(pt.y, rcListItem.top)) { |
| 181 bFirst = FALSE; | 181 bFirst = FALSE; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nCircleIndex)) { | 244 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nCircleIndex)) { |
| 245 if (Toupper(pListItem->GetFirstChar()) == Toupper(nChar)) | 245 if (Toupper(pListItem->GetFirstChar()) == Toupper(nChar)) |
| 246 return nCircleIndex; | 246 return nCircleIndex; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 return nCircleIndex; | 250 return nCircleIndex; |
| 251 } | 251 } |
| 252 | 252 |
| 253 CFX_FloatRect CFX_List::GetItemRect(int32_t nIndex) const { | 253 CPDF_Rect CFX_List::GetItemRect(int32_t nIndex) const { |
| 254 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { | 254 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { |
| 255 CFX_FloatRect rcItem = pListItem->GetRect(); | 255 CPDF_Rect rcItem = pListItem->GetRect(); |
| 256 rcItem.left = 0.0f; | 256 rcItem.left = 0.0f; |
| 257 rcItem.right = GetPlateRect().Width(); | 257 rcItem.right = GetPlateRect().Width(); |
| 258 return InnerToOuter(rcItem); | 258 return InnerToOuter(rcItem); |
| 259 } | 259 } |
| 260 | 260 |
| 261 return CFX_FloatRect(); | 261 return CPDF_Rect(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 FX_BOOL CFX_List::IsItemSelected(int32_t nIndex) const { | 264 FX_BOOL CFX_List::IsItemSelected(int32_t nIndex) const { |
| 265 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { | 265 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { |
| 266 return pListItem->IsSelected(); | 266 return pListItem->IsSelected(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 return FALSE; | 269 return FALSE; |
| 270 } | 270 } |
| 271 | 271 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 m_nFootIndex(-1), | 416 m_nFootIndex(-1), |
| 417 m_bCtrlSel(FALSE), | 417 m_bCtrlSel(FALSE), |
| 418 m_nCaretIndex(-1) {} | 418 m_nCaretIndex(-1) {} |
| 419 | 419 |
| 420 CFX_ListCtrl::~CFX_ListCtrl() {} | 420 CFX_ListCtrl::~CFX_ListCtrl() {} |
| 421 | 421 |
| 422 void CFX_ListCtrl::SetNotify(IFX_List_Notify* pNotify) { | 422 void CFX_ListCtrl::SetNotify(IFX_List_Notify* pNotify) { |
| 423 m_pNotify = pNotify; | 423 m_pNotify = pNotify; |
| 424 } | 424 } |
| 425 | 425 |
| 426 CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const { | 426 CPDF_Point CFX_ListCtrl::InToOut(const CPDF_Point& point) const { |
| 427 CFX_FloatRect rcPlate = GetPlateRect(); | 427 CPDF_Rect rcPlate = GetPlateRect(); |
| 428 | 428 |
| 429 return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left), | 429 return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), |
| 430 point.y - (m_ptScrollPos.y - rcPlate.top)); | 430 point.y - (m_ptScrollPos.y - rcPlate.top)); |
| 431 } | 431 } |
| 432 | 432 |
| 433 CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { | 433 CPDF_Point CFX_ListCtrl::OutToIn(const CPDF_Point& point) const { |
| 434 CFX_FloatRect rcPlate = GetPlateRect(); | 434 CPDF_Rect rcPlate = GetPlateRect(); |
| 435 | 435 |
| 436 return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left), | 436 return CPDF_Point(point.x + (m_ptScrollPos.x - rcPlate.left), |
| 437 point.y + (m_ptScrollPos.y - rcPlate.top)); | 437 point.y + (m_ptScrollPos.y - rcPlate.top)); |
| 438 } | 438 } |
| 439 | 439 |
| 440 CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const { | 440 CPDF_Rect CFX_ListCtrl::InToOut(const CPDF_Rect& rect) const { |
| 441 CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom)); | 441 CPDF_Point ptLeftBottom = InToOut(CPDF_Point(rect.left, rect.bottom)); |
| 442 CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(rect.right, rect.top)); | 442 CPDF_Point ptRightTop = InToOut(CPDF_Point(rect.right, rect.top)); |
| 443 | 443 |
| 444 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, | 444 return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); |
| 445 ptRightTop.y); | |
| 446 } | 445 } |
| 447 | 446 |
| 448 CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { | 447 CPDF_Rect CFX_ListCtrl::OutToIn(const CPDF_Rect& rect) const { |
| 449 CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom)); | 448 CPDF_Point ptLeftBottom = OutToIn(CPDF_Point(rect.left, rect.bottom)); |
| 450 CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top)); | 449 CPDF_Point ptRightTop = OutToIn(CPDF_Point(rect.right, rect.top)); |
| 451 | 450 |
| 452 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, | 451 return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); |
| 453 ptRightTop.y); | |
| 454 } | 452 } |
| 455 | 453 |
| 456 void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, | 454 void CFX_ListCtrl::OnMouseDown(const CPDF_Point& point, |
| 457 FX_BOOL bShift, | 455 FX_BOOL bShift, |
| 458 FX_BOOL bCtrl) { | 456 FX_BOOL bCtrl) { |
| 459 int32_t nHitIndex = GetItemIndex(point); | 457 int32_t nHitIndex = GetItemIndex(point); |
| 460 | 458 |
| 461 if (IsMultipleSel()) { | 459 if (IsMultipleSel()) { |
| 462 if (bCtrl) { | 460 if (bCtrl) { |
| 463 if (IsItemSelected(nHitIndex)) { | 461 if (IsItemSelected(nHitIndex)) { |
| 464 m_aSelItems.Sub(nHitIndex); | 462 m_aSelItems.Sub(nHitIndex); |
| 465 SelectItems(); | 463 SelectItems(); |
| 466 m_bCtrlSel = FALSE; | 464 m_bCtrlSel = FALSE; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 485 | 483 |
| 486 SetCaret(nHitIndex); | 484 SetCaret(nHitIndex); |
| 487 } else { | 485 } else { |
| 488 SetSingleSelect(nHitIndex); | 486 SetSingleSelect(nHitIndex); |
| 489 } | 487 } |
| 490 | 488 |
| 491 if (!IsItemVisible(nHitIndex)) | 489 if (!IsItemVisible(nHitIndex)) |
| 492 ScrollToListItem(nHitIndex); | 490 ScrollToListItem(nHitIndex); |
| 493 } | 491 } |
| 494 | 492 |
| 495 void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, | 493 void CFX_ListCtrl::OnMouseMove(const CPDF_Point& point, |
| 496 FX_BOOL bShift, | 494 FX_BOOL bShift, |
| 497 FX_BOOL bCtrl) { | 495 FX_BOOL bCtrl) { |
| 498 int32_t nHitIndex = GetItemIndex(point); | 496 int32_t nHitIndex = GetItemIndex(point); |
| 499 | 497 |
| 500 if (IsMultipleSel()) { | 498 if (IsMultipleSel()) { |
| 501 if (bCtrl) { | 499 if (bCtrl) { |
| 502 if (m_bCtrlSel) | 500 if (m_bCtrlSel) |
| 503 m_aSelItems.Add(m_nFootIndex, nHitIndex); | 501 m_aSelItems.Add(m_nFootIndex, nHitIndex); |
| 504 else | 502 else |
| 505 m_aSelItems.Sub(m_nFootIndex, nHitIndex); | 503 m_aSelItems.Sub(m_nFootIndex, nHitIndex); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 int32_t nIndex = GetLastSelected(); | 571 int32_t nIndex = GetLastSelected(); |
| 574 int32_t nFindIndex = FindNext(nIndex, nChar); | 572 int32_t nFindIndex = FindNext(nIndex, nChar); |
| 575 | 573 |
| 576 if (nFindIndex != nIndex) { | 574 if (nFindIndex != nIndex) { |
| 577 OnVK(nFindIndex, bShift, bCtrl); | 575 OnVK(nFindIndex, bShift, bCtrl); |
| 578 return TRUE; | 576 return TRUE; |
| 579 } | 577 } |
| 580 return FALSE; | 578 return FALSE; |
| 581 } | 579 } |
| 582 | 580 |
| 583 void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { | 581 void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) { |
| 584 CFX_ListContainer::SetPlateRect(rect); | 582 CFX_ListContainer::SetPlateRect(rect); |
| 585 m_ptScrollPos.x = rect.left; | 583 m_ptScrollPos.x = rect.left; |
| 586 SetScrollPos(CFX_FloatPoint(rect.left, rect.top)); | 584 SetScrollPos(CPDF_Point(rect.left, rect.top)); |
| 587 ReArrange(0); | 585 ReArrange(0); |
| 588 InvalidateItem(-1); | 586 InvalidateItem(-1); |
| 589 } | 587 } |
| 590 | 588 |
| 591 CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { | 589 CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { |
| 592 return InToOut(CFX_List::GetItemRect(nIndex)); | 590 return InToOut(CFX_List::GetItemRect(nIndex)); |
| 593 } | 591 } |
| 594 | 592 |
| 595 void CFX_ListCtrl::AddString(const FX_WCHAR* string) { | 593 void CFX_ListCtrl::AddString(const FX_WCHAR* string) { |
| 596 AddItem(string); | 594 AddItem(string); |
| 597 ReArrange(GetCount() - 1); | 595 ReArrange(GetCount() - 1); |
| 598 } | 596 } |
| 599 | 597 |
| 600 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { | 598 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { |
| 601 if (!IsValid(nItemIndex)) | 599 if (!IsValid(nItemIndex)) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 InvalidateItem(nItemIndex); | 643 InvalidateItem(nItemIndex); |
| 646 } | 644 } |
| 647 } | 645 } |
| 648 } | 646 } |
| 649 | 647 |
| 650 void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { | 648 void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { |
| 651 if (m_pNotify) { | 649 if (m_pNotify) { |
| 652 if (nItemIndex == -1) { | 650 if (nItemIndex == -1) { |
| 653 if (!m_bNotifyFlag) { | 651 if (!m_bNotifyFlag) { |
| 654 m_bNotifyFlag = TRUE; | 652 m_bNotifyFlag = TRUE; |
| 655 CFX_FloatRect rcRefresh = GetPlateRect(); | 653 CPDF_Rect rcRefresh = GetPlateRect(); |
| 656 m_pNotify->IOnInvalidateRect(&rcRefresh); | 654 m_pNotify->IOnInvalidateRect(&rcRefresh); |
| 657 m_bNotifyFlag = FALSE; | 655 m_bNotifyFlag = FALSE; |
| 658 } | 656 } |
| 659 } else { | 657 } else { |
| 660 if (!m_bNotifyFlag) { | 658 if (!m_bNotifyFlag) { |
| 661 m_bNotifyFlag = TRUE; | 659 m_bNotifyFlag = TRUE; |
| 662 CFX_FloatRect rcRefresh = GetItemRect(nItemIndex); | 660 CPDF_Rect rcRefresh = GetItemRect(nItemIndex); |
| 663 rcRefresh.left -= 1.0f; | 661 rcRefresh.left -= 1.0f; |
| 664 rcRefresh.right += 1.0f; | 662 rcRefresh.right += 1.0f; |
| 665 rcRefresh.bottom -= 1.0f; | 663 rcRefresh.bottom -= 1.0f; |
| 666 rcRefresh.top += 1.0f; | 664 rcRefresh.top += 1.0f; |
| 667 | 665 |
| 668 m_pNotify->IOnInvalidateRect(&rcRefresh); | 666 m_pNotify->IOnInvalidateRect(&rcRefresh); |
| 669 m_bNotifyFlag = FALSE; | 667 m_bNotifyFlag = FALSE; |
| 670 } | 668 } |
| 671 } | 669 } |
| 672 } | 670 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 696 | 694 |
| 697 if (IsMultipleSel()) { | 695 if (IsMultipleSel()) { |
| 698 m_aSelItems.Add(nItemIndex); | 696 m_aSelItems.Add(nItemIndex); |
| 699 SelectItems(); | 697 SelectItems(); |
| 700 } else { | 698 } else { |
| 701 SetSingleSelect(nItemIndex); | 699 SetSingleSelect(nItemIndex); |
| 702 } | 700 } |
| 703 } | 701 } |
| 704 | 702 |
| 705 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { | 703 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { |
| 706 CFX_FloatRect rcPlate = GetPlateRect(); | 704 CPDF_Rect rcPlate = GetPlateRect(); |
| 707 CFX_FloatRect rcItem = GetItemRect(nItemIndex); | 705 CPDF_Rect rcItem = GetItemRect(nItemIndex); |
| 708 | 706 |
| 709 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; | 707 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; |
| 710 } | 708 } |
| 711 | 709 |
| 712 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { | 710 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { |
| 713 if (!IsValid(nItemIndex)) | 711 if (!IsValid(nItemIndex)) |
| 714 return; | 712 return; |
| 715 | 713 |
| 716 CFX_FloatRect rcPlate = GetPlateRect(); | 714 CPDF_Rect rcPlate = GetPlateRect(); |
| 717 CFX_FloatRect rcItem = CFX_List::GetItemRect(nItemIndex); | 715 CPDF_Rect rcItem = CFX_List::GetItemRect(nItemIndex); |
| 718 CFX_FloatRect rcItemCtrl = GetItemRect(nItemIndex); | 716 CPDF_Rect rcItemCtrl = GetItemRect(nItemIndex); |
| 719 | 717 |
| 720 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom)) { | 718 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom)) { |
| 721 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top)) { | 719 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top)) { |
| 722 SetScrollPosY(rcItem.bottom + rcPlate.Height()); | 720 SetScrollPosY(rcItem.bottom + rcPlate.Height()); |
| 723 } | 721 } |
| 724 } else if (FX_EDIT_IsFloatBigger(rcItemCtrl.top, rcPlate.top)) { | 722 } else if (FX_EDIT_IsFloatBigger(rcItemCtrl.top, rcPlate.top)) { |
| 725 if (FX_EDIT_IsFloatBigger(rcItemCtrl.bottom, rcPlate.bottom)) { | 723 if (FX_EDIT_IsFloatBigger(rcItemCtrl.bottom, rcPlate.bottom)) { |
| 726 SetScrollPosY(rcItem.top); | 724 SetScrollPosY(rcItem.top); |
| 727 } | 725 } |
| 728 } | 726 } |
| 729 } | 727 } |
| 730 | 728 |
| 731 void CFX_ListCtrl::SetScrollInfo() { | 729 void CFX_ListCtrl::SetScrollInfo() { |
| 732 if (m_pNotify) { | 730 if (m_pNotify) { |
| 733 CFX_FloatRect rcPlate = GetPlateRect(); | 731 CPDF_Rect rcPlate = GetPlateRect(); |
| 734 CFX_FloatRect rcContent = CFX_List::GetContentRect(); | 732 CPDF_Rect rcContent = CFX_List::GetContentRect(); |
| 735 | 733 |
| 736 if (!m_bNotifyFlag) { | 734 if (!m_bNotifyFlag) { |
| 737 m_bNotifyFlag = TRUE; | 735 m_bNotifyFlag = TRUE; |
| 738 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, | 736 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, |
| 739 rcContent.bottom, rcContent.top, | 737 rcContent.bottom, rcContent.top, |
| 740 GetFirstHeight(), rcPlate.Height()); | 738 GetFirstHeight(), rcPlate.Height()); |
| 741 m_bNotifyFlag = FALSE; | 739 m_bNotifyFlag = FALSE; |
| 742 } | 740 } |
| 743 } | 741 } |
| 744 } | 742 } |
| 745 | 743 |
| 746 void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { | 744 void CFX_ListCtrl::SetScrollPos(const CPDF_Point& point) { |
| 747 SetScrollPosY(point.y); | 745 SetScrollPosY(point.y); |
| 748 } | 746 } |
| 749 | 747 |
| 750 void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { | 748 void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { |
| 751 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) { | 749 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) { |
| 752 CFX_FloatRect rcPlate = GetPlateRect(); | 750 CPDF_Rect rcPlate = GetPlateRect(); |
| 753 CFX_FloatRect rcContent = CFX_List::GetContentRect(); | 751 CPDF_Rect rcContent = CFX_List::GetContentRect(); |
| 754 | 752 |
| 755 if (rcPlate.Height() > rcContent.Height()) { | 753 if (rcPlate.Height() > rcContent.Height()) { |
| 756 fy = rcPlate.top; | 754 fy = rcPlate.top; |
| 757 } else { | 755 } else { |
| 758 if (FX_EDIT_IsFloatSmaller(fy - rcPlate.Height(), rcContent.bottom)) { | 756 if (FX_EDIT_IsFloatSmaller(fy - rcPlate.Height(), rcContent.bottom)) { |
| 759 fy = rcContent.bottom + rcPlate.Height(); | 757 fy = rcContent.bottom + rcPlate.Height(); |
| 760 } else if (FX_EDIT_IsFloatBigger(fy, rcContent.top)) { | 758 } else if (FX_EDIT_IsFloatBigger(fy, rcContent.top)) { |
| 761 fy = rcContent.top; | 759 fy = rcContent.top; |
| 762 } | 760 } |
| 763 } | 761 } |
| 764 | 762 |
| 765 m_ptScrollPos.y = fy; | 763 m_ptScrollPos.y = fy; |
| 766 InvalidateItem(-1); | 764 InvalidateItem(-1); |
| 767 | 765 |
| 768 if (m_pNotify) { | 766 if (m_pNotify) { |
| 769 if (!m_bNotifyFlag) { | 767 if (!m_bNotifyFlag) { |
| 770 m_bNotifyFlag = TRUE; | 768 m_bNotifyFlag = TRUE; |
| 771 m_pNotify->IOnSetScrollPosY(fy); | 769 m_pNotify->IOnSetScrollPosY(fy); |
| 772 m_bNotifyFlag = FALSE; | 770 m_bNotifyFlag = FALSE; |
| 773 } | 771 } |
| 774 } | 772 } |
| 775 } | 773 } |
| 776 } | 774 } |
| 777 | 775 |
| 778 CFX_FloatRect CFX_ListCtrl::GetContentRect() const { | 776 CPDF_Rect CFX_ListCtrl::GetContentRect() const { |
| 779 return InToOut(CFX_List::GetContentRect()); | 777 return InToOut(CFX_List::GetContentRect()); |
| 780 } | 778 } |
| 781 | 779 |
| 782 void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { | 780 void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { |
| 783 CFX_List::ReArrange(nItemIndex); | 781 CFX_List::ReArrange(nItemIndex); |
| 784 SetScrollInfo(); | 782 SetScrollInfo(); |
| 785 } | 783 } |
| 786 | 784 |
| 787 void CFX_ListCtrl::SetTopItem(int32_t nIndex) { | 785 void CFX_ListCtrl::SetTopItem(int32_t nIndex) { |
| 788 if (IsValid(nIndex)) { | 786 if (IsValid(nIndex)) { |
| 789 GetPlateRect(); | 787 GetPlateRect(); |
| 790 CFX_FloatRect rcItem = CFX_List::GetItemRect(nIndex); | 788 CPDF_Rect rcItem = CFX_List::GetItemRect(nIndex); |
| 791 SetScrollPosY(rcItem.top); | 789 SetScrollPosY(rcItem.top); |
| 792 } | 790 } |
| 793 } | 791 } |
| 794 | 792 |
| 795 int32_t CFX_ListCtrl::GetTopItem() const { | 793 int32_t CFX_ListCtrl::GetTopItem() const { |
| 796 int32_t nItemIndex = GetItemIndex(GetBTPoint()); | 794 int32_t nItemIndex = GetItemIndex(GetBTPoint()); |
| 797 | 795 |
| 798 if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) | 796 if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) |
| 799 nItemIndex += 1; | 797 nItemIndex += 1; |
| 800 | 798 |
| 801 return nItemIndex; | 799 return nItemIndex; |
| 802 } | 800 } |
| 803 | 801 |
| 804 void CFX_ListCtrl::Empty() { | 802 void CFX_ListCtrl::Empty() { |
| 805 CFX_List::Empty(); | 803 CFX_List::Empty(); |
| 806 InvalidateItem(-1); | 804 InvalidateItem(-1); |
| 807 } | 805 } |
| 808 | 806 |
| 809 void CFX_ListCtrl::Cancel() { | 807 void CFX_ListCtrl::Cancel() { |
| 810 m_aSelItems.DeselectAll(); | 808 m_aSelItems.DeselectAll(); |
| 811 } | 809 } |
| 812 | 810 |
| 813 int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { | 811 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const { |
| 814 return CFX_List::GetItemIndex(OutToIn(point)); | 812 return CFX_List::GetItemIndex(OutToIn(point)); |
| 815 } | 813 } |
| 816 | 814 |
| 817 CFX_WideString CFX_ListCtrl::GetText() const { | 815 CFX_WideString CFX_ListCtrl::GetText() const { |
| 818 if (IsMultipleSel()) | 816 if (IsMultipleSel()) |
| 819 return GetItemText(m_nCaretIndex); | 817 return GetItemText(m_nCaretIndex); |
| 820 return GetItemText(m_nSelItem); | 818 return GetItemText(m_nSelItem); |
| 821 } | 819 } |
| OLD | NEW |