| 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; | |
| 18 class CFWL_WidgetImpProperties; | 17 class CFWL_WidgetImpProperties; |
| 19 class IFWL_Widget; | 18 class IFWL_Widget; |
| 20 | 19 |
| 21 #define FWL_STYLEEXT_SCB_Horz (0L << 0) | 20 #define FWL_STYLEEXT_SCB_Horz (0L << 0) |
| 22 #define FWL_STYLEEXT_SCB_Vert (1L << 0) | 21 #define FWL_STYLEEXT_SCB_Vert (1L << 0) |
| 23 | 22 |
| 24 enum FWL_SCBCODE { | 23 enum FWL_SCBCODE { |
| 25 FWL_SCBCODE_None = 1, | 24 FWL_SCBCODE_None = 1, |
| 26 FWL_SCBCODE_Min, | 25 FWL_SCBCODE_Min, |
| 27 FWL_SCBCODE_Max, | 26 FWL_SCBCODE_Max, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 const CFWL_WidgetImpProperties& properties, | 41 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_Type GetClassID() const override; | 46 FWL_Type GetClassID() const override; |
| 48 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 47 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 49 FWL_Error Update() override; | 48 FWL_Error Update() override; |
| 50 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 49 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 51 const CFX_Matrix* pMatrix = nullptr) override; | 50 const CFX_Matrix* pMatrix = nullptr) override; |
| 51 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 52 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 53 const CFX_Matrix* pMatrix) override; |
| 52 | 54 |
| 53 FX_BOOL IsVertical(); | 55 FX_BOOL IsVertical(); |
| 54 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); | 56 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); |
| 55 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); | 57 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); |
| 56 FX_FLOAT GetPageSize(); | 58 FX_FLOAT GetPageSize(); |
| 57 FWL_Error SetPageSize(FX_FLOAT fPageSize); | 59 FWL_Error SetPageSize(FX_FLOAT fPageSize); |
| 58 FX_FLOAT GetStepSize(); | 60 FX_FLOAT GetStepSize(); |
| 59 FWL_Error SetStepSize(FX_FLOAT fStepSize); | 61 FWL_Error SetStepSize(FX_FLOAT fStepSize); |
| 60 FX_FLOAT GetPos(); | 62 FX_FLOAT GetPos(); |
| 61 FWL_Error SetPos(FX_FLOAT fPos); | 63 FWL_Error SetPos(FX_FLOAT fPos); |
| 62 FX_FLOAT GetTrackPos(); | 64 FX_FLOAT GetTrackPos(); |
| 63 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); | 65 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); |
| 64 FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); | 66 FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); |
| 65 FWL_Error SetOuter(IFWL_Widget* pOuter); | 67 FWL_Error SetOuter(IFWL_Widget* pOuter); |
| 66 | 68 |
| 67 protected: | 69 protected: |
| 68 friend class CFWL_ScrollBarImpDelegate; | |
| 69 | |
| 70 class Timer : public IFWL_Timer { | 70 class Timer : public IFWL_Timer { |
| 71 public: | 71 public: |
| 72 explicit Timer(IFWL_ScrollBar* pToolTip); | 72 explicit Timer(IFWL_ScrollBar* pToolTip); |
| 73 ~Timer() override {} | 73 ~Timer() override {} |
| 74 | 74 |
| 75 void Run(IFWL_TimerInfo* pTimerInfo) override; | 75 void Run(IFWL_TimerInfo* pTimerInfo) override; |
| 76 }; | 76 }; |
| 77 friend class IFWL_ScrollBar::Timer; | 77 friend class IFWL_ScrollBar::Timer; |
| 78 | 78 |
| 79 IFWL_ScrollBar(); | 79 IFWL_ScrollBar(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 FX_BOOL m_bMinSize; | 124 FX_BOOL m_bMinSize; |
| 125 CFX_RectF m_rtClient; | 125 CFX_RectF m_rtClient; |
| 126 CFX_RectF m_rtThumb; | 126 CFX_RectF m_rtThumb; |
| 127 CFX_RectF m_rtMinBtn; | 127 CFX_RectF m_rtMinBtn; |
| 128 CFX_RectF m_rtMaxBtn; | 128 CFX_RectF m_rtMaxBtn; |
| 129 CFX_RectF m_rtMinTrack; | 129 CFX_RectF m_rtMinTrack; |
| 130 CFX_RectF m_rtMaxTrack; | 130 CFX_RectF m_rtMaxTrack; |
| 131 bool m_bCustomLayout; | 131 bool m_bCustomLayout; |
| 132 FX_FLOAT m_fMinThumb; | 132 FX_FLOAT m_fMinThumb; |
| 133 IFWL_ScrollBar::Timer m_Timer; | 133 IFWL_ScrollBar::Timer m_Timer; |
| 134 }; | |
| 135 | 134 |
| 136 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | 135 private: |
| 137 public: | |
| 138 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); | |
| 139 void OnProcessMessage(CFWL_Message* pMessage) override; | |
| 140 void OnDrawWidget(CFX_Graphics* pGraphics, | |
| 141 const CFX_Matrix* pMatrix = nullptr) override; | |
| 142 | |
| 143 protected: | |
| 144 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 136 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 145 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 137 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 146 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 138 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 147 void OnMouseLeave(); | 139 void OnMouseLeave(); |
| 148 void OnMouseWheel(FX_FLOAT fx, | 140 void OnMouseWheel(FX_FLOAT fx, |
| 149 FX_FLOAT fy, | 141 FX_FLOAT fy, |
| 150 uint32_t dwFlags, | 142 uint32_t dwFlags, |
| 151 FX_FLOAT fDeltaX, | 143 FX_FLOAT fDeltaX, |
| 152 FX_FLOAT fDeltaY); | 144 FX_FLOAT fDeltaY); |
| 153 void DoMouseDown(int32_t iItem, | 145 void DoMouseDown(int32_t iItem, |
| 154 const CFX_RectF& rtItem, | 146 const CFX_RectF& rtItem, |
| 155 int32_t& iState, | 147 int32_t& iState, |
| 156 FX_FLOAT fx, | 148 FX_FLOAT fx, |
| 157 FX_FLOAT fy); | 149 FX_FLOAT fy); |
| 158 void DoMouseUp(int32_t iItem, | 150 void DoMouseUp(int32_t iItem, |
| 159 const CFX_RectF& rtItem, | 151 const CFX_RectF& rtItem, |
| 160 int32_t& iState, | 152 int32_t& iState, |
| 161 FX_FLOAT fx, | 153 FX_FLOAT fx, |
| 162 FX_FLOAT fy); | 154 FX_FLOAT fy); |
| 163 void DoMouseMove(int32_t iItem, | 155 void DoMouseMove(int32_t iItem, |
| 164 const CFX_RectF& rtItem, | 156 const CFX_RectF& rtItem, |
| 165 int32_t& iState, | 157 int32_t& iState, |
| 166 FX_FLOAT fx, | 158 FX_FLOAT fx, |
| 167 FX_FLOAT fy); | 159 FX_FLOAT fy); |
| 168 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 160 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
| 169 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 161 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
| 170 | |
| 171 IFWL_ScrollBar* m_pOwner; | |
| 172 }; | 162 }; |
| 173 | 163 |
| 174 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ | 164 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
| OLD | NEW |