• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
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_THEME_CFWL_CHECKBOXTP_H_
8 #define XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
9 
10 #include <memory>
11 
12 #include "xfa/fwl/theme/cfwl_utils.h"
13 #include "xfa/fwl/theme/cfwl_widgettp.h"
14 
15 class CFWL_CheckBoxTP : public CFWL_WidgetTP {
16  public:
17   CFWL_CheckBoxTP();
18   ~CFWL_CheckBoxTP() override;
19 
20   // CFWL_WidgeTP
21   void Initialize() override;
22   void Finalize() override;
23   void DrawText(CFWL_ThemeText* pParams) override;
24   void DrawBackground(CFWL_ThemeBackground* pParams) override;
25 
26  protected:
27   struct CKBThemeData {
28     FX_ARGB clrBoxBk[13][2];
29     FX_ARGB clrSignBorderNormal;
30     FX_ARGB clrSignBorderDisable;
31     FX_ARGB clrSignCheck;
32     FX_ARGB clrSignNeutral;
33     FX_ARGB clrSignNeutralNormal;
34     FX_ARGB clrSignNeutralHover;
35     FX_ARGB clrSignNeutralPressed;
36   };
37 
38   void DrawCheckSign(CFWL_Widget* pWidget,
39                      CXFA_Graphics* pGraphics,
40                      const CFX_RectF& pRtBox,
41                      int32_t iState,
42                      CFX_Matrix* pMatrix);
43   void DrawSignCheck(CXFA_Graphics* pGraphics,
44                      const CFX_RectF* pRtSign,
45                      FX_ARGB argbFill,
46                      CFX_Matrix* pMatrix);
47   void DrawSignCircle(CXFA_Graphics* pGraphics,
48                       const CFX_RectF* pRtSign,
49                       FX_ARGB argbFill,
50                       CFX_Matrix* pMatrix);
51   void DrawSignCross(CXFA_Graphics* pGraphics,
52                      const CFX_RectF* pRtSign,
53                      FX_ARGB argbFill,
54                      CFX_Matrix* pMatrix);
55   void DrawSignDiamond(CXFA_Graphics* pGraphics,
56                        const CFX_RectF* pRtSign,
57                        FX_ARGB argbFill,
58                        CFX_Matrix* pMatrix);
59   void DrawSignSquare(CXFA_Graphics* pGraphics,
60                       const CFX_RectF* pRtSign,
61                       FX_ARGB argbFill,
62                       CFX_Matrix* pMatrix);
63   void DrawSignStar(CXFA_Graphics* pGraphics,
64                     const CFX_RectF* pRtSign,
65                     FX_ARGB argbFill,
66                     CFX_Matrix* pMatrix);
67 
68   void InitCheckPath(float fCheckLen);
69 
70   std::unique_ptr<CKBThemeData> m_pThemeData;
71   std::unique_ptr<CXFA_GEPath> m_pCheckPath;
72 
73  private:
74   void SetThemeData();
75 };
76 
77 #endif  // XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
78