Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cfwl_barcode.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef XFA_FWL_CFWL_BARCODE_H_
8#define XFA_FWL_CFWL_BARCODE_H_
9
10#include <stdint.h>
11
12#include <memory>
13#include <optional>
14
15#include "fxbarcode/BC_Library.h"
16#include "xfa/fwl/cfwl_edit.h"
17
18class CFX_Barcode;
19
20namespace pdfium {
21
22class CFWL_Barcode final : public CFWL_Edit {
23 public:
25 ~CFWL_Barcode() override;
26
27 // CFWL_Widget
28 FWL_Type GetClassID() const override;
29 void Update() override;
30 void DrawWidget(CFGAS_GEGraphics* pGraphics,
31 const CFX_Matrix& matrix) override;
32 void OnProcessEvent(CFWL_Event* pEvent) override;
33
34 // CFWL_Edit
35 void SetText(const WideString& wsText) override;
36 void SetTextSkipNotify(const WideString& wsText) override;
37
38 void SetType(BC_TYPE type);
39 bool IsProtectedType() const;
40
41 void SetModuleHeight(int32_t height);
42 void SetModuleWidth(int32_t width);
43 void SetDataLength(int32_t dataLength);
44 void SetCalChecksum(bool calChecksum);
45 void SetPrintChecksum(bool printChecksum);
46 void SetTextLocation(BC_TEXT_LOC location);
47 void SetWideNarrowRatio(int8_t ratio);
48 void SetStartChar(char startChar);
49 void SetEndChar(char endChar);
50 void SetErrorCorrectionLevel(int32_t ecLevel);
51
52 private:
53 enum class Status : uint8_t {
54 kNormal,
55 kNeedUpdate,
56 kEncodeSuccess,
57 };
58
59 explicit CFWL_Barcode(CFWL_App* pApp);
60
61 void GenerateBarcodeImageCache();
62 void CreateBarcodeEngine();
63
65 Status m_eStatus = Status::kNormal;
66 std::optional<BC_TEXT_LOC> m_eTextLocation;
67 std::optional<bool> m_bCalChecksum;
68 std::optional<bool> m_bPrintChecksum;
69 std::optional<char> m_cStartChar;
70 std::optional<char> m_cEndChar;
71 std::optional<int8_t> m_nWideNarrowRatio;
72 std::optional<int32_t> m_nModuleHeight;
73 std::optional<int32_t> m_nModuleWidth;
74 std::optional<int32_t> m_nDataLength;
75 std::optional<int32_t> m_nECLevel;
76 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
77};
78
79} // namespace pdfium
80
81// TODO(crbug.com/42271761): Remove.
82using pdfium::CFWL_Barcode;
83
84#endif // XFA_FWL_CFWL_BARCODE_H_
BC_TEXT_LOC
Definition BC_Library.h:12
BC_TYPE
Definition BC_Library.h:20
@ kDataMatrix
Definition BC_Library.h:32
#define FWL_STATE_WGT_Focused
Definition cfwl_widget.h:44
void Concat(const CFX_Matrix &right)
void SetModuleWidth(int32_t width)
void SetModuleHeight(int32_t height)
void SetType(BC_TYPE type)
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void SetCalChecksum(bool calChecksum)
void SetErrorCorrectionLevel(int32_t ecLevel)
void OnProcessEvent(CFWL_Event *pEvent) override
void SetWideNarrowRatio(int8_t ratio)
void SetEndChar(char endChar)
void SetDataLength(int32_t dataLength)
void SetStartChar(char startChar)
void SetTextSkipNotify(const WideString &wsText) override
FWL_Type GetClassID() const override
void SetPrintChecksum(bool printChecksum)
void Update() override
void SetText(const WideString &wsText) override
bool IsProtectedType() const
void SetTextLocation(BC_TEXT_LOC location)
~CFWL_Barcode() override
virtual void SetTextSkipNotify(const WideString &wsText)
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void Update() override
CFWL_Edit(CFWL_App *app, const Properties &properties, CFWL_Widget *pOuter)
Definition cfwl_edit.cpp:52
const CFX_RectF & GetRTClient() const
Definition cfwl_edit.h:108
void SetLimit(int32_t nLimit)
virtual void SetText(const WideString &wsText)
void OnProcessEvent(CFWL_Event *pEvent) override
Type GetType() const
Definition cfwl_event.h:41
IFWL_ThemeProvider * GetThemeProvider() const
bool IsLocked() const
Properties m_Properties
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
fxcrt::WideString WideString
Definition widestring.h:207