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_SCROLLBARIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_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 | 13 |
13 class CFWL_WidgetImpProperties; | 14 class CFWL_WidgetImpProperties; |
14 class IFWL_Widget; | 15 class IFWL_Widget; |
15 class CFWL_ScrollBarImpDelegate; | 16 class CFWL_ScrollBarImpDelegate; |
16 | 17 |
17 class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { | 18 class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { |
18 public: | 19 public: |
19 CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, | 20 CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, |
20 IFWL_Widget* pOuter); | 21 IFWL_Widget* pOuter); |
21 ~CFWL_ScrollBarImp(); | 22 ~CFWL_ScrollBarImp() 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 FX_BOOL IsVertical(); | 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
31 virtual FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); | 32 const CFX_Matrix* pMatrix = nullptr) override; |
32 virtual FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); | 33 |
33 virtual FX_FLOAT GetPageSize(); | 34 // IFWL_Timer |
34 virtual FWL_Error SetPageSize(FX_FLOAT fPageSize); | 35 int32_t Run(FWL_HTIMER hTimer) override; |
35 virtual FX_FLOAT GetStepSize(); | 36 |
36 virtual FWL_Error SetStepSize(FX_FLOAT fStepSize); | 37 FX_BOOL IsVertical(); |
37 virtual FX_FLOAT GetPos(); | 38 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); |
38 virtual FWL_Error SetPos(FX_FLOAT fPos); | 39 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); |
39 virtual FX_FLOAT GetTrackPos(); | 40 FX_FLOAT GetPageSize(); |
40 virtual FWL_Error SetTrackPos(FX_FLOAT fTrackPos); | 41 FWL_Error SetPageSize(FX_FLOAT fPageSize); |
41 virtual FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); | 42 FX_FLOAT GetStepSize(); |
42 virtual FWL_Error SetOuter(IFWL_Widget* pOuter); | 43 FWL_Error SetStepSize(FX_FLOAT fStepSize); |
43 virtual int32_t Run(FWL_HTIMER hTimer); | 44 FX_FLOAT GetPos(); |
| 45 FWL_Error SetPos(FX_FLOAT fPos); |
| 46 FX_FLOAT GetTrackPos(); |
| 47 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); |
| 48 FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); |
| 49 FWL_Error SetOuter(IFWL_Widget* pOuter); |
44 | 50 |
45 protected: | 51 protected: |
| 52 friend class CFWL_ScrollBarImpDelegate; |
| 53 |
46 void DrawTrack(CFX_Graphics* pGraphics, | 54 void DrawTrack(CFX_Graphics* pGraphics, |
47 IFWL_ThemeProvider* pTheme, | 55 IFWL_ThemeProvider* pTheme, |
48 FX_BOOL bLower = TRUE, | 56 FX_BOOL bLower = TRUE, |
49 const CFX_Matrix* pMatrix = NULL); | 57 const CFX_Matrix* pMatrix = NULL); |
50 void DrawArrowBtn(CFX_Graphics* pGraphics, | 58 void DrawArrowBtn(CFX_Graphics* pGraphics, |
51 IFWL_ThemeProvider* pTheme, | 59 IFWL_ThemeProvider* pTheme, |
52 FX_BOOL bMinBtn = TRUE, | 60 FX_BOOL bMinBtn = TRUE, |
53 const CFX_Matrix* pMatrix = NULL); | 61 const CFX_Matrix* pMatrix = NULL); |
54 void DrawThumb(CFX_Graphics* pGraphics, | 62 void DrawThumb(CFX_Graphics* pGraphics, |
55 IFWL_ThemeProvider* pTheme, | 63 IFWL_ThemeProvider* pTheme, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 FX_FLOAT m_fButtonLen; | 97 FX_FLOAT m_fButtonLen; |
90 FX_BOOL m_bMinSize; | 98 FX_BOOL m_bMinSize; |
91 CFX_RectF m_rtClient; | 99 CFX_RectF m_rtClient; |
92 CFX_RectF m_rtThumb; | 100 CFX_RectF m_rtThumb; |
93 CFX_RectF m_rtMinBtn; | 101 CFX_RectF m_rtMinBtn; |
94 CFX_RectF m_rtMaxBtn; | 102 CFX_RectF m_rtMaxBtn; |
95 CFX_RectF m_rtMinTrack; | 103 CFX_RectF m_rtMinTrack; |
96 CFX_RectF m_rtMaxTrack; | 104 CFX_RectF m_rtMaxTrack; |
97 FX_BOOL m_bCustomLayout; | 105 FX_BOOL m_bCustomLayout; |
98 FX_FLOAT m_fMinThumb; | 106 FX_FLOAT m_fMinThumb; |
99 friend class CFWL_ScrollBarImpDelegate; | |
100 }; | 107 }; |
| 108 |
101 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | 109 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { |
102 public: | 110 public: |
103 CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); | 111 CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); |
104 void OnProcessMessage(CFWL_Message* pMessage) override; | 112 void OnProcessMessage(CFWL_Message* pMessage) override; |
105 void OnDrawWidget(CFX_Graphics* pGraphics, | 113 void OnDrawWidget(CFX_Graphics* pGraphics, |
106 const CFX_Matrix* pMatrix = NULL) override; | 114 const CFX_Matrix* pMatrix = NULL) override; |
107 | 115 |
108 protected: | 116 protected: |
109 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 117 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
110 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 118 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
(...skipping 19 matching lines...) Expand all Loading... |
130 int32_t& iState, | 138 int32_t& iState, |
131 FX_FLOAT fx, | 139 FX_FLOAT fx, |
132 FX_FLOAT fy); | 140 FX_FLOAT fy); |
133 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 141 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
134 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 142 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
135 | 143 |
136 CFWL_ScrollBarImp* m_pOwner; | 144 CFWL_ScrollBarImp* m_pOwner; |
137 }; | 145 }; |
138 | 146 |
139 #endif // XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | 147 #endif // XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ |
OLD | NEW |