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" |
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
12 #include "xfa/fwl/core/fwl_error.h" | 12 #include "xfa/fwl/core/fwl_error.h" |
13 #include "xfa/fwl/core/ifwl_dataprovider.h" | 13 #include "xfa/fwl/core/ifwl_dataprovider.h" |
14 #include "xfa/fwl/core/ifwl_timer.h" | 14 #include "xfa/fwl/core/ifwl_timer.h" |
15 #include "xfa/fwl/core/ifwl_widget.h" | 15 #include "xfa/fwl/core/ifwl_widget.h" |
16 | 16 |
17 class CFWL_ScrollBarImpDelegate; | 17 class CFWL_ScrollBarImpDelegate; |
18 class CFWL_WidgetImpProperties; | 18 class CFWL_WidgetImpProperties; |
19 class IFWL_Widget; | 19 class IFWL_Widget; |
20 | 20 |
21 #define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR" | |
22 #define FWL_STYLEEXT_SCB_Horz (0L << 0) | 21 #define FWL_STYLEEXT_SCB_Horz (0L << 0) |
23 #define FWL_STYLEEXT_SCB_Vert (1L << 0) | 22 #define FWL_STYLEEXT_SCB_Vert (1L << 0) |
24 | 23 |
25 enum FWL_SCBCODE { | 24 enum FWL_SCBCODE { |
26 FWL_SCBCODE_None = 1, | 25 FWL_SCBCODE_None = 1, |
27 FWL_SCBCODE_Min, | 26 FWL_SCBCODE_Min, |
28 FWL_SCBCODE_Max, | 27 FWL_SCBCODE_Max, |
29 FWL_SCBCODE_PageBackward, | 28 FWL_SCBCODE_PageBackward, |
30 FWL_SCBCODE_PageForward, | 29 FWL_SCBCODE_PageForward, |
31 FWL_SCBCODE_StepBackward, | 30 FWL_SCBCODE_StepBackward, |
32 FWL_SCBCODE_StepForward, | 31 FWL_SCBCODE_StepForward, |
33 FWL_SCBCODE_Pos, | 32 FWL_SCBCODE_Pos, |
34 FWL_SCBCODE_TrackPos, | 33 FWL_SCBCODE_TrackPos, |
35 FWL_SCBCODE_EndScroll, | 34 FWL_SCBCODE_EndScroll, |
36 }; | 35 }; |
37 | 36 |
38 class IFWL_ScrollBarDP : public IFWL_DataProvider {}; | 37 class IFWL_ScrollBarDP : public IFWL_DataProvider {}; |
39 | 38 |
40 class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { | 39 class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { |
41 public: | 40 public: |
42 IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, | 41 IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, |
43 IFWL_Widget* pOuter); | 42 IFWL_Widget* pOuter); |
44 ~IFWL_ScrollBar() override; | 43 ~IFWL_ScrollBar() override; |
45 | 44 |
46 // IFWL_Widget | 45 // IFWL_Widget |
47 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | |
48 FWL_Type GetClassID() const override; | 46 FWL_Type GetClassID() const override; |
49 FWL_Error Initialize() override; | 47 FWL_Error Initialize() override; |
50 FWL_Error Finalize() override; | 48 void Finalize() override; |
51 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 49 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
52 FWL_Error Update() override; | 50 FWL_Error Update() override; |
53 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 51 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
54 const CFX_Matrix* pMatrix = nullptr) override; | 52 const CFX_Matrix* pMatrix = nullptr) override; |
55 | 53 |
56 // IFWL_Timer | 54 // IFWL_Timer |
57 void Run(IFWL_TimerInfo* pTimerInfo) override; | 55 void Run(IFWL_TimerInfo* pTimerInfo) override; |
58 | 56 |
59 FX_BOOL IsVertical(); | 57 FX_BOOL IsVertical(); |
60 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); | 58 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FX_BOOL m_bMouseDown; | 115 FX_BOOL m_bMouseDown; |
118 FX_BOOL m_bRepaintThumb; | 116 FX_BOOL m_bRepaintThumb; |
119 FX_FLOAT m_fButtonLen; | 117 FX_FLOAT m_fButtonLen; |
120 FX_BOOL m_bMinSize; | 118 FX_BOOL m_bMinSize; |
121 CFX_RectF m_rtClient; | 119 CFX_RectF m_rtClient; |
122 CFX_RectF m_rtThumb; | 120 CFX_RectF m_rtThumb; |
123 CFX_RectF m_rtMinBtn; | 121 CFX_RectF m_rtMinBtn; |
124 CFX_RectF m_rtMaxBtn; | 122 CFX_RectF m_rtMaxBtn; |
125 CFX_RectF m_rtMinTrack; | 123 CFX_RectF m_rtMinTrack; |
126 CFX_RectF m_rtMaxTrack; | 124 CFX_RectF m_rtMaxTrack; |
127 FX_BOOL m_bCustomLayout; | 125 bool m_bCustomLayout; |
128 FX_FLOAT m_fMinThumb; | 126 FX_FLOAT m_fMinThumb; |
129 | 127 |
130 protected: | 128 protected: |
131 IFWL_ScrollBar(); | 129 IFWL_ScrollBar(); |
132 }; | 130 }; |
133 | 131 |
134 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | 132 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { |
135 public: | 133 public: |
136 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); | 134 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); |
137 void OnProcessMessage(CFWL_Message* pMessage) override; | 135 void OnProcessMessage(CFWL_Message* pMessage) override; |
(...skipping 25 matching lines...) Expand all Loading... |
163 int32_t& iState, | 161 int32_t& iState, |
164 FX_FLOAT fx, | 162 FX_FLOAT fx, |
165 FX_FLOAT fy); | 163 FX_FLOAT fy); |
166 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 164 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
167 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 165 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
168 | 166 |
169 IFWL_ScrollBar* m_pOwner; | 167 IFWL_ScrollBar* m_pOwner; |
170 }; | 168 }; |
171 | 169 |
172 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ | 170 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
OLD | NEW |