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 CPDF_Rect CFX_List::GetPlateRect() const { | 158 CFX_FloatRect CFX_List::GetPlateRect() const { |
159 return CFX_ListContainer::GetPlateRect(); | 159 return CFX_ListContainer::GetPlateRect(); |
160 } | 160 } |
161 | 161 |
162 CPDF_Rect CFX_List::GetContentRect() const { | 162 CFX_FloatRect 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 CPDF_Point& point) const { | 170 int32_t CFX_List::GetItemIndex(const CFX_FloatPoint& point) const { |
171 CPDF_Point pt = OuterToInner(point); | 171 CFX_FloatPoint 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 CPDF_Rect CFX_List::GetItemRect(int32_t nIndex) const { | 253 CFX_FloatRect 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 CPDF_Rect rcItem = pListItem->GetRect(); | 255 CFX_FloatRect 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 CPDF_Rect(); | 261 return CFX_FloatRect(); |
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 CPDF_Point CFX_ListCtrl::InToOut(const CPDF_Point& point) const { | 426 CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const { |
427 CPDF_Rect rcPlate = GetPlateRect(); | 427 CFX_FloatRect rcPlate = GetPlateRect(); |
428 | 428 |
429 return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), | 429 return CFX_FloatPoint(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 CPDF_Point CFX_ListCtrl::OutToIn(const CPDF_Point& point) const { | 433 CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { |
434 CPDF_Rect rcPlate = GetPlateRect(); | 434 CFX_FloatRect rcPlate = GetPlateRect(); |
435 | 435 |
436 return CPDF_Point(point.x + (m_ptScrollPos.x - rcPlate.left), | 436 return CFX_FloatPoint(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 CPDF_Rect CFX_ListCtrl::InToOut(const CPDF_Rect& rect) const { | 440 CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const { |
441 CPDF_Point ptLeftBottom = InToOut(CPDF_Point(rect.left, rect.bottom)); | 441 CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom)); |
442 CPDF_Point ptRightTop = InToOut(CPDF_Point(rect.right, rect.top)); | 442 CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(rect.right, rect.top)); |
443 | 443 |
444 return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); | 444 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, |
| 445 ptRightTop.y); |
445 } | 446 } |
446 | 447 |
447 CPDF_Rect CFX_ListCtrl::OutToIn(const CPDF_Rect& rect) const { | 448 CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { |
448 CPDF_Point ptLeftBottom = OutToIn(CPDF_Point(rect.left, rect.bottom)); | 449 CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom)); |
449 CPDF_Point ptRightTop = OutToIn(CPDF_Point(rect.right, rect.top)); | 450 CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top)); |
450 | 451 |
451 return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); | 452 return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, |
| 453 ptRightTop.y); |
452 } | 454 } |
453 | 455 |
454 void CFX_ListCtrl::OnMouseDown(const CPDF_Point& point, | 456 void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, |
455 FX_BOOL bShift, | 457 FX_BOOL bShift, |
456 FX_BOOL bCtrl) { | 458 FX_BOOL bCtrl) { |
457 int32_t nHitIndex = GetItemIndex(point); | 459 int32_t nHitIndex = GetItemIndex(point); |
458 | 460 |
459 if (IsMultipleSel()) { | 461 if (IsMultipleSel()) { |
460 if (bCtrl) { | 462 if (bCtrl) { |
461 if (IsItemSelected(nHitIndex)) { | 463 if (IsItemSelected(nHitIndex)) { |
462 m_aSelItems.Sub(nHitIndex); | 464 m_aSelItems.Sub(nHitIndex); |
463 SelectItems(); | 465 SelectItems(); |
464 m_bCtrlSel = FALSE; | 466 m_bCtrlSel = FALSE; |
(...skipping 18 matching lines...) Expand all Loading... |
483 | 485 |
484 SetCaret(nHitIndex); | 486 SetCaret(nHitIndex); |
485 } else { | 487 } else { |
486 SetSingleSelect(nHitIndex); | 488 SetSingleSelect(nHitIndex); |
487 } | 489 } |
488 | 490 |
489 if (!IsItemVisible(nHitIndex)) | 491 if (!IsItemVisible(nHitIndex)) |
490 ScrollToListItem(nHitIndex); | 492 ScrollToListItem(nHitIndex); |
491 } | 493 } |
492 | 494 |
493 void CFX_ListCtrl::OnMouseMove(const CPDF_Point& point, | 495 void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, |
494 FX_BOOL bShift, | 496 FX_BOOL bShift, |
495 FX_BOOL bCtrl) { | 497 FX_BOOL bCtrl) { |
496 int32_t nHitIndex = GetItemIndex(point); | 498 int32_t nHitIndex = GetItemIndex(point); |
497 | 499 |
498 if (IsMultipleSel()) { | 500 if (IsMultipleSel()) { |
499 if (bCtrl) { | 501 if (bCtrl) { |
500 if (m_bCtrlSel) | 502 if (m_bCtrlSel) |
501 m_aSelItems.Add(m_nFootIndex, nHitIndex); | 503 m_aSelItems.Add(m_nFootIndex, nHitIndex); |
502 else | 504 else |
503 m_aSelItems.Sub(m_nFootIndex, nHitIndex); | 505 m_aSelItems.Sub(m_nFootIndex, nHitIndex); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 int32_t nIndex = GetLastSelected(); | 573 int32_t nIndex = GetLastSelected(); |
572 int32_t nFindIndex = FindNext(nIndex, nChar); | 574 int32_t nFindIndex = FindNext(nIndex, nChar); |
573 | 575 |
574 if (nFindIndex != nIndex) { | 576 if (nFindIndex != nIndex) { |
575 OnVK(nFindIndex, bShift, bCtrl); | 577 OnVK(nFindIndex, bShift, bCtrl); |
576 return TRUE; | 578 return TRUE; |
577 } | 579 } |
578 return FALSE; | 580 return FALSE; |
579 } | 581 } |
580 | 582 |
581 void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) { | 583 void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { |
582 CFX_ListContainer::SetPlateRect(rect); | 584 CFX_ListContainer::SetPlateRect(rect); |
583 m_ptScrollPos.x = rect.left; | 585 m_ptScrollPos.x = rect.left; |
584 SetScrollPos(CPDF_Point(rect.left, rect.top)); | 586 SetScrollPos(CFX_FloatPoint(rect.left, rect.top)); |
585 ReArrange(0); | 587 ReArrange(0); |
586 InvalidateItem(-1); | 588 InvalidateItem(-1); |
587 } | 589 } |
588 | 590 |
589 CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { | 591 CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { |
590 return InToOut(CFX_List::GetItemRect(nIndex)); | 592 return InToOut(CFX_List::GetItemRect(nIndex)); |
591 } | 593 } |
592 | 594 |
593 void CFX_ListCtrl::AddString(const FX_WCHAR* string) { | 595 void CFX_ListCtrl::AddString(const FX_WCHAR* string) { |
594 AddItem(string); | 596 AddItem(string); |
595 ReArrange(GetCount() - 1); | 597 ReArrange(GetCount() - 1); |
596 } | 598 } |
597 | 599 |
598 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { | 600 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { |
599 if (!IsValid(nItemIndex)) | 601 if (!IsValid(nItemIndex)) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 InvalidateItem(nItemIndex); | 645 InvalidateItem(nItemIndex); |
644 } | 646 } |
645 } | 647 } |
646 } | 648 } |
647 | 649 |
648 void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { | 650 void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { |
649 if (m_pNotify) { | 651 if (m_pNotify) { |
650 if (nItemIndex == -1) { | 652 if (nItemIndex == -1) { |
651 if (!m_bNotifyFlag) { | 653 if (!m_bNotifyFlag) { |
652 m_bNotifyFlag = TRUE; | 654 m_bNotifyFlag = TRUE; |
653 CPDF_Rect rcRefresh = GetPlateRect(); | 655 CFX_FloatRect rcRefresh = GetPlateRect(); |
654 m_pNotify->IOnInvalidateRect(&rcRefresh); | 656 m_pNotify->IOnInvalidateRect(&rcRefresh); |
655 m_bNotifyFlag = FALSE; | 657 m_bNotifyFlag = FALSE; |
656 } | 658 } |
657 } else { | 659 } else { |
658 if (!m_bNotifyFlag) { | 660 if (!m_bNotifyFlag) { |
659 m_bNotifyFlag = TRUE; | 661 m_bNotifyFlag = TRUE; |
660 CPDF_Rect rcRefresh = GetItemRect(nItemIndex); | 662 CFX_FloatRect rcRefresh = GetItemRect(nItemIndex); |
661 rcRefresh.left -= 1.0f; | 663 rcRefresh.left -= 1.0f; |
662 rcRefresh.right += 1.0f; | 664 rcRefresh.right += 1.0f; |
663 rcRefresh.bottom -= 1.0f; | 665 rcRefresh.bottom -= 1.0f; |
664 rcRefresh.top += 1.0f; | 666 rcRefresh.top += 1.0f; |
665 | 667 |
666 m_pNotify->IOnInvalidateRect(&rcRefresh); | 668 m_pNotify->IOnInvalidateRect(&rcRefresh); |
667 m_bNotifyFlag = FALSE; | 669 m_bNotifyFlag = FALSE; |
668 } | 670 } |
669 } | 671 } |
670 } | 672 } |
(...skipping 23 matching lines...) Expand all Loading... |
694 | 696 |
695 if (IsMultipleSel()) { | 697 if (IsMultipleSel()) { |
696 m_aSelItems.Add(nItemIndex); | 698 m_aSelItems.Add(nItemIndex); |
697 SelectItems(); | 699 SelectItems(); |
698 } else { | 700 } else { |
699 SetSingleSelect(nItemIndex); | 701 SetSingleSelect(nItemIndex); |
700 } | 702 } |
701 } | 703 } |
702 | 704 |
703 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { | 705 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { |
704 CPDF_Rect rcPlate = GetPlateRect(); | 706 CFX_FloatRect rcPlate = GetPlateRect(); |
705 CPDF_Rect rcItem = GetItemRect(nItemIndex); | 707 CFX_FloatRect rcItem = GetItemRect(nItemIndex); |
706 | 708 |
707 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; | 709 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; |
708 } | 710 } |
709 | 711 |
710 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { | 712 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { |
711 if (!IsValid(nItemIndex)) | 713 if (!IsValid(nItemIndex)) |
712 return; | 714 return; |
713 | 715 |
714 CPDF_Rect rcPlate = GetPlateRect(); | 716 CFX_FloatRect rcPlate = GetPlateRect(); |
715 CPDF_Rect rcItem = CFX_List::GetItemRect(nItemIndex); | 717 CFX_FloatRect rcItem = CFX_List::GetItemRect(nItemIndex); |
716 CPDF_Rect rcItemCtrl = GetItemRect(nItemIndex); | 718 CFX_FloatRect rcItemCtrl = GetItemRect(nItemIndex); |
717 | 719 |
718 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom)) { | 720 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom)) { |
719 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top)) { | 721 if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top)) { |
720 SetScrollPosY(rcItem.bottom + rcPlate.Height()); | 722 SetScrollPosY(rcItem.bottom + rcPlate.Height()); |
721 } | 723 } |
722 } else if (FX_EDIT_IsFloatBigger(rcItemCtrl.top, rcPlate.top)) { | 724 } else if (FX_EDIT_IsFloatBigger(rcItemCtrl.top, rcPlate.top)) { |
723 if (FX_EDIT_IsFloatBigger(rcItemCtrl.bottom, rcPlate.bottom)) { | 725 if (FX_EDIT_IsFloatBigger(rcItemCtrl.bottom, rcPlate.bottom)) { |
724 SetScrollPosY(rcItem.top); | 726 SetScrollPosY(rcItem.top); |
725 } | 727 } |
726 } | 728 } |
727 } | 729 } |
728 | 730 |
729 void CFX_ListCtrl::SetScrollInfo() { | 731 void CFX_ListCtrl::SetScrollInfo() { |
730 if (m_pNotify) { | 732 if (m_pNotify) { |
731 CPDF_Rect rcPlate = GetPlateRect(); | 733 CFX_FloatRect rcPlate = GetPlateRect(); |
732 CPDF_Rect rcContent = CFX_List::GetContentRect(); | 734 CFX_FloatRect rcContent = CFX_List::GetContentRect(); |
733 | 735 |
734 if (!m_bNotifyFlag) { | 736 if (!m_bNotifyFlag) { |
735 m_bNotifyFlag = TRUE; | 737 m_bNotifyFlag = TRUE; |
736 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, | 738 m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, |
737 rcContent.bottom, rcContent.top, | 739 rcContent.bottom, rcContent.top, |
738 GetFirstHeight(), rcPlate.Height()); | 740 GetFirstHeight(), rcPlate.Height()); |
739 m_bNotifyFlag = FALSE; | 741 m_bNotifyFlag = FALSE; |
740 } | 742 } |
741 } | 743 } |
742 } | 744 } |
743 | 745 |
744 void CFX_ListCtrl::SetScrollPos(const CPDF_Point& point) { | 746 void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { |
745 SetScrollPosY(point.y); | 747 SetScrollPosY(point.y); |
746 } | 748 } |
747 | 749 |
748 void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { | 750 void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { |
749 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) { | 751 if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) { |
750 CPDF_Rect rcPlate = GetPlateRect(); | 752 CFX_FloatRect rcPlate = GetPlateRect(); |
751 CPDF_Rect rcContent = CFX_List::GetContentRect(); | 753 CFX_FloatRect rcContent = CFX_List::GetContentRect(); |
752 | 754 |
753 if (rcPlate.Height() > rcContent.Height()) { | 755 if (rcPlate.Height() > rcContent.Height()) { |
754 fy = rcPlate.top; | 756 fy = rcPlate.top; |
755 } else { | 757 } else { |
756 if (FX_EDIT_IsFloatSmaller(fy - rcPlate.Height(), rcContent.bottom)) { | 758 if (FX_EDIT_IsFloatSmaller(fy - rcPlate.Height(), rcContent.bottom)) { |
757 fy = rcContent.bottom + rcPlate.Height(); | 759 fy = rcContent.bottom + rcPlate.Height(); |
758 } else if (FX_EDIT_IsFloatBigger(fy, rcContent.top)) { | 760 } else if (FX_EDIT_IsFloatBigger(fy, rcContent.top)) { |
759 fy = rcContent.top; | 761 fy = rcContent.top; |
760 } | 762 } |
761 } | 763 } |
762 | 764 |
763 m_ptScrollPos.y = fy; | 765 m_ptScrollPos.y = fy; |
764 InvalidateItem(-1); | 766 InvalidateItem(-1); |
765 | 767 |
766 if (m_pNotify) { | 768 if (m_pNotify) { |
767 if (!m_bNotifyFlag) { | 769 if (!m_bNotifyFlag) { |
768 m_bNotifyFlag = TRUE; | 770 m_bNotifyFlag = TRUE; |
769 m_pNotify->IOnSetScrollPosY(fy); | 771 m_pNotify->IOnSetScrollPosY(fy); |
770 m_bNotifyFlag = FALSE; | 772 m_bNotifyFlag = FALSE; |
771 } | 773 } |
772 } | 774 } |
773 } | 775 } |
774 } | 776 } |
775 | 777 |
776 CPDF_Rect CFX_ListCtrl::GetContentRect() const { | 778 CFX_FloatRect CFX_ListCtrl::GetContentRect() const { |
777 return InToOut(CFX_List::GetContentRect()); | 779 return InToOut(CFX_List::GetContentRect()); |
778 } | 780 } |
779 | 781 |
780 void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { | 782 void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { |
781 CFX_List::ReArrange(nItemIndex); | 783 CFX_List::ReArrange(nItemIndex); |
782 SetScrollInfo(); | 784 SetScrollInfo(); |
783 } | 785 } |
784 | 786 |
785 void CFX_ListCtrl::SetTopItem(int32_t nIndex) { | 787 void CFX_ListCtrl::SetTopItem(int32_t nIndex) { |
786 if (IsValid(nIndex)) { | 788 if (IsValid(nIndex)) { |
787 GetPlateRect(); | 789 GetPlateRect(); |
788 CPDF_Rect rcItem = CFX_List::GetItemRect(nIndex); | 790 CFX_FloatRect rcItem = CFX_List::GetItemRect(nIndex); |
789 SetScrollPosY(rcItem.top); | 791 SetScrollPosY(rcItem.top); |
790 } | 792 } |
791 } | 793 } |
792 | 794 |
793 int32_t CFX_ListCtrl::GetTopItem() const { | 795 int32_t CFX_ListCtrl::GetTopItem() const { |
794 int32_t nItemIndex = GetItemIndex(GetBTPoint()); | 796 int32_t nItemIndex = GetItemIndex(GetBTPoint()); |
795 | 797 |
796 if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) | 798 if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) |
797 nItemIndex += 1; | 799 nItemIndex += 1; |
798 | 800 |
799 return nItemIndex; | 801 return nItemIndex; |
800 } | 802 } |
801 | 803 |
802 void CFX_ListCtrl::Empty() { | 804 void CFX_ListCtrl::Empty() { |
803 CFX_List::Empty(); | 805 CFX_List::Empty(); |
804 InvalidateItem(-1); | 806 InvalidateItem(-1); |
805 } | 807 } |
806 | 808 |
807 void CFX_ListCtrl::Cancel() { | 809 void CFX_ListCtrl::Cancel() { |
808 m_aSelItems.DeselectAll(); | 810 m_aSelItems.DeselectAll(); |
809 } | 811 } |
810 | 812 |
811 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const { | 813 int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { |
812 return CFX_List::GetItemIndex(OutToIn(point)); | 814 return CFX_List::GetItemIndex(OutToIn(point)); |
813 } | 815 } |
814 | 816 |
815 CFX_WideString CFX_ListCtrl::GetText() const { | 817 CFX_WideString CFX_ListCtrl::GetText() const { |
816 if (IsMultipleSel()) | 818 if (IsMultipleSel()) |
817 return GetItemText(m_nCaretIndex); | 819 return GetItemText(m_nCaretIndex); |
818 return GetItemText(m_nSelItem); | 820 return GetItemText(m_nSelItem); |
819 } | 821 } |
OLD | NEW |