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 "../../include/fxedit/fxet_stub.h" | 7 #include "../../include/fxedit/fxet_stub.h" |
8 #include "../../include/fxedit/fxet_edit.h" | 8 #include "../../include/fxedit/fxet_edit.h" |
9 #include "../../include/fxedit/fxet_list.h" | 9 #include "../../include/fxedit/fxet_list.h" |
10 | 10 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void CFX_List::SetFontMap(IFX_Edit_FontMap* pFontMap) { | 122 void CFX_List::SetFontMap(IFX_Edit_FontMap* pFontMap) { |
123 m_pFontMap = pFontMap; | 123 m_pFontMap = pFontMap; |
124 } | 124 } |
125 | 125 |
126 void CFX_List::SetFontSize(FX_FLOAT fFontSize) { | 126 void CFX_List::SetFontSize(FX_FLOAT fFontSize) { |
127 m_fFontSize = fFontSize; | 127 m_fFontSize = fFontSize; |
128 } | 128 } |
129 | 129 |
130 void CFX_List::AddItem(const FX_WCHAR* str) { | 130 void CFX_List::AddItem(const FX_WCHAR* str) { |
131 if (CFX_ListItem* pListItem = new CFX_ListItem()) { | 131 CFX_ListItem* pListItem = new CFX_ListItem(); |
132 pListItem->SetFontMap(m_pFontMap); | 132 pListItem->SetFontMap(m_pFontMap); |
133 pListItem->SetFontSize(m_fFontSize); | 133 pListItem->SetFontSize(m_fFontSize); |
134 pListItem->SetText(str); | 134 pListItem->SetText(str); |
135 m_aListItems.Add(pListItem); | 135 m_aListItems.Add(pListItem); |
136 } | |
137 } | 136 } |
138 | 137 |
139 void CFX_List::ReArrange(int32_t nItemIndex) { | 138 void CFX_List::ReArrange(int32_t nItemIndex) { |
140 FX_FLOAT fPosY = 0.0f; | 139 FX_FLOAT fPosY = 0.0f; |
141 | 140 |
142 if (CFX_ListItem* pPrevItem = m_aListItems.GetAt(nItemIndex - 1)) | 141 if (CFX_ListItem* pPrevItem = m_aListItems.GetAt(nItemIndex - 1)) |
143 fPosY = pPrevItem->GetRect().bottom; | 142 fPosY = pPrevItem->GetRect().bottom; |
144 | 143 |
145 for (int32_t i = nItemIndex, sz = m_aListItems.GetSize(); i < sz; i++) { | 144 for (int32_t i = nItemIndex, sz = m_aListItems.GetSize(); i < sz; i++) { |
146 if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { | 145 if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 826 |
828 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const { | 827 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const { |
829 return CFX_List::GetItemIndex(OutToIn(point)); | 828 return CFX_List::GetItemIndex(OutToIn(point)); |
830 } | 829 } |
831 | 830 |
832 CFX_WideString CFX_ListCtrl::GetText() const { | 831 CFX_WideString CFX_ListCtrl::GetText() const { |
833 if (IsMultipleSel()) | 832 if (IsMultipleSel()) |
834 return GetItemText(m_nCaretIndex); | 833 return GetItemText(m_nCaretIndex); |
835 return GetItemText(m_nSelItem); | 834 return GetItemText(m_nSelItem); |
836 } | 835 } |
OLD | NEW |