| 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_SRC_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | |
| 8 #define XFA_SRC_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | |
| 9 | |
| 10 #include "xfa/include/fwl/core/fwl_timer.h" | |
| 11 #include "xfa/src/fwl/core/fwl_widgetimp.h" | |
| 12 | |
| 13 class CFWL_WidgetImpProperties; | |
| 14 class IFWL_Widget; | |
| 15 class CFWL_ScrollBarImpDelegate; | |
| 16 | |
| 17 class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { | |
| 18 public: | |
| 19 CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, | |
| 20 IFWL_Widget* pOuter); | |
| 21 ~CFWL_ScrollBarImp(); | |
| 22 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | |
| 23 virtual FX_DWORD GetClassID() const; | |
| 24 virtual FWL_ERR Initialize(); | |
| 25 virtual FWL_ERR Finalize(); | |
| 26 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | |
| 27 virtual FWL_ERR Update(); | |
| 28 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | |
| 29 const CFX_Matrix* pMatrix = NULL); | |
| 30 virtual FX_BOOL IsVertical(); | |
| 31 virtual FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); | |
| 32 virtual FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); | |
| 33 virtual FX_FLOAT GetPageSize(); | |
| 34 virtual FWL_ERR SetPageSize(FX_FLOAT fPageSize); | |
| 35 virtual FX_FLOAT GetStepSize(); | |
| 36 virtual FWL_ERR SetStepSize(FX_FLOAT fStepSize); | |
| 37 virtual FX_FLOAT GetPos(); | |
| 38 virtual FWL_ERR SetPos(FX_FLOAT fPos); | |
| 39 virtual FX_FLOAT GetTrackPos(); | |
| 40 virtual FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); | |
| 41 virtual FX_BOOL DoScroll(FX_DWORD dwCode, FX_FLOAT fPos = 0.0f); | |
| 42 virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); | |
| 43 virtual int32_t Run(FWL_HTIMER hTimer); | |
| 44 | |
| 45 protected: | |
| 46 void DrawTrack(CFX_Graphics* pGraphics, | |
| 47 IFWL_ThemeProvider* pTheme, | |
| 48 FX_BOOL bLower = TRUE, | |
| 49 const CFX_Matrix* pMatrix = NULL); | |
| 50 void DrawArrowBtn(CFX_Graphics* pGraphics, | |
| 51 IFWL_ThemeProvider* pTheme, | |
| 52 FX_BOOL bMinBtn = TRUE, | |
| 53 const CFX_Matrix* pMatrix = NULL); | |
| 54 void DrawThumb(CFX_Graphics* pGraphics, | |
| 55 IFWL_ThemeProvider* pTheme, | |
| 56 const CFX_Matrix* pMatrix = NULL); | |
| 57 void Layout(); | |
| 58 void CalcButtonLen(); | |
| 59 void CalcMinButtonRect(CFX_RectF& rect); | |
| 60 void CalcMaxButtonRect(CFX_RectF& rect); | |
| 61 void CalcThumbButtonRect(CFX_RectF& rect); | |
| 62 void CalcMinTrackRect(CFX_RectF& rect); | |
| 63 void CalcMaxTrackRect(CFX_RectF& rect); | |
| 64 FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy); | |
| 65 void GetTrackRect(CFX_RectF& rect, FX_BOOL bLower = TRUE); | |
| 66 FX_BOOL SendEvent(); | |
| 67 FX_BOOL OnScroll(FX_DWORD dwCode, FX_FLOAT fPos); | |
| 68 | |
| 69 FWL_HTIMER m_hTimer; | |
| 70 FX_FLOAT m_fRangeMin; | |
| 71 FX_FLOAT m_fRangeMax; | |
| 72 FX_FLOAT m_fPageSize; | |
| 73 FX_FLOAT m_fStepSize; | |
| 74 FX_FLOAT m_fPos; | |
| 75 FX_FLOAT m_fTrackPos; | |
| 76 int32_t m_iMinButtonState; | |
| 77 int32_t m_iMaxButtonState; | |
| 78 int32_t m_iThumbButtonState; | |
| 79 int32_t m_iMinTrackState; | |
| 80 int32_t m_iMaxTrackState; | |
| 81 FX_FLOAT m_fLastTrackPos; | |
| 82 FX_FLOAT m_cpTrackPointX; | |
| 83 FX_FLOAT m_cpTrackPointY; | |
| 84 int32_t m_iMouseWheel; | |
| 85 FX_BOOL m_bTrackMouseLeave; | |
| 86 FX_BOOL m_bMouseHover; | |
| 87 FX_BOOL m_bMouseDown; | |
| 88 FX_BOOL m_bRepaintThumb; | |
| 89 FX_FLOAT m_fButtonLen; | |
| 90 FX_BOOL m_bMinSize; | |
| 91 CFX_RectF m_rtClient; | |
| 92 CFX_RectF m_rtThumb; | |
| 93 CFX_RectF m_rtMinBtn; | |
| 94 CFX_RectF m_rtMaxBtn; | |
| 95 CFX_RectF m_rtMinTrack; | |
| 96 CFX_RectF m_rtMaxTrack; | |
| 97 FX_BOOL m_bCustomLayout; | |
| 98 FX_FLOAT m_fMinThumb; | |
| 99 friend class CFWL_ScrollBarImpDelegate; | |
| 100 }; | |
| 101 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | |
| 102 public: | |
| 103 CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); | |
| 104 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | |
| 105 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | |
| 106 const CFX_Matrix* pMatrix = NULL) override; | |
| 107 | |
| 108 protected: | |
| 109 void OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); | |
| 110 void OnLButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); | |
| 111 void OnMouseMove(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); | |
| 112 void OnMouseLeave(); | |
| 113 void OnMouseWheel(FX_FLOAT fx, | |
| 114 FX_FLOAT fy, | |
| 115 FX_DWORD dwFlags, | |
| 116 FX_FLOAT fDeltaX, | |
| 117 FX_FLOAT fDeltaY); | |
| 118 void DoMouseDown(int32_t iItem, | |
| 119 const CFX_RectF& rtItem, | |
| 120 int32_t& iState, | |
| 121 FX_FLOAT fx, | |
| 122 FX_FLOAT fy); | |
| 123 void DoMouseUp(int32_t iItem, | |
| 124 const CFX_RectF& rtItem, | |
| 125 int32_t& iState, | |
| 126 FX_FLOAT fx, | |
| 127 FX_FLOAT fy); | |
| 128 void DoMouseMove(int32_t iItem, | |
| 129 const CFX_RectF& rtItem, | |
| 130 int32_t& iState, | |
| 131 FX_FLOAT fx, | |
| 132 FX_FLOAT fy); | |
| 133 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); | |
| 135 | |
| 136 CFWL_ScrollBarImp* m_pOwner; | |
| 137 }; | |
| 138 | |
| 139 #endif // XFA_SRC_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | |
| OLD | NEW |