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_listbox.h" | 7 #include "xfa/fwl/lightwidget/cfwl_listbox.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
| 11 #include "third_party/base/ptr_util.h" |
11 #include "third_party/base/stl_util.h" | 12 #include "third_party/base/stl_util.h" |
12 | 13 |
13 IFWL_ListBox* CFWL_ListBox::GetWidget() { | 14 IFWL_ListBox* CFWL_ListBox::GetWidget() { |
14 return static_cast<IFWL_ListBox*>(m_pIface.get()); | 15 return static_cast<IFWL_ListBox*>(m_pIface.get()); |
15 } | 16 } |
16 | 17 |
17 const IFWL_ListBox* CFWL_ListBox::GetWidget() const { | 18 const IFWL_ListBox* CFWL_ListBox::GetWidget() const { |
18 return static_cast<IFWL_ListBox*>(m_pIface.get()); | 19 return static_cast<IFWL_ListBox*>(m_pIface.get()); |
19 } | 20 } |
20 | 21 |
21 FWL_Error CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) { | 22 FWL_Error CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) { |
22 if (m_pIface) | 23 if (m_pIface) |
23 return FWL_Error::Indefinite; | 24 return FWL_Error::Indefinite; |
24 if (pProperties) { | 25 if (pProperties) { |
25 *m_pProperties = *pProperties; | 26 *m_pProperties = *pProperties; |
26 } | 27 } |
27 std::unique_ptr<IFWL_ListBox> pListBox(IFWL_ListBox::Create( | 28 std::unique_ptr<IFWL_ListBox> pListBox = pdfium::MakeUnique<IFWL_ListBox>( |
28 m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr)); | 29 m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr); |
29 FWL_Error ret = pListBox->Initialize(); | 30 FWL_Error ret = pListBox->Initialize(); |
30 if (ret != FWL_Error::Succeeded) { | 31 if (ret != FWL_Error::Succeeded) { |
31 return ret; | 32 return ret; |
32 } | 33 } |
33 m_pIface = std::move(pListBox); | 34 m_pIface = std::move(pListBox); |
34 CFWL_Widget::Initialize(); | 35 CFWL_Widget::Initialize(); |
35 return FWL_Error::Succeeded; | 36 return FWL_Error::Succeeded; |
36 } | 37 } |
37 | 38 |
38 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { | 39 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 m_rtItem.Reset(); | 347 m_rtItem.Reset(); |
347 m_dwStates = 0; | 348 m_dwStates = 0; |
348 m_wsText = L""; | 349 m_wsText = L""; |
349 m_pDIB = nullptr; | 350 m_pDIB = nullptr; |
350 m_pData = nullptr; | 351 m_pData = nullptr; |
351 m_dwCheckState = 0; | 352 m_dwCheckState = 0; |
352 m_rtCheckBox.Reset(); | 353 m_rtCheckBox.Reset(); |
353 } | 354 } |
354 | 355 |
355 CFWL_ListItem::~CFWL_ListItem() {} | 356 CFWL_ListItem::~CFWL_ListItem() {} |
OLD | NEW |