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