| 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 |
| 11 #include "third_party/base/ptr_util.h" |
| 11 #include "xfa/fwl/core/fwl_error.h" | 12 #include "xfa/fwl/core/fwl_error.h" |
| 12 #include "xfa/fwl/core/ifwl_widget.h" | 13 #include "xfa/fwl/core/ifwl_widget.h" |
| 13 | 14 |
| 14 IFWL_ComboBox* CFWL_ComboBox::GetWidget() { | 15 IFWL_ComboBox* CFWL_ComboBox::GetWidget() { |
| 15 return static_cast<IFWL_ComboBox*>(m_pIface.get()); | 16 return static_cast<IFWL_ComboBox*>(m_pIface.get()); |
| 16 } | 17 } |
| 17 | 18 |
| 18 const IFWL_ComboBox* CFWL_ComboBox::GetWidget() const { | 19 const IFWL_ComboBox* CFWL_ComboBox::GetWidget() const { |
| 19 return static_cast<IFWL_ComboBox*>(m_pIface.get()); | 20 return static_cast<IFWL_ComboBox*>(m_pIface.get()); |
| 20 } | 21 } |
| 21 | 22 |
| 22 FWL_Error CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { | 23 FWL_Error CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { |
| 23 if (m_pIface) | 24 if (m_pIface) |
| 24 return FWL_Error::Indefinite; | 25 return FWL_Error::Indefinite; |
| 25 if (pProperties) { | 26 if (pProperties) { |
| 26 *m_pProperties = *pProperties; | 27 *m_pProperties = *pProperties; |
| 27 } | 28 } |
| 28 std::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create( | 29 std::unique_ptr<IFWL_ComboBox> pComboBox = pdfium::MakeUnique<IFWL_ComboBox>( |
| 29 m_pProperties->MakeWidgetImpProperties(&m_comboBoxData))); | 30 m_pProperties->MakeWidgetImpProperties(&m_comboBoxData)); |
| 30 FWL_Error ret = pComboBox->Initialize(); | 31 FWL_Error ret = pComboBox->Initialize(); |
| 31 if (ret != FWL_Error::Succeeded) { | 32 if (ret != FWL_Error::Succeeded) { |
| 32 return ret; | 33 return ret; |
| 33 } | 34 } |
| 34 m_pIface = std::move(pComboBox); | 35 m_pIface = std::move(pComboBox); |
| 35 CFWL_Widget::Initialize(); | 36 CFWL_Widget::Initialize(); |
| 36 return FWL_Error::Succeeded; | 37 return FWL_Error::Succeeded; |
| 37 } | 38 } |
| 38 | 39 |
| 39 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { | 40 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 return FWL_Error::Succeeded; | 380 return FWL_Error::Succeeded; |
| 380 } | 381 } |
| 381 | 382 |
| 382 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { | 383 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { |
| 383 return m_fMaxListHeight; | 384 return m_fMaxListHeight; |
| 384 } | 385 } |
| 385 | 386 |
| 386 CFWL_ComboBoxItem::CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} | 387 CFWL_ComboBoxItem::CFWL_ComboBoxItem() : m_pDIB(nullptr), m_pData(nullptr) {} |
| 387 | 388 |
| 388 CFWL_ComboBoxItem::~CFWL_ComboBoxItem() {} | 389 CFWL_ComboBoxItem::~CFWL_ComboBoxItem() {} |
| OLD | NEW |