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/ifwl_barcode.h" | 7 #include "xfa/fwl/core/ifwl_barcode.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fgas/font/fgas_gefont.h" | 10 #include "xfa/fgas/font/fgas_gefont.h" |
11 #include "xfa/fwl/core/cfwl_themepart.h" | 11 #include "xfa/fwl/core/cfwl_themepart.h" |
12 #include "xfa/fwl/core/cfx_barcode.h" | 12 #include "xfa/fwl/core/cfx_barcode.h" |
13 #include "xfa/fwl/core/fwl_noteimp.h" | 13 #include "xfa/fwl/core/fwl_noteimp.h" |
14 #include "xfa/fwl/core/ifwl_themeprovider.h" | 14 #include "xfa/fwl/core/ifwl_themeprovider.h" |
15 | 15 |
16 IFWL_Barcode::IFWL_Barcode(const IFWL_App* app, | 16 IFWL_Barcode::IFWL_Barcode(const IFWL_App* app, |
17 const CFWL_WidgetImpProperties& properties) | 17 const CFWL_WidgetImpProperties& properties) |
18 : IFWL_Edit(app, properties, nullptr), m_dwStatus(0), m_type(BC_UNKNOWN) { | 18 : IFWL_Edit(app, properties, nullptr), m_dwStatus(0), m_type(BC_UNKNOWN) { |
19 SetDelegate(pdfium::MakeUnique<CFWL_BarcodeImpDelegate>(this)); | |
20 } | 19 } |
21 | 20 |
22 IFWL_Barcode::~IFWL_Barcode() {} | 21 IFWL_Barcode::~IFWL_Barcode() {} |
23 | 22 |
24 FWL_Type IFWL_Barcode::GetClassID() const { | 23 FWL_Type IFWL_Barcode::GetClassID() const { |
25 return FWL_Type::Barcode; | 24 return FWL_Type::Barcode; |
26 } | 25 } |
27 | 26 |
28 FWL_Error IFWL_Barcode::Update() { | 27 FWL_Error IFWL_Barcode::Update() { |
29 if (IsLocked()) { | 28 if (IsLocked()) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return TRUE; | 167 return TRUE; |
169 } | 168 } |
170 BC_TYPE tEngineType = m_pBarcodeEngine->GetType(); | 169 BC_TYPE tEngineType = m_pBarcodeEngine->GetType(); |
171 if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 || | 170 if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 || |
172 tEngineType == BC_DATAMATRIX) { | 171 tEngineType == BC_DATAMATRIX) { |
173 return TRUE; | 172 return TRUE; |
174 } | 173 } |
175 return FALSE; | 174 return FALSE; |
176 } | 175 } |
177 | 176 |
178 CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner) | 177 void IFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) { |
179 : CFWL_EditImpDelegate(pOwner) {} | |
180 | |
181 void CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | |
182 if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { | 178 if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { |
183 IFWL_Barcode* pOwner = static_cast<IFWL_Barcode*>(m_pOwner); | 179 m_pBarcodeEngine.reset(); |
184 pOwner->m_pBarcodeEngine.reset(); | 180 m_dwStatus = XFA_BCS_NeedUpdate; |
185 pOwner->m_dwStatus = XFA_BCS_NeedUpdate; | |
186 } | 181 } |
187 CFWL_EditImpDelegate::OnProcessEvent(pEvent); | 182 IFWL_Edit::OnProcessEvent(pEvent); |
188 } | 183 } |
OLD | NEW |