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_combobox.h" | 7 #include "xfa/fwl/core/cfwl_combobox.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return true; | 274 return true; |
275 } | 275 } |
276 | 276 |
277 uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget, | 277 uint32_t CFWL_ComboBox::GetItemStyles(IFWL_Widget* pWidget, |
278 CFWL_ListItem* pItem) { | 278 CFWL_ListItem* pItem) { |
279 if (!pItem) | 279 if (!pItem) |
280 return 0; | 280 return 0; |
281 return static_cast<CFWL_ListItem*>(pItem)->m_dwStyles; | 281 return static_cast<CFWL_ListItem*>(pItem)->m_dwStyles; |
282 } | 282 } |
283 | 283 |
284 FWL_Error CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget, | 284 void CFWL_ComboBox::GetItemText(IFWL_Widget* pWidget, |
285 CFWL_ListItem* pItem, | 285 CFWL_ListItem* pItem, |
286 CFX_WideString& wsText) { | 286 CFX_WideString& wsText) { |
287 if (!pItem) | 287 if (pItem) |
288 return FWL_Error::Indefinite; | 288 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; |
289 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText; | |
290 return FWL_Error::Succeeded; | |
291 } | 289 } |
292 | 290 |
293 FWL_Error CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget, | 291 void CFWL_ComboBox::GetItemRect(IFWL_Widget* pWidget, |
294 CFWL_ListItem* pItem, | 292 CFWL_ListItem* pItem, |
295 CFX_RectF& rtItem) { | 293 CFX_RectF& rtItem) { |
296 if (!pItem) | 294 if (!pItem) |
297 return FWL_Error::Indefinite; | 295 return; |
298 CFWL_ListItem* pComboItem = static_cast<CFWL_ListItem*>(pItem); | 296 CFWL_ListItem* pComboItem = static_cast<CFWL_ListItem*>(pItem); |
299 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, | 297 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, |
300 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); | 298 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); |
301 return FWL_Error::Succeeded; | |
302 } | 299 } |
303 | 300 |
304 void* CFWL_ComboBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { | 301 void* CFWL_ComboBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { |
305 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; | 302 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; |
306 } | 303 } |
307 | 304 |
308 FWL_Error CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget, | 305 void CFWL_ComboBox::SetItemStyles(IFWL_Widget* pWidget, |
309 CFWL_ListItem* pItem, | 306 CFWL_ListItem* pItem, |
310 uint32_t dwStyle) { | 307 uint32_t dwStyle) { |
311 if (!pItem) | 308 if (pItem) |
312 return FWL_Error::Indefinite; | 309 static_cast<CFWL_ListItem*>(pItem)->m_dwStyles = dwStyle; |
313 static_cast<CFWL_ListItem*>(pItem)->m_dwStyles = dwStyle; | |
314 return FWL_Error::Succeeded; | |
315 } | 310 } |
316 | 311 |
317 FWL_Error CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget, | 312 void CFWL_ComboBox::SetItemText(IFWL_Widget* pWidget, |
318 CFWL_ListItem* pItem, | 313 CFWL_ListItem* pItem, |
319 const FX_WCHAR* pszText) { | 314 const FX_WCHAR* pszText) { |
320 if (!pItem) | 315 if (pItem) |
321 return FWL_Error::Indefinite; | 316 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText; |
322 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText; | |
323 return FWL_Error::Succeeded; | |
324 } | 317 } |
325 | 318 |
326 FWL_Error CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget, | 319 void CFWL_ComboBox::SetItemRect(IFWL_Widget* pWidget, |
327 CFWL_ListItem* pItem, | 320 CFWL_ListItem* pItem, |
328 const CFX_RectF& rtItem) { | 321 const CFX_RectF& rtItem) { |
329 if (!pItem) | 322 if (pItem) |
330 return FWL_Error::Indefinite; | 323 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem; |
331 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem; | |
332 return FWL_Error::Succeeded; | |
333 } | 324 } |
334 | 325 |
335 FX_FLOAT CFWL_ComboBox::GetItemHeight(IFWL_Widget* pWidget) { | 326 FX_FLOAT CFWL_ComboBox::GetItemHeight(IFWL_Widget* pWidget) { |
336 return m_fItemHeight; | 327 return m_fItemHeight; |
337 } | 328 } |
338 | 329 |
339 CFX_DIBitmap* CFWL_ComboBox::GetItemIcon(IFWL_Widget* pWidget, | 330 CFX_DIBitmap* CFWL_ComboBox::GetItemIcon(IFWL_Widget* pWidget, |
340 CFWL_ListItem* pItem) { | 331 CFWL_ListItem* pItem) { |
341 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pDIB : nullptr; | 332 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pDIB : nullptr; |
342 } | 333 } |
343 | 334 |
344 FWL_Error CFWL_ComboBox::GetItemCheckRect(IFWL_Widget* pWidget, | 335 void CFWL_ComboBox::GetItemCheckRect(IFWL_Widget* pWidget, |
345 CFWL_ListItem* pItem, | 336 CFWL_ListItem* pItem, |
346 CFX_RectF& rtCheck) { | 337 CFX_RectF& rtCheck) { |
347 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox; | 338 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox; |
348 return FWL_Error::Succeeded; | |
349 } | 339 } |
350 | 340 |
351 FWL_Error CFWL_ComboBox::SetItemCheckRect(IFWL_Widget* pWidget, | 341 void CFWL_ComboBox::SetItemCheckRect(IFWL_Widget* pWidget, |
352 CFWL_ListItem* pItem, | 342 CFWL_ListItem* pItem, |
353 const CFX_RectF& rtCheck) { | 343 const CFX_RectF& rtCheck) { |
354 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck; | 344 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck; |
355 return FWL_Error::Succeeded; | |
356 } | 345 } |
357 | 346 |
358 uint32_t CFWL_ComboBox::GetItemCheckState(IFWL_Widget* pWidget, | 347 uint32_t CFWL_ComboBox::GetItemCheckState(IFWL_Widget* pWidget, |
359 CFWL_ListItem* pItem) { | 348 CFWL_ListItem* pItem) { |
360 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; | 349 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; |
361 } | 350 } |
362 | 351 |
363 FWL_Error CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget, | 352 void CFWL_ComboBox::SetItemCheckState(IFWL_Widget* pWidget, |
364 CFWL_ListItem* pItem, | 353 CFWL_ListItem* pItem, |
365 uint32_t dwCheckState) { | 354 uint32_t dwCheckState) { |
366 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; | 355 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; |
367 return FWL_Error::Succeeded; | |
368 } | 356 } |
369 | 357 |
370 FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) { | 358 FX_FLOAT CFWL_ComboBox::GetListHeight(IFWL_Widget* pWidget) { |
371 return m_fMaxListHeight; | 359 return m_fMaxListHeight; |
372 } | 360 } |
OLD | NEW |