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_CORE_IFWL_SPINBUTTON_H_ | |
8 #define XFA_FWL_CORE_IFWL_SPINBUTTON_H_ | |
9 | |
10 #include <memory> | |
11 | |
12 #include "xfa/fwl/core/cfwl_event.h" | |
13 #include "xfa/fwl/core/cfwl_timer.h" | |
14 #include "xfa/fwl/core/ifwl_widget.h" | |
15 #include "xfa/fxfa/cxfa_eventparam.h" | |
16 | |
17 #define FWL_STYLEEXE_SPB_Vert (1L << 0) | |
18 | |
19 class CFWL_MsgMouse; | |
20 class CFWL_WidgetProperties; | |
21 | |
22 class IFWL_SpinButton : public IFWL_Widget { | |
23 public: | |
24 IFWL_SpinButton(const CFWL_App* app, | |
25 std::unique_ptr<CFWL_WidgetProperties> properties); | |
26 ~IFWL_SpinButton() override; | |
27 | |
28 // IFWL_Widget | |
29 FWL_Type GetClassID() const override; | |
30 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; | |
31 void Update() override; | |
32 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | |
33 void DrawWidget(CFX_Graphics* pGraphics, | |
34 const CFX_Matrix* pMatrix = nullptr) override; | |
35 void OnProcessMessage(CFWL_Message* pMessage) override; | |
36 void OnProcessEvent(CFWL_Event* pEvent) override; | |
37 void OnDrawWidget(CFX_Graphics* pGraphics, | |
38 const CFX_Matrix* pMatrix) override; | |
39 | |
40 private: | |
41 class Timer : public CFWL_Timer { | |
42 public: | |
43 explicit Timer(IFWL_SpinButton* pToolTip); | |
44 ~Timer() override {} | |
45 | |
46 void Run(CFWL_TimerInfo* pTimerInfo) override; | |
47 }; | |
48 friend class IFWL_SpinButton::Timer; | |
49 | |
50 void EnableButton(bool bEnable, bool bUp = true); | |
51 bool IsButtonEnabled(bool bUp = true); | |
52 void DrawUpButton(CFX_Graphics* pGraphics, | |
53 IFWL_ThemeProvider* pTheme, | |
54 const CFX_Matrix* pMatrix); | |
55 void DrawDownButton(CFX_Graphics* pGraphics, | |
56 IFWL_ThemeProvider* pTheme, | |
57 const CFX_Matrix* pMatrix); | |
58 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); | |
59 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
60 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
61 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
62 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
63 void OnKeyDown(CFWL_MsgKey* pMsg); | |
64 | |
65 CFX_RectF m_rtClient; | |
66 CFX_RectF m_rtUpButton; | |
67 CFX_RectF m_rtDnButton; | |
68 uint32_t m_dwUpState; | |
69 uint32_t m_dwDnState; | |
70 int32_t m_iButtonIndex; | |
71 bool m_bLButtonDwn; | |
72 CFWL_TimerInfo* m_pTimerInfo; | |
73 IFWL_SpinButton::Timer m_Timer; | |
74 }; | |
75 | |
76 #endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_ | |
OLD | NEW |