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

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

Issue 2488953003: Cleanup IFWL_Widget visibility and virtual parameters (Closed)
Patch Set: fixes 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/ifwl_barcode.h ('k') | xfa/fwl/core/ifwl_caret.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/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 std::unique_ptr<CFWL_WidgetProperties> properties) 17 std::unique_ptr<CFWL_WidgetProperties> properties)
18 : IFWL_Edit(app, std::move(properties), nullptr), 18 : IFWL_Edit(app, std::move(properties), nullptr),
19 m_dwStatus(0), 19 m_dwStatus(0),
20 m_type(BC_UNKNOWN) {} 20 m_type(BC_UNKNOWN) {}
21 21
22 IFWL_Barcode::~IFWL_Barcode() {} 22 IFWL_Barcode::~IFWL_Barcode() {}
23 23
24 FWL_Type IFWL_Barcode::GetClassID() const { 24 FWL_Type IFWL_Barcode::GetClassID() const {
25 return FWL_Type::Barcode; 25 return FWL_Type::Barcode;
26 } 26 }
27 27
28 FWL_Error IFWL_Barcode::Update() { 28 void IFWL_Barcode::Update() {
29 if (IsLocked()) { 29 if (IsLocked()) {
30 return FWL_Error::Indefinite; 30 return;
31 } 31 }
32 FWL_Error ret = IFWL_Edit::Update(); 32 IFWL_Edit::Update();
33 GenerateBarcodeImageCache(); 33 GenerateBarcodeImageCache();
34 return ret;
35 } 34 }
36 35
37 FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics, 36 void IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
38 const CFX_Matrix* pMatrix) { 37 const CFX_Matrix* pMatrix) {
39 if (!pGraphics) 38 if (!pGraphics)
40 return FWL_Error::Indefinite; 39 return;
41 if (!m_pProperties->m_pThemeProvider) 40 if (!m_pProperties->m_pThemeProvider)
42 return FWL_Error::Indefinite; 41 return;
43 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { 42 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
44 GenerateBarcodeImageCache(); 43 GenerateBarcodeImageCache();
45 if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) { 44 if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) {
46 return FWL_Error::Succeeded; 45 return;
47 } 46 }
48 CFX_Matrix mt; 47 CFX_Matrix mt;
49 mt.e = m_rtClient.left; 48 mt.e = m_rtClient.left;
50 mt.f = m_rtClient.top; 49 mt.f = m_rtClient.top;
51 if (pMatrix) { 50 if (pMatrix) {
52 mt.Concat(*pMatrix); 51 mt.Concat(*pMatrix);
53 } 52 }
54 int32_t errorCode = 0; 53 int32_t errorCode = 0;
55 if (!m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix, 54 m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix,
56 errorCode)) { 55 errorCode);
57 return FWL_Error::Indefinite; 56 return;
58 }
59 return FWL_Error::Succeeded;
60 } 57 }
61 return IFWL_Edit::DrawWidget(pGraphics, pMatrix); 58 IFWL_Edit::DrawWidget(pGraphics, pMatrix);
62 } 59 }
63 void IFWL_Barcode::GenerateBarcodeImageCache() { 60 void IFWL_Barcode::GenerateBarcodeImageCache() {
64 if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0) 61 if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0)
65 return; 62 return;
66 m_dwStatus = 0; 63 m_dwStatus = 0;
67 CreateBarcodeEngine(); 64 CreateBarcodeEngine();
68 IFWL_BarcodeDP* pData = 65 IFWL_BarcodeDP* pData =
69 static_cast<IFWL_BarcodeDP*>(m_pProperties->m_pDataProvider); 66 static_cast<IFWL_BarcodeDP*>(m_pProperties->m_pDataProvider);
70 if (!pData) 67 if (!pData)
71 return; 68 return;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return false; 172 return false;
176 } 173 }
177 174
178 void IFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) { 175 void IFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) {
179 if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { 176 if (pEvent->GetClassID() == CFWL_EventType::TextChanged) {
180 m_pBarcodeEngine.reset(); 177 m_pBarcodeEngine.reset();
181 m_dwStatus = XFA_BCS_NeedUpdate; 178 m_dwStatus = XFA_BCS_NeedUpdate;
182 } 179 }
183 IFWL_Edit::OnProcessEvent(pEvent); 180 IFWL_Edit::OnProcessEvent(pEvent);
184 } 181 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_barcode.h ('k') | xfa/fwl/core/ifwl_caret.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698