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_CORE_IFWL_SCROLLBAR_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
8 #define XFA_FWL_CORE_IFWL_SCROLLBAR_H_ | 8 #define XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
9 | 9 |
10 #include "core/fxcrt/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 FWL_SCBCODE_PageForward, | 29 FWL_SCBCODE_PageForward, |
30 FWL_SCBCODE_StepBackward, | 30 FWL_SCBCODE_StepBackward, |
31 FWL_SCBCODE_StepForward, | 31 FWL_SCBCODE_StepForward, |
32 FWL_SCBCODE_Pos, | 32 FWL_SCBCODE_Pos, |
33 FWL_SCBCODE_TrackPos, | 33 FWL_SCBCODE_TrackPos, |
34 FWL_SCBCODE_EndScroll, | 34 FWL_SCBCODE_EndScroll, |
35 }; | 35 }; |
36 | 36 |
37 class IFWL_ScrollBarDP : public IFWL_DataProvider {}; | 37 class IFWL_ScrollBarDP : public IFWL_DataProvider {}; |
38 | 38 |
39 class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { | 39 class IFWL_ScrollBar : public IFWL_Widget { |
40 public: | 40 public: |
41 IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, | 41 IFWL_ScrollBar(const IFWL_App* app, |
| 42 const CFWL_WidgetImpProperties& properties, |
42 IFWL_Widget* pOuter); | 43 IFWL_Widget* pOuter); |
43 ~IFWL_ScrollBar() override; | 44 ~IFWL_ScrollBar() override; |
44 | 45 |
45 // IFWL_Widget | 46 // IFWL_Widget |
| 47 void Initialize() override; |
| 48 void Finalize() override; |
46 FWL_Type GetClassID() const override; | 49 FWL_Type GetClassID() const override; |
47 FWL_Error Initialize() override; | |
48 void Finalize() override; | |
49 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 50 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
50 FWL_Error Update() override; | 51 FWL_Error Update() override; |
51 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 52 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
52 const CFX_Matrix* pMatrix = nullptr) override; | 53 const CFX_Matrix* pMatrix = nullptr) override; |
53 | 54 |
54 // IFWL_Timer | |
55 void Run(IFWL_TimerInfo* pTimerInfo) override; | |
56 | |
57 FX_BOOL IsVertical(); | 55 FX_BOOL IsVertical(); |
58 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); | 56 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); |
59 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); | 57 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); |
60 FX_FLOAT GetPageSize(); | 58 FX_FLOAT GetPageSize(); |
61 FWL_Error SetPageSize(FX_FLOAT fPageSize); | 59 FWL_Error SetPageSize(FX_FLOAT fPageSize); |
62 FX_FLOAT GetStepSize(); | 60 FX_FLOAT GetStepSize(); |
63 FWL_Error SetStepSize(FX_FLOAT fStepSize); | 61 FWL_Error SetStepSize(FX_FLOAT fStepSize); |
64 FX_FLOAT GetPos(); | 62 FX_FLOAT GetPos(); |
65 FWL_Error SetPos(FX_FLOAT fPos); | 63 FWL_Error SetPos(FX_FLOAT fPos); |
66 FX_FLOAT GetTrackPos(); | 64 FX_FLOAT GetTrackPos(); |
67 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); | 65 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); |
68 FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); | 66 FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); |
69 FWL_Error SetOuter(IFWL_Widget* pOuter); | 67 FWL_Error SetOuter(IFWL_Widget* pOuter); |
70 | 68 |
71 protected: | 69 protected: |
72 friend class CFWL_ScrollBarImpDelegate; | 70 friend class CFWL_ScrollBarImpDelegate; |
73 | 71 |
| 72 class Timer : public IFWL_Timer { |
| 73 public: |
| 74 explicit Timer(IFWL_ScrollBar* pToolTip); |
| 75 ~Timer() override {} |
| 76 |
| 77 void Run(IFWL_TimerInfo* pTimerInfo) override; |
| 78 }; |
| 79 friend class IFWL_ScrollBar::Timer; |
| 80 |
| 81 IFWL_ScrollBar(); |
74 void DrawTrack(CFX_Graphics* pGraphics, | 82 void DrawTrack(CFX_Graphics* pGraphics, |
75 IFWL_ThemeProvider* pTheme, | 83 IFWL_ThemeProvider* pTheme, |
76 FX_BOOL bLower = TRUE, | 84 FX_BOOL bLower = TRUE, |
77 const CFX_Matrix* pMatrix = nullptr); | 85 const CFX_Matrix* pMatrix = nullptr); |
78 void DrawArrowBtn(CFX_Graphics* pGraphics, | 86 void DrawArrowBtn(CFX_Graphics* pGraphics, |
79 IFWL_ThemeProvider* pTheme, | 87 IFWL_ThemeProvider* pTheme, |
80 FX_BOOL bMinBtn = TRUE, | 88 FX_BOOL bMinBtn = TRUE, |
81 const CFX_Matrix* pMatrix = nullptr); | 89 const CFX_Matrix* pMatrix = nullptr); |
82 void DrawThumb(CFX_Graphics* pGraphics, | 90 void DrawThumb(CFX_Graphics* pGraphics, |
83 IFWL_ThemeProvider* pTheme, | 91 IFWL_ThemeProvider* pTheme, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FX_FLOAT m_fButtonLen; | 125 FX_FLOAT m_fButtonLen; |
118 FX_BOOL m_bMinSize; | 126 FX_BOOL m_bMinSize; |
119 CFX_RectF m_rtClient; | 127 CFX_RectF m_rtClient; |
120 CFX_RectF m_rtThumb; | 128 CFX_RectF m_rtThumb; |
121 CFX_RectF m_rtMinBtn; | 129 CFX_RectF m_rtMinBtn; |
122 CFX_RectF m_rtMaxBtn; | 130 CFX_RectF m_rtMaxBtn; |
123 CFX_RectF m_rtMinTrack; | 131 CFX_RectF m_rtMinTrack; |
124 CFX_RectF m_rtMaxTrack; | 132 CFX_RectF m_rtMaxTrack; |
125 bool m_bCustomLayout; | 133 bool m_bCustomLayout; |
126 FX_FLOAT m_fMinThumb; | 134 FX_FLOAT m_fMinThumb; |
127 | 135 IFWL_ScrollBar::Timer m_Timer; |
128 protected: | |
129 IFWL_ScrollBar(); | |
130 }; | 136 }; |
131 | 137 |
132 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | 138 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { |
133 public: | 139 public: |
134 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); | 140 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); |
135 void OnProcessMessage(CFWL_Message* pMessage) override; | 141 void OnProcessMessage(CFWL_Message* pMessage) override; |
136 void OnDrawWidget(CFX_Graphics* pGraphics, | 142 void OnDrawWidget(CFX_Graphics* pGraphics, |
137 const CFX_Matrix* pMatrix = nullptr) override; | 143 const CFX_Matrix* pMatrix = nullptr) override; |
138 | 144 |
139 protected: | 145 protected: |
(...skipping 21 matching lines...) Expand all Loading... |
161 int32_t& iState, | 167 int32_t& iState, |
162 FX_FLOAT fx, | 168 FX_FLOAT fx, |
163 FX_FLOAT fy); | 169 FX_FLOAT fy); |
164 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 170 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
165 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 171 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
166 | 172 |
167 IFWL_ScrollBar* m_pOwner; | 173 IFWL_ScrollBar* m_pOwner; |
168 }; | 174 }; |
169 | 175 |
170 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ | 176 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
OLD | NEW |