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_barcode.h" | 7 #include "xfa/fwl/core/cfwl_barcode.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> |
10 | 11 |
11 #include "third_party/base/ptr_util.h" | 12 #include "third_party/base/ptr_util.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 IFWL_Barcode* ToBarcode(IFWL_Widget* widget) { | 16 IFWL_Barcode* ToBarcode(IFWL_Widget* widget) { |
16 return static_cast<IFWL_Barcode*>(widget); | 17 return static_cast<IFWL_Barcode*>(widget); |
17 } | 18 } |
18 | 19 |
19 } // namespace | 20 } // namespace |
20 | 21 |
21 CFWL_Barcode::CFWL_Barcode(const CFWL_App* app) | 22 CFWL_Barcode::CFWL_Barcode(const CFWL_App* app) |
22 : CFWL_Edit(app), m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {} | 23 : CFWL_Edit(app), m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {} |
23 | 24 |
24 CFWL_Barcode::~CFWL_Barcode() {} | 25 CFWL_Barcode::~CFWL_Barcode() {} |
25 | 26 |
26 void CFWL_Barcode::Initialize() { | 27 void CFWL_Barcode::Initialize() { |
27 ASSERT(!m_pIface); | 28 ASSERT(!m_pIface); |
28 | 29 |
29 m_pIface = pdfium::MakeUnique<IFWL_Barcode>( | 30 auto iface = pdfium::MakeUnique<IFWL_Barcode>( |
30 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this)); | 31 m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>()); |
| 32 iface->SetDataProvider(this); |
| 33 m_pIface = std::move(iface); |
31 | 34 |
32 CFWL_Widget::Initialize(); | 35 CFWL_Widget::Initialize(); |
33 } | 36 } |
34 | 37 |
35 void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { | 38 void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { |
36 m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; | 39 m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; |
37 m_eCharEncoding = encoding; | 40 m_eCharEncoding = encoding; |
38 } | 41 } |
39 | 42 |
40 void CFWL_Barcode::SetModuleHeight(int32_t height) { | 43 void CFWL_Barcode::SetModuleHeight(int32_t height) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return m_nECLevel; | 153 return m_nECLevel; |
151 } | 154 } |
152 | 155 |
153 bool CFWL_Barcode::GetTruncated() const { | 156 bool CFWL_Barcode::GetTruncated() const { |
154 return m_bTruncated; | 157 return m_bTruncated; |
155 } | 158 } |
156 | 159 |
157 uint32_t CFWL_Barcode::GetBarcodeAttributeMask() const { | 160 uint32_t CFWL_Barcode::GetBarcodeAttributeMask() const { |
158 return m_dwAttributeMask; | 161 return m_dwAttributeMask; |
159 } | 162 } |
OLD | NEW |