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_SPINBUTTONIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_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_timer.h" | 11 #include "xfa/fwl/core/ifwl_timer.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | 12 #include "xfa/fwl/core/ifwl_widget.h" |
13 | 13 |
14 class CFWL_MsgMouse; | 14 class CFWL_MsgMouse; |
15 class CFWL_SpinButtonImpDelegate; | 15 class CFWL_SpinButtonImpDelegate; |
16 class CFWL_WidgetImpProperties; | 16 class CFWL_WidgetImpProperties; |
17 | 17 |
18 class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { | 18 class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { |
19 public: | 19 public: |
20 CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties, | 20 CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties, |
21 IFWL_Widget* pOuter); | 21 IFWL_Widget* pOuter); |
22 ~CFWL_SpinButtonImp(); | 22 ~CFWL_SpinButtonImp() override; |
23 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | 23 |
24 virtual uint32_t GetClassID() const; | 24 // CFWL_WidgetImp |
25 virtual FWL_Error Initialize(); | 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
26 virtual FWL_Error Finalize(); | 26 FWL_Type GetClassID() const override; |
27 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 27 FWL_Error Initialize() override; |
28 virtual FWL_Error Update(); | 28 FWL_Error Finalize() override; |
29 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
30 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 30 FWL_Error Update() override; |
31 const CFX_Matrix* pMatrix = NULL); | 31 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
32 virtual int32_t Run(FWL_HTIMER hTimer); | 32 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 33 const CFX_Matrix* pMatrix = nullptr) override; |
| 34 |
| 35 // IFWL_Timer |
| 36 int32_t Run(FWL_HTIMER hTimer) override; |
| 37 |
33 FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); | 38 FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); |
34 FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); | 39 FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); |
35 | 40 |
36 protected: | 41 protected: |
| 42 friend class CFWL_SpinButtonImpDelegate; |
| 43 |
37 void DrawUpButton(CFX_Graphics* pGraphics, | 44 void DrawUpButton(CFX_Graphics* pGraphics, |
38 IFWL_ThemeProvider* pTheme, | 45 IFWL_ThemeProvider* pTheme, |
39 const CFX_Matrix* pMatrix); | 46 const CFX_Matrix* pMatrix); |
40 void DrawDownButton(CFX_Graphics* pGraphics, | 47 void DrawDownButton(CFX_Graphics* pGraphics, |
41 IFWL_ThemeProvider* pTheme, | 48 IFWL_ThemeProvider* pTheme, |
42 const CFX_Matrix* pMatrix); | 49 const CFX_Matrix* pMatrix); |
| 50 |
43 CFX_RectF m_rtClient; | 51 CFX_RectF m_rtClient; |
44 CFX_RectF m_rtUpButton; | 52 CFX_RectF m_rtUpButton; |
45 CFX_RectF m_rtDnButton; | 53 CFX_RectF m_rtDnButton; |
46 uint32_t m_dwUpState; | 54 uint32_t m_dwUpState; |
47 uint32_t m_dwDnState; | 55 uint32_t m_dwDnState; |
48 int32_t m_iButtonIndex; | 56 int32_t m_iButtonIndex; |
49 FX_BOOL m_bLButtonDwn; | 57 FX_BOOL m_bLButtonDwn; |
50 FWL_HTIMER m_hTimer; | 58 FWL_HTIMER m_hTimer; |
51 friend class CFWL_SpinButtonImpDelegate; | |
52 }; | 59 }; |
53 class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { | 60 class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { |
54 public: | 61 public: |
55 CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner); | 62 CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner); |
56 void OnProcessMessage(CFWL_Message* pMessage) override; | 63 void OnProcessMessage(CFWL_Message* pMessage) override; |
57 void OnProcessEvent(CFWL_Event* pEvent) override; | 64 void OnProcessEvent(CFWL_Event* pEvent) override; |
58 void OnDrawWidget(CFX_Graphics* pGraphics, | 65 void OnDrawWidget(CFX_Graphics* pGraphics, |
59 const CFX_Matrix* pMatrix = NULL) override; | 66 const CFX_Matrix* pMatrix = NULL) override; |
60 | 67 |
61 protected: | 68 protected: |
62 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 69 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
63 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 70 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
64 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 71 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
65 void OnMouseMove(CFWL_MsgMouse* pMsg); | 72 void OnMouseMove(CFWL_MsgMouse* pMsg); |
66 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 73 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
67 void OnKeyDown(CFWL_MsgKey* pMsg); | 74 void OnKeyDown(CFWL_MsgKey* pMsg); |
68 CFWL_SpinButtonImp* m_pOwner; | 75 CFWL_SpinButtonImp* m_pOwner; |
69 }; | 76 }; |
70 | 77 |
71 #endif // XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_ | 78 #endif // XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_ |
OLD | NEW |