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/fxedit/include/fxet_list.h" | 7 #include "fpdfsdk/fxedit/include/fxet_list.h" |
8 | 8 |
9 #include "core/fpdfdoc/include/cpvt_word.h" | 9 #include "core/fpdfdoc/include/cpvt_word.h" |
10 #include "fpdfsdk/fxedit/include/fxet_edit.h" | 10 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 FX_BOOL CFX_ListItem::IsSelected() const { | 44 FX_BOOL CFX_ListItem::IsSelected() const { |
45 return m_bSelected; | 45 return m_bSelected; |
46 } | 46 } |
47 | 47 |
48 void CFX_ListItem::SetSelect(FX_BOOL bSelected) { | 48 void CFX_ListItem::SetSelect(FX_BOOL bSelected) { |
49 m_bSelected = bSelected; | 49 m_bSelected = bSelected; |
50 } | 50 } |
51 | 51 |
52 void CFX_ListItem::SetText(const FX_WCHAR* text) { | 52 void CFX_ListItem::SetText(const CFX_WideString& text) { |
53 m_pEdit->SetText(text); | 53 m_pEdit->SetText(text); |
54 } | 54 } |
55 | 55 |
56 void CFX_ListItem::SetFontSize(FX_FLOAT fFontSize) { | 56 void CFX_ListItem::SetFontSize(FX_FLOAT fFontSize) { |
57 m_pEdit->SetFontSize(fFontSize); | 57 m_pEdit->SetFontSize(fFontSize); |
58 } | 58 } |
59 | 59 |
60 FX_FLOAT CFX_ListItem::GetItemHeight() const { | 60 FX_FLOAT CFX_ListItem::GetItemHeight() const { |
61 return m_pEdit->GetContentRect().Height(); | 61 return m_pEdit->GetContentRect().Height(); |
62 } | 62 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 int32_t CFX_ListCtrl::GetCaret() const { | 391 int32_t CFX_ListCtrl::GetCaret() const { |
392 return m_nCaretIndex; | 392 return m_nCaretIndex; |
393 } | 393 } |
394 | 394 |
395 int32_t CFX_ListCtrl::GetSelect() const { | 395 int32_t CFX_ListCtrl::GetSelect() const { |
396 return m_nSelItem; | 396 return m_nSelItem; |
397 } | 397 } |
398 | 398 |
399 void CFX_ListCtrl::AddString(const FX_WCHAR* str) { | 399 void CFX_ListCtrl::AddString(const CFX_WideString& str) { |
400 AddItem(str); | 400 AddItem(str); |
401 ReArrange(GetCount() - 1); | 401 ReArrange(GetCount() - 1); |
402 } | 402 } |
403 | 403 |
404 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { | 404 void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { |
405 if (!IsValid(nItemIndex)) | 405 if (!IsValid(nItemIndex)) |
406 return; | 406 return; |
407 | 407 |
408 if (bSelected != IsItemSelected(nItemIndex)) { | 408 if (bSelected != IsItemSelected(nItemIndex)) { |
409 if (bSelected) { | 409 if (bSelected) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 | 671 |
672 void CFX_ListCtrl::SetFontMap(IPVT_FontMap* pFontMap) { | 672 void CFX_ListCtrl::SetFontMap(IPVT_FontMap* pFontMap) { |
673 m_pFontMap = pFontMap; | 673 m_pFontMap = pFontMap; |
674 } | 674 } |
675 | 675 |
676 void CFX_ListCtrl::SetFontSize(FX_FLOAT fFontSize) { | 676 void CFX_ListCtrl::SetFontSize(FX_FLOAT fFontSize) { |
677 m_fFontSize = fFontSize; | 677 m_fFontSize = fFontSize; |
678 } | 678 } |
679 | 679 |
680 void CFX_ListCtrl::AddItem(const FX_WCHAR* str) { | 680 void CFX_ListCtrl::AddItem(const CFX_WideString& str) { |
681 CFX_ListItem* pListItem = new CFX_ListItem(); | 681 CFX_ListItem* pListItem = new CFX_ListItem(); |
682 pListItem->SetFontMap(m_pFontMap); | 682 pListItem->SetFontMap(m_pFontMap); |
683 pListItem->SetFontSize(m_fFontSize); | 683 pListItem->SetFontSize(m_fFontSize); |
684 pListItem->SetText(str); | 684 pListItem->SetText(str); |
685 m_aListItems.Add(pListItem); | 685 m_aListItems.Add(pListItem); |
686 } | 686 } |
687 | 687 |
688 CFX_Edit* CFX_ListCtrl::GetItemEdit(int32_t nIndex) const { | 688 CFX_Edit* CFX_ListCtrl::GetItemEdit(int32_t nIndex) const { |
689 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { | 689 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { |
690 return pListItem->GetEdit(); | 690 return pListItem->GetEdit(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize(); | 780 return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize(); |
781 } | 781 } |
782 | 782 |
783 CFX_WideString CFX_ListCtrl::GetItemText(int32_t nIndex) const { | 783 CFX_WideString CFX_ListCtrl::GetItemText(int32_t nIndex) const { |
784 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { | 784 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { |
785 return pListItem->GetText(); | 785 return pListItem->GetText(); |
786 } | 786 } |
787 | 787 |
788 return L""; | 788 return L""; |
789 } | 789 } |
OLD | NEW |