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_THEME_CFWL_CHECKBOXTP_H_ | 7 #ifndef XFA_FWL_THEME_CFWL_CHECKBOXTP_H_ |
8 #define XFA_FWL_THEME_CFWL_CHECKBOXTP_H_ | 8 #define XFA_FWL_THEME_CFWL_CHECKBOXTP_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "xfa/fwl/theme/cfwl_utils.h" | 12 #include "xfa/fwl/theme/cfwl_utils.h" |
11 #include "xfa/fwl/theme/cfwl_widgettp.h" | 13 #include "xfa/fwl/theme/cfwl_widgettp.h" |
12 | 14 |
13 class CFWL_CheckBoxTP : public CFWL_WidgetTP { | 15 class CFWL_CheckBoxTP : public CFWL_WidgetTP { |
14 public: | 16 public: |
15 CFWL_CheckBoxTP(); | 17 CFWL_CheckBoxTP(); |
16 ~CFWL_CheckBoxTP() override; | 18 ~CFWL_CheckBoxTP() override; |
17 | 19 |
18 // CFWL_WidgeTP | 20 // CFWL_WidgeTP |
19 bool IsValidWidget(IFWL_Widget* pWidget) override; | 21 bool IsValidWidget(IFWL_Widget* pWidget) override; |
20 uint32_t SetThemeID(IFWL_Widget* pWidget, | 22 uint32_t SetThemeID(IFWL_Widget* pWidget, |
21 uint32_t dwThemeID, | 23 uint32_t dwThemeID, |
22 FX_BOOL bChildren = TRUE) override; | 24 FX_BOOL bChildren = TRUE) override; |
23 FX_BOOL DrawText(CFWL_ThemeText* pParams) override; | 25 FX_BOOL DrawText(CFWL_ThemeText* pParams) override; |
24 FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; | 26 FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; |
25 FWL_Error Initialize() override; | 27 FWL_Error Initialize() override; |
26 FWL_Error Finalize() override; | 28 FWL_Error Finalize() override; |
27 | 29 |
28 protected: | 30 protected: |
29 void DrawBoxBk(IFWL_Widget* pWidget, | |
30 CFX_Graphics* pGraphics, | |
31 const CFX_RectF* pRect, | |
32 uint32_t dwStates, | |
33 CFX_Matrix* pMatrix = nullptr); | |
34 void DrawSign(IFWL_Widget* pWidget, | |
35 CFX_Graphics* pGraphics, | |
36 const CFX_RectF* pRtBox, | |
37 uint32_t dwStates, | |
38 CFX_Matrix* pMatrix = nullptr); | |
39 void DrawSignNeutral(CFX_Graphics* pGraphics, | |
40 const CFX_RectF* pRtSign, | |
41 CFX_Matrix* pMatrix = nullptr); | |
42 void DrawSignCheck(CFX_Graphics* pGraphics, | |
43 const CFX_RectF* pRtSign, | |
44 FX_ARGB argbFill, | |
45 CFX_Matrix* pMatrix = nullptr); | |
46 void DrawSignCircle(CFX_Graphics* pGraphics, | |
47 const CFX_RectF* pRtSign, | |
48 FX_ARGB argbFill, | |
49 CFX_Matrix* pMatrix = nullptr); | |
50 void DrawSignCross(CFX_Graphics* pGraphics, | |
51 const CFX_RectF* pRtSign, | |
52 FX_ARGB argbFill, | |
53 CFX_Matrix* pMatrix = nullptr); | |
54 void DrawSignDiamond(CFX_Graphics* pGraphics, | |
55 const CFX_RectF* pRtSign, | |
56 FX_ARGB argbFill, | |
57 CFX_Matrix* pMatrix = nullptr); | |
58 void DrawSignSquare(CFX_Graphics* pGraphics, | |
59 const CFX_RectF* pRtSign, | |
60 FX_ARGB argbFill, | |
61 CFX_Matrix* pMatrix = nullptr); | |
62 void DrawSignStar(CFX_Graphics* pGraphics, | |
63 const CFX_RectF* pRtSign, | |
64 FX_ARGB argbFill, | |
65 CFX_Matrix* pMatrix = nullptr); | |
66 void DrawSignBorder(IFWL_Widget* pWidget, | |
67 CFX_Graphics* pGraphics, | |
68 const CFX_RectF* pRtBox, | |
69 FX_BOOL bDisable = FALSE, | |
70 CFX_Matrix* pMatrix = nullptr); | |
71 void SetThemeData(uint32_t dwID); | |
72 void initCheckPath(FX_FLOAT fCheckLen); | |
73 struct CKBThemeData { | 31 struct CKBThemeData { |
74 FX_ARGB clrBoxBk[13][2]; | 32 FX_ARGB clrBoxBk[13][2]; |
75 FX_ARGB clrSignBorderNormal; | 33 FX_ARGB clrSignBorderNormal; |
76 FX_ARGB clrSignBorderDisable; | 34 FX_ARGB clrSignBorderDisable; |
77 FX_ARGB clrSignCheck; | 35 FX_ARGB clrSignCheck; |
78 FX_ARGB clrSignNeutral; | 36 FX_ARGB clrSignNeutral; |
79 FX_ARGB clrSignNeutralNormal; | 37 FX_ARGB clrSignNeutralNormal; |
80 FX_ARGB clrSignNeutralHover; | 38 FX_ARGB clrSignNeutralHover; |
81 FX_ARGB clrSignNeutralPressed; | 39 FX_ARGB clrSignNeutralPressed; |
82 } * m_pThemeData; | 40 }; |
83 CFX_Path* m_pCheckPath; | 41 |
| 42 void DrawBoxBk(IFWL_Widget* pWidget, |
| 43 CFX_Graphics* pGraphics, |
| 44 const CFX_RectF* pRect, |
| 45 uint32_t dwStates, |
| 46 CFX_Matrix* pMatrix); |
| 47 void DrawSign(IFWL_Widget* pWidget, |
| 48 CFX_Graphics* pGraphics, |
| 49 const CFX_RectF* pRtBox, |
| 50 uint32_t dwStates, |
| 51 CFX_Matrix* pMatrix); |
| 52 void DrawSignNeutral(CFX_Graphics* pGraphics, |
| 53 const CFX_RectF* pRtSign, |
| 54 CFX_Matrix* pMatrix); |
| 55 void DrawSignCheck(CFX_Graphics* pGraphics, |
| 56 const CFX_RectF* pRtSign, |
| 57 FX_ARGB argbFill, |
| 58 CFX_Matrix* pMatrix); |
| 59 void DrawSignCircle(CFX_Graphics* pGraphics, |
| 60 const CFX_RectF* pRtSign, |
| 61 FX_ARGB argbFill, |
| 62 CFX_Matrix* pMatrix); |
| 63 void DrawSignCross(CFX_Graphics* pGraphics, |
| 64 const CFX_RectF* pRtSign, |
| 65 FX_ARGB argbFill, |
| 66 CFX_Matrix* pMatrix); |
| 67 void DrawSignDiamond(CFX_Graphics* pGraphics, |
| 68 const CFX_RectF* pRtSign, |
| 69 FX_ARGB argbFill, |
| 70 CFX_Matrix* pMatrix); |
| 71 void DrawSignSquare(CFX_Graphics* pGraphics, |
| 72 const CFX_RectF* pRtSign, |
| 73 FX_ARGB argbFill, |
| 74 CFX_Matrix* pMatrix); |
| 75 void DrawSignStar(CFX_Graphics* pGraphics, |
| 76 const CFX_RectF* pRtSign, |
| 77 FX_ARGB argbFill, |
| 78 CFX_Matrix* pMatrix); |
| 79 void DrawSignBorder(IFWL_Widget* pWidget, |
| 80 CFX_Graphics* pGraphics, |
| 81 const CFX_RectF* pRtBox, |
| 82 FX_BOOL bDisable, |
| 83 CFX_Matrix* pMatrix); |
| 84 void SetThemeData(uint32_t dwID); |
| 85 void InitCheckPath(FX_FLOAT fCheckLen); |
| 86 |
| 87 std::unique_ptr<CKBThemeData> m_pThemeData; |
| 88 std::unique_ptr<CFX_Path> m_pCheckPath; |
84 }; | 89 }; |
85 | 90 |
86 #endif // XFA_FWL_THEME_CFWL_CHECKBOXTP_H_ | 91 #endif // XFA_FWL_THEME_CFWL_CHECKBOXTP_H_ |
OLD | NEW |