| 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/lightwidget/cfwl_combobox.h" | 7 #include "xfa/fwl/lightwidget/cfwl_combobox.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (!pItem) | 163 if (!pItem) |
| 164 return FWL_Error::Indefinite; | 164 return FWL_Error::Indefinite; |
| 165 pItem->m_pData = pData; | 165 pItem->m_pData = pData; |
| 166 return FWL_Error::Succeeded; | 166 return FWL_Error::Succeeded; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { | 169 void* CFWL_ComboBox::GetItemData(int32_t iIndex) { |
| 170 CFWL_ComboBoxItem* pItem = | 170 CFWL_ComboBoxItem* pItem = |
| 171 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); | 171 static_cast<CFWL_ComboBoxItem*>(m_comboBoxData.GetItem(m_pIface, iIndex)); |
| 172 if (!pItem) | 172 if (!pItem) |
| 173 return NULL; | 173 return nullptr; |
| 174 return pItem->m_pData; | 174 return pItem->m_pData; |
| 175 } | 175 } |
| 176 | 176 |
| 177 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { | 177 FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { |
| 178 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( | 178 return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( |
| 179 pTheme); | 179 pTheme); |
| 180 } | 180 } |
| 181 | 181 |
| 182 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { | 182 FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { |
| 183 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); | 183 return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 if (!pItem) | 344 if (!pItem) |
| 345 return FWL_Error::Indefinite; | 345 return FWL_Error::Indefinite; |
| 346 CFWL_ComboBoxItem* pComboItem = static_cast<CFWL_ComboBoxItem*>(pItem); | 346 CFWL_ComboBoxItem* pComboItem = static_cast<CFWL_ComboBoxItem*>(pItem); |
| 347 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, | 347 rtItem.Set(pComboItem->m_rtItem.left, pComboItem->m_rtItem.top, |
| 348 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); | 348 pComboItem->m_rtItem.width, pComboItem->m_rtItem.height); |
| 349 return FWL_Error::Succeeded; | 349 return FWL_Error::Succeeded; |
| 350 } | 350 } |
| 351 | 351 |
| 352 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, | 352 void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, |
| 353 IFWL_ListItem* pItem) { | 353 IFWL_ListItem* pItem) { |
| 354 if (!pItem) | 354 return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pData : nullptr; |
| 355 return NULL; | |
| 356 return static_cast<CFWL_ComboBoxItem*>(pItem)->m_pData; | |
| 357 } | 355 } |
| 358 | 356 |
| 359 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, | 357 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, |
| 360 IFWL_ListItem* pItem, | 358 IFWL_ListItem* pItem, |
| 361 uint32_t dwStyle) { | 359 uint32_t dwStyle) { |
| 362 if (!pItem) | 360 if (!pItem) |
| 363 return FWL_Error::Indefinite; | 361 return FWL_Error::Indefinite; |
| 364 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles = dwStyle; | 362 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwStyles = dwStyle; |
| 365 return FWL_Error::Succeeded; | 363 return FWL_Error::Succeeded; |
| 366 } | 364 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 383 return FWL_Error::Succeeded; | 381 return FWL_Error::Succeeded; |
| 384 } | 382 } |
| 385 | 383 |
| 386 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { | 384 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { |
| 387 return m_fItemHeight; | 385 return m_fItemHeight; |
| 388 } | 386 } |
| 389 | 387 |
| 390 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( | 388 CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon( |
| 391 IFWL_Widget* pWidget, | 389 IFWL_Widget* pWidget, |
| 392 IFWL_ListItem* pItem) { | 390 IFWL_ListItem* pItem) { |
| 393 if (!pItem) | 391 return pItem ? static_cast<CFWL_ComboBoxItem*>(pItem)->m_pDIB : nullptr; |
| 394 return NULL; | |
| 395 return static_cast<CFWL_ComboBoxItem*>(pItem)->m_pDIB; | |
| 396 } | 392 } |
| 397 | 393 |
| 398 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, | 394 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, |
| 399 IFWL_ListItem* pItem, | 395 IFWL_ListItem* pItem, |
| 400 CFX_RectF& rtCheck) { | 396 CFX_RectF& rtCheck) { |
| 401 rtCheck = static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox; | 397 rtCheck = static_cast<CFWL_ComboBoxItem*>(pItem)->m_rtCheckBox; |
| 402 return FWL_Error::Succeeded; | 398 return FWL_Error::Succeeded; |
| 403 } | 399 } |
| 404 | 400 |
| 405 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( | 401 FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 420 IFWL_Widget* pWidget, | 416 IFWL_Widget* pWidget, |
| 421 IFWL_ListItem* pItem, | 417 IFWL_ListItem* pItem, |
| 422 uint32_t dwCheckState) { | 418 uint32_t dwCheckState) { |
| 423 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwCheckState = dwCheckState; | 419 static_cast<CFWL_ComboBoxItem*>(pItem)->m_dwCheckState = dwCheckState; |
| 424 return FWL_Error::Succeeded; | 420 return FWL_Error::Succeeded; |
| 425 } | 421 } |
| 426 | 422 |
| 427 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { | 423 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { |
| 428 return m_fMaxListHeight; | 424 return m_fMaxListHeight; |
| 429 } | 425 } |
| OLD | NEW |