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_listbox.h" | 7 #include "xfa/fwl/core/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 namespace { | 14 namespace { |
14 | 15 |
15 IFWL_ListBox* ToListBox(IFWL_Widget* widget) { | 16 IFWL_ListBox* ToListBox(IFWL_Widget* widget) { |
16 return static_cast<IFWL_ListBox*>(widget); | 17 return static_cast<IFWL_ListBox*>(widget); |
17 } | 18 } |
18 | 19 |
19 } // namespace | 20 } // namespace |
20 | 21 |
21 CFWL_ListBox::CFWL_ListBox(const IFWL_App* app) : CFWL_Widget(app) {} | 22 CFWL_ListBox::CFWL_ListBox(const IFWL_App* app) : CFWL_Widget(app) {} |
22 | 23 |
23 CFWL_ListBox::~CFWL_ListBox() {} | 24 CFWL_ListBox::~CFWL_ListBox() {} |
24 | 25 |
25 void CFWL_ListBox::Initialize() { | 26 void CFWL_ListBox::Initialize() { |
26 ASSERT(!m_pIface); | 27 ASSERT(!m_pIface); |
27 | 28 |
28 std::unique_ptr<IFWL_ListBox> pListBox(new IFWL_ListBox( | 29 m_pIface = pdfium::MakeUnique<IFWL_ListBox>( |
29 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr)); | 30 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr); |
30 pListBox->Initialize(); | |
31 | 31 |
32 m_pIface = std::move(pListBox); | |
33 CFWL_Widget::Initialize(); | 32 CFWL_Widget::Initialize(); |
34 } | 33 } |
35 | 34 |
36 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { | 35 FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { |
37 static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB; | 36 static_cast<CFWL_ListItem*>(pItem)->m_pDIB = pDIB; |
38 return FWL_Error::Succeeded; | 37 return FWL_Error::Succeeded; |
39 } | 38 } |
40 | 39 |
41 IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, | 40 IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, |
42 FX_BOOL bSelect) { | 41 FX_BOOL bSelect) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 m_rtItem.Reset(); | 339 m_rtItem.Reset(); |
341 m_dwStates = 0; | 340 m_dwStates = 0; |
342 m_wsText = L""; | 341 m_wsText = L""; |
343 m_pDIB = nullptr; | 342 m_pDIB = nullptr; |
344 m_pData = nullptr; | 343 m_pData = nullptr; |
345 m_dwCheckState = 0; | 344 m_dwCheckState = 0; |
346 m_rtCheckBox.Reset(); | 345 m_rtCheckBox.Reset(); |
347 } | 346 } |
348 | 347 |
349 CFWL_ListItem::~CFWL_ListItem() {} | 348 CFWL_ListItem::~CFWL_ListItem() {} |
OLD | NEW |