Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: xfa/fwl/core/cfwl_barcode.cpp

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_barcode.h ('k') | xfa/fwl/core/cfwl_checkbox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
11 CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {}
12
13 CFWL_Barcode::~CFWL_Barcode() {}
14
15 void CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
16 ASSERT(!m_pIface);
17
18 if (pProperties)
19 *m_pProperties = *pProperties;
20
21 std::unique_ptr<IFWL_Barcode> pBarcode(new IFWL_Barcode(
22 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_barcodeData)));
23 pBarcode->Initialize();
24
25 m_pIface = std::move(pBarcode);
26 CFWL_Widget::Initialize(pProperties);
27 }
28
11 IFWL_Barcode* CFWL_Barcode::GetWidget() { 29 IFWL_Barcode* CFWL_Barcode::GetWidget() {
12 return static_cast<IFWL_Barcode*>(m_pIface.get()); 30 return static_cast<IFWL_Barcode*>(m_pIface.get());
13 } 31 }
14 32
15 const IFWL_Barcode* CFWL_Barcode::GetWidget() const { 33 const IFWL_Barcode* CFWL_Barcode::GetWidget() const {
16 return static_cast<IFWL_Barcode*>(m_pIface.get()); 34 return static_cast<IFWL_Barcode*>(m_pIface.get());
17 } 35 }
18 36
19 FWL_Error CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
20 if (m_pIface)
21 return FWL_Error::Indefinite;
22 if (pProperties) {
23 *m_pProperties = *pProperties;
24 }
25 std::unique_ptr<IFWL_Barcode> pBarcode(
26 new IFWL_Barcode(m_pProperties->MakeWidgetImpProperties(&m_barcodeData)));
27 FWL_Error ret = pBarcode->Initialize();
28 if (ret != FWL_Error::Succeeded) {
29 return ret;
30 }
31 m_pIface = std::move(pBarcode);
32 CFWL_Widget::Initialize();
33 return FWL_Error::Succeeded;
34 }
35
36 CFWL_Barcode::CFWL_Barcode() {}
37
38 CFWL_Barcode::~CFWL_Barcode() {}
39
40 void CFWL_Barcode::SetType(BC_TYPE type) { 37 void CFWL_Barcode::SetType(BC_TYPE type) {
41 if (GetWidget()) 38 if (GetWidget())
42 GetWidget()->SetType(type); 39 GetWidget()->SetType(type);
43 } 40 }
44 41
45 FX_BOOL CFWL_Barcode::IsProtectedType() { 42 FX_BOOL CFWL_Barcode::IsProtectedType() {
46 return GetWidget() ? GetWidget()->IsProtectedType() : FALSE; 43 return GetWidget() ? GetWidget()->IsProtectedType() : FALSE;
47 } 44 }
48 45
49 CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP() 46 CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP()
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return m_nECLevel; 99 return m_nECLevel;
103 } 100 }
104 101
105 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { 102 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const {
106 return m_bTruncated; 103 return m_bTruncated;
107 } 104 }
108 105
109 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const { 106 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const {
110 return m_dwAttributeMask; 107 return m_dwAttributeMask;
111 } 108 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_barcode.h ('k') | xfa/fwl/core/cfwl_checkbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698