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