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/include/fwl/lightwidget/listbox.h" | 7 #include "xfa/include/fwl/lightwidget/listbox.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 156 matching lines...) Loading... |
167 } | 167 } |
168 CFX_RectF rtItem; | 168 CFX_RectF rtItem; |
169 m_ListBoxDP.GetItemRect(NULL, hItem, rtItem); | 169 m_ListBoxDP.GetItemRect(NULL, hItem, rtItem); |
170 rtItem.Offset(-fPosX, -fPosY); | 170 rtItem.Offset(-fPosX, -fPosY); |
171 if (rtItem.Contains(fx, fy)) { | 171 if (rtItem.Contains(fx, fy)) { |
172 return hItem; | 172 return hItem; |
173 } | 173 } |
174 } | 174 } |
175 return NULL; | 175 return NULL; |
176 } | 176 } |
177 FX_DWORD CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) { | 177 uint32_t CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) { |
178 if (!hItem) | 178 if (!hItem) |
179 return 0; | 179 return 0; |
180 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); | 180 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); |
181 return pItem->m_dwStates | pItem->m_dwCheckState; | 181 return pItem->m_dwStates | pItem->m_dwCheckState; |
182 } | 182 } |
183 CFWL_ListBox::CFWL_ListBox() {} | 183 CFWL_ListBox::CFWL_ListBox() {} |
184 CFWL_ListBox::~CFWL_ListBox() {} | 184 CFWL_ListBox::~CFWL_ListBox() {} |
185 CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {} | 185 CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {} |
186 CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {} | 186 CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {} |
187 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget, | 187 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget, |
(...skipping 21 matching lines...) Loading... |
209 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; | 209 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; |
210 } | 210 } |
211 FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, | 211 FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, |
212 FWL_HLISTITEM hItem, | 212 FWL_HLISTITEM hItem, |
213 int32_t nIndex) { | 213 int32_t nIndex) { |
214 if (nIndex < 0 || nIndex >= CountItems(pWidget)) | 214 if (nIndex < 0 || nIndex >= CountItems(pWidget)) |
215 return FALSE; | 215 return FALSE; |
216 m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ListItem*>(hItem)); | 216 m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ListItem*>(hItem)); |
217 return TRUE; | 217 return TRUE; |
218 } | 218 } |
219 FX_DWORD CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget, | 219 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget, |
220 FWL_HLISTITEM hItem) { | 220 FWL_HLISTITEM hItem) { |
221 if (!hItem) | 221 if (!hItem) |
222 return -1; | 222 return -1; |
223 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates; | 223 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates; |
224 } | 224 } |
225 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget, | 225 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget, |
226 FWL_HLISTITEM hItem, | 226 FWL_HLISTITEM hItem, |
227 CFX_WideString& wsText) { | 227 CFX_WideString& wsText) { |
228 if (!hItem) | 228 if (!hItem) |
229 return FWL_ERR_Indefinite; | 229 return FWL_ERR_Indefinite; |
(...skipping 11 matching lines...) Loading... |
241 } | 241 } |
242 void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, | 242 void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, |
243 FWL_HLISTITEM hItem) { | 243 FWL_HLISTITEM hItem) { |
244 if (!hItem) | 244 if (!hItem) |
245 return NULL; | 245 return NULL; |
246 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); | 246 CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); |
247 return pItem->m_pData; | 247 return pItem->m_pData; |
248 } | 248 } |
249 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, | 249 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, |
250 FWL_HLISTITEM hItem, | 250 FWL_HLISTITEM hItem, |
251 FX_DWORD dwStyle) { | 251 uint32_t dwStyle) { |
252 if (!hItem) | 252 if (!hItem) |
253 return FWL_ERR_Indefinite; | 253 return FWL_ERR_Indefinite; |
254 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle; | 254 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle; |
255 return FWL_ERR_Succeeded; | 255 return FWL_ERR_Succeeded; |
256 } | 256 } |
257 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget, | 257 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget, |
258 FWL_HLISTITEM hItem, | 258 FWL_HLISTITEM hItem, |
259 const FX_WCHAR* pszText) { | 259 const FX_WCHAR* pszText) { |
260 if (!hItem) | 260 if (!hItem) |
261 return FWL_ERR_Indefinite; | 261 return FWL_ERR_Indefinite; |
(...skipping 21 matching lines...) Loading... |
283 rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox; | 283 rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox; |
284 return FWL_ERR_Succeeded; | 284 return FWL_ERR_Succeeded; |
285 } | 285 } |
286 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect( | 286 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect( |
287 IFWL_Widget* pWidget, | 287 IFWL_Widget* pWidget, |
288 FWL_HLISTITEM hItem, | 288 FWL_HLISTITEM hItem, |
289 const CFX_RectF& rtCheck) { | 289 const CFX_RectF& rtCheck) { |
290 reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck; | 290 reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck; |
291 return FWL_ERR_Succeeded; | 291 return FWL_ERR_Succeeded; |
292 } | 292 } |
293 FX_DWORD CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget, | 293 uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget, |
294 FWL_HLISTITEM hItem) { | 294 FWL_HLISTITEM hItem) { |
295 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState; | 295 return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState; |
296 } | 296 } |
297 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget, | 297 FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget, |
298 FWL_HLISTITEM hItem, | 298 FWL_HLISTITEM hItem, |
299 FX_DWORD dwCheckState) { | 299 uint32_t dwCheckState) { |
300 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState; | 300 reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState; |
301 return FWL_ERR_Succeeded; | 301 return FWL_ERR_Succeeded; |
302 } | 302 } |
OLD | NEW |