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 #ifndef XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_BARCODE_H_ |
8 #define XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_ | 8 #define XFA_FWL_CORE_IFWL_BARCODE_H_ |
9 | 9 |
10 #include "xfa/fwl/basewidget/ifwl_edit.h" | 10 #include <memory> |
| 11 |
| 12 #include "xfa/fwl/core/ifwl_edit.h" |
| 13 #include "xfa/fwl/core/ifwl_scrollbar.h" |
11 #include "xfa/fxbarcode/BC_Library.h" | 14 #include "xfa/fxbarcode/BC_Library.h" |
12 | 15 |
| 16 class CFWL_BarcodeImpDelegate; |
13 class CFWL_WidgetImpProperties; | 17 class CFWL_WidgetImpProperties; |
| 18 class CFX_Barcode; |
| 19 class IFWL_Widget; |
14 | 20 |
| 21 #define XFA_BCS_NeedUpdate 0x0001 |
| 22 #define XFA_BCS_EncodeSuccess 0x0002 |
15 #define FWL_CLASS_Barcode L"FWL_BARCODE" | 23 #define FWL_CLASS_Barcode L"FWL_BARCODE" |
16 | 24 |
17 enum FWL_BCDAttribute { | 25 enum FWL_BCDAttribute { |
18 FWL_BCDATTRIBUTE_NONE = 0, | 26 FWL_BCDATTRIBUTE_NONE = 0, |
19 FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0, | 27 FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0, |
20 FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1, | 28 FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1, |
21 FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2, | 29 FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2, |
22 FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3, | 30 FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3, |
23 FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4, | 31 FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4, |
24 FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5, | 32 FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5, |
(...skipping 20 matching lines...) Expand all Loading... |
45 virtual FX_CHAR GetEndChar() = 0; | 53 virtual FX_CHAR GetEndChar() = 0; |
46 virtual int32_t GetVersion() = 0; | 54 virtual int32_t GetVersion() = 0; |
47 virtual int32_t GetErrorCorrectionLevel() = 0; | 55 virtual int32_t GetErrorCorrectionLevel() = 0; |
48 virtual FX_BOOL GetTruncated() = 0; | 56 virtual FX_BOOL GetTruncated() = 0; |
49 virtual uint32_t GetBarcodeAttributeMask() = 0; | 57 virtual uint32_t GetBarcodeAttributeMask() = 0; |
50 }; | 58 }; |
51 | 59 |
52 class IFWL_Barcode : public IFWL_Edit { | 60 class IFWL_Barcode : public IFWL_Edit { |
53 public: | 61 public: |
54 static IFWL_Barcode* Create(const CFWL_WidgetImpProperties& properties); | 62 static IFWL_Barcode* Create(const CFWL_WidgetImpProperties& properties); |
| 63 |
| 64 IFWL_Barcode(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
| 65 ~IFWL_Barcode() override; |
| 66 |
| 67 // IFWL_Widget |
| 68 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
| 69 FWL_Type GetClassID() const override; |
| 70 FWL_Error Initialize() override; |
| 71 FWL_Error Finalize() override; |
| 72 FWL_Error Update() override; |
| 73 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 74 const CFX_Matrix* pMatrix = nullptr) override; |
| 75 FWL_Error SetText(const CFX_WideString& wsText) override; |
| 76 |
55 void SetType(BC_TYPE type); | 77 void SetType(BC_TYPE type); |
56 FX_BOOL IsProtectedType(); | 78 FX_BOOL IsProtectedType(); |
57 | 79 |
58 protected: | 80 protected: |
59 IFWL_Barcode(); | 81 friend class CFWL_BarcodeImpDelegate; |
| 82 |
| 83 void GenerateBarcodeImageCache(); |
| 84 void CreateBarcodeEngine(); |
| 85 |
| 86 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine; |
| 87 uint32_t m_dwStatus; |
| 88 BC_TYPE m_type; |
60 }; | 89 }; |
61 | 90 |
62 #endif // XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_ | 91 class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { |
| 92 public: |
| 93 explicit CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner); |
| 94 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 95 }; |
| 96 |
| 97 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_ |
OLD | NEW |