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_FWL_CHECKBOXIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ |
9 | 9 |
10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 11 #include "xfa/fwl/core/ifwl_widget.h" |
11 | 12 |
12 class CFWL_CheckBoxImpDelegate; | 13 class CFWL_CheckBoxImpDelegate; |
13 class CFWL_MsgMouse; | 14 class CFWL_MsgMouse; |
14 class CFWL_WidgetImpProperties; | 15 class CFWL_WidgetImpProperties; |
15 class IFWL_Widget; | 16 class IFWL_Widget; |
16 | 17 |
17 class CFWL_CheckBoxImp : public CFWL_WidgetImp { | 18 class CFWL_CheckBoxImp : public CFWL_WidgetImp { |
18 public: | 19 public: |
19 CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, | 20 CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, |
20 IFWL_Widget* pOuter); | 21 IFWL_Widget* pOuter); |
21 ~CFWL_CheckBoxImp(); | 22 ~CFWL_CheckBoxImp() override; |
22 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | 23 |
23 virtual uint32_t GetClassID() const; | 24 // CFWL_WidgetImp |
24 virtual FWL_Error Initialize(); | 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
25 virtual FWL_Error Finalize(); | 26 FWL_Type GetClassID() const override; |
26 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 27 FWL_Error Initialize() override; |
27 virtual FWL_Error Update(); | 28 FWL_Error Finalize() override; |
28 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
29 const CFX_Matrix* pMatrix = NULL); | 30 FWL_Error Update() override; |
30 virtual int32_t GetCheckState(); | 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
31 virtual FWL_Error SetCheckState(int32_t iCheck); | 32 const CFX_Matrix* pMatrix = nullptr) override; |
| 33 int32_t GetCheckState(); |
| 34 FWL_Error SetCheckState(int32_t iCheck); |
32 | 35 |
33 protected: | 36 protected: |
| 37 friend class CFWL_CheckBoxImpDelegate; |
| 38 |
34 void Layout(); | 39 void Layout(); |
35 uint32_t GetPartStates(); | 40 uint32_t GetPartStates(); |
36 void UpdateTextOutStyles(); | 41 void UpdateTextOutStyles(); |
37 void NextStates(); | 42 void NextStates(); |
| 43 |
38 CFX_RectF m_rtClient; | 44 CFX_RectF m_rtClient; |
39 CFX_RectF m_rtBox; | 45 CFX_RectF m_rtBox; |
40 CFX_RectF m_rtCaption; | 46 CFX_RectF m_rtCaption; |
41 CFX_RectF m_rtFocus; | 47 CFX_RectF m_rtFocus; |
42 uint32_t m_dwTTOStyles; | 48 uint32_t m_dwTTOStyles; |
43 int32_t m_iTTOAlign; | 49 int32_t m_iTTOAlign; |
44 FX_BOOL m_bBtnDown; | 50 FX_BOOL m_bBtnDown; |
45 friend class CFWL_CheckBoxImpDelegate; | |
46 }; | 51 }; |
| 52 |
47 class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { | 53 class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { |
48 public: | 54 public: |
49 CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); | 55 CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); |
| 56 |
50 void OnProcessMessage(CFWL_Message* pMessage) override; | 57 void OnProcessMessage(CFWL_Message* pMessage) override; |
51 void OnDrawWidget(CFX_Graphics* pGraphics, | 58 void OnDrawWidget(CFX_Graphics* pGraphics, |
52 const CFX_Matrix* pMatrix = NULL) override; | 59 const CFX_Matrix* pMatrix = NULL) override; |
53 | 60 |
54 protected: | 61 protected: |
55 void OnActivate(CFWL_Message* pMsg); | 62 void OnActivate(CFWL_Message* pMsg); |
56 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 63 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
57 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 64 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
58 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 65 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
59 void OnMouseMove(CFWL_MsgMouse* pMsg); | 66 void OnMouseMove(CFWL_MsgMouse* pMsg); |
60 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 67 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
61 void OnKeyDown(CFWL_MsgKey* pMsg); | 68 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 69 |
62 CFWL_CheckBoxImp* m_pOwner; | 70 CFWL_CheckBoxImp* m_pOwner; |
63 }; | 71 }; |
64 | 72 |
65 #endif // XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ | 73 #endif // XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ |
OLD | NEW |