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 "xfa/fwl/core/cfwl_listbox.h" | 7 #include "xfa/fwl/core/cfwl_listbox.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 75 |
76 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { | 76 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { |
77 return GetWidget() ? ToListBox(GetWidget())->GetSelIndex(nIndex) : 0; | 77 return GetWidget() ? ToListBox(GetWidget())->GetSelIndex(nIndex) : 0; |
78 } | 78 } |
79 | 79 |
80 void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) { | 80 void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) { |
81 if (GetWidget()) | 81 if (GetWidget()) |
82 ToListBox(GetWidget())->SetSelItem(pItem, bSelect); | 82 ToListBox(GetWidget())->SetSelItem(pItem, bSelect); |
83 } | 83 } |
84 | 84 |
85 void CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { | 85 void CFWL_ListBox::GetItemText(IFWL_Widget* pWidget, |
npm
2016/11/22 16:36:16
Widget not being used in this method
dsinclair
2016/11/22 16:42:15
It isn't being used in a bunch of methods. I'm goi
| |
86 if (GetWidget()) | 86 CFWL_ListItem* pItem, |
87 ToListBox(GetWidget())->GetItemText(pItem, wsText); | 87 CFX_WideString& wsText) { |
88 } | 88 if (pItem) |
89 | 89 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; |
90 CFWL_ListItem* CFWL_ListBox::GetItem(int32_t nIndex) { | |
91 if (nIndex < 0 || nIndex >= CountItems(nullptr)) | |
92 return nullptr; | |
93 return m_ItemArray[nIndex].get(); | |
94 } | 90 } |
95 | 91 |
96 uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { | 92 uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { |
97 if (!pItem) | 93 if (!pItem) |
98 return 0; | 94 return 0; |
99 return pItem->m_dwStates | pItem->m_dwCheckState; | 95 return pItem->m_dwStates | pItem->m_dwCheckState; |
100 } | 96 } |
101 | 97 |
102 int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) const { | 98 int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) const { |
103 return pdfium::CollectionSize<int32_t>(m_ItemArray); | 99 return pdfium::CollectionSize<int32_t>(m_ItemArray); |
(...skipping 13 matching lines...) Expand all Loading... | |
117 return candidate.get() == static_cast<CFWL_ListItem*>(pItem); | 113 return candidate.get() == static_cast<CFWL_ListItem*>(pItem); |
118 }); | 114 }); |
119 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; | 115 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; |
120 } | 116 } |
121 | 117 |
122 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget, | 118 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget, |
123 CFWL_ListItem* pItem) { | 119 CFWL_ListItem* pItem) { |
124 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_dwStates : 0; | 120 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_dwStates : 0; |
125 } | 121 } |
126 | 122 |
127 void CFWL_ListBox::GetItemText(IFWL_Widget* pWidget, | |
128 CFWL_ListItem* pItem, | |
129 CFX_WideString& wsText) { | |
130 if (pItem) | |
131 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; | |
132 } | |
133 | |
134 void CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget, | 123 void CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget, |
135 CFWL_ListItem* pItem, | 124 CFWL_ListItem* pItem, |
136 CFX_RectF& rtItem) { | 125 CFX_RectF& rtItem) { |
137 if (pItem) | 126 if (pItem) |
138 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem; | 127 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem; |
139 } | 128 } |
140 | 129 |
141 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { | 130 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { |
142 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; | 131 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; |
143 } | 132 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, | 165 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, |
177 CFWL_ListItem* pItem) { | 166 CFWL_ListItem* pItem) { |
178 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; | 167 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; |
179 } | 168 } |
180 | 169 |
181 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, | 170 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, |
182 CFWL_ListItem* pItem, | 171 CFWL_ListItem* pItem, |
183 uint32_t dwCheckState) { | 172 uint32_t dwCheckState) { |
184 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; | 173 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; |
185 } | 174 } |
OLD | NEW |