| 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_CORE_IFWL_SCROLLBAR_H_ |
| 8 #define XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | 8 #define XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
| 9 | 9 |
| 10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "core/fxcrt/fx_system.h" |
| 11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
| 12 #include "xfa/fwl/core/fwl_error.h" |
| 13 #include "xfa/fwl/core/ifwl_dataprovider.h" |
| 11 #include "xfa/fwl/core/ifwl_timer.h" | 14 #include "xfa/fwl/core/ifwl_timer.h" |
| 12 #include "xfa/fwl/core/ifwl_widget.h" | 15 #include "xfa/fwl/core/ifwl_widget.h" |
| 13 | 16 |
| 17 class CFWL_ScrollBarImpDelegate; |
| 14 class CFWL_WidgetImpProperties; | 18 class CFWL_WidgetImpProperties; |
| 15 class IFWL_Widget; | 19 class IFWL_Widget; |
| 16 class CFWL_ScrollBarImpDelegate; | |
| 17 | 20 |
| 18 class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { | 21 #define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR" |
| 22 #define FWL_STYLEEXT_SCB_Horz (0L << 0) |
| 23 #define FWL_STYLEEXT_SCB_Vert (1L << 0) |
| 24 |
| 25 enum FWL_SCBCODE { |
| 26 FWL_SCBCODE_None = 1, |
| 27 FWL_SCBCODE_Min, |
| 28 FWL_SCBCODE_Max, |
| 29 FWL_SCBCODE_PageBackward, |
| 30 FWL_SCBCODE_PageForward, |
| 31 FWL_SCBCODE_StepBackward, |
| 32 FWL_SCBCODE_StepForward, |
| 33 FWL_SCBCODE_Pos, |
| 34 FWL_SCBCODE_TrackPos, |
| 35 FWL_SCBCODE_EndScroll, |
| 36 }; |
| 37 |
| 38 class IFWL_ScrollBarDP : public IFWL_DataProvider {}; |
| 39 |
| 40 class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer { |
| 19 public: | 41 public: |
| 20 CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, | 42 static IFWL_ScrollBar* Create(const CFWL_WidgetImpProperties& properties, |
| 21 IFWL_Widget* pOuter); | 43 IFWL_Widget* pOuter); |
| 22 ~CFWL_ScrollBarImp() override; | |
| 23 | 44 |
| 24 // CFWL_WidgetImp | 45 IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties, |
| 46 IFWL_Widget* pOuter); |
| 47 ~IFWL_ScrollBar() override; |
| 48 |
| 49 // IFWL_Widget |
| 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | 50 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
| 26 FWL_Type GetClassID() const override; | 51 FWL_Type GetClassID() const override; |
| 27 FWL_Error Initialize() override; | 52 FWL_Error Initialize() override; |
| 28 FWL_Error Finalize() override; | 53 FWL_Error Finalize() override; |
| 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 54 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 30 FWL_Error Update() override; | 55 FWL_Error Update() override; |
| 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 56 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 32 const CFX_Matrix* pMatrix = nullptr) override; | 57 const CFX_Matrix* pMatrix = nullptr) override; |
| 33 | 58 |
| 34 // IFWL_Timer | 59 // IFWL_Timer |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 FX_FLOAT m_fButtonLen; | 122 FX_FLOAT m_fButtonLen; |
| 98 FX_BOOL m_bMinSize; | 123 FX_BOOL m_bMinSize; |
| 99 CFX_RectF m_rtClient; | 124 CFX_RectF m_rtClient; |
| 100 CFX_RectF m_rtThumb; | 125 CFX_RectF m_rtThumb; |
| 101 CFX_RectF m_rtMinBtn; | 126 CFX_RectF m_rtMinBtn; |
| 102 CFX_RectF m_rtMaxBtn; | 127 CFX_RectF m_rtMaxBtn; |
| 103 CFX_RectF m_rtMinTrack; | 128 CFX_RectF m_rtMinTrack; |
| 104 CFX_RectF m_rtMaxTrack; | 129 CFX_RectF m_rtMaxTrack; |
| 105 FX_BOOL m_bCustomLayout; | 130 FX_BOOL m_bCustomLayout; |
| 106 FX_FLOAT m_fMinThumb; | 131 FX_FLOAT m_fMinThumb; |
| 132 |
| 133 protected: |
| 134 IFWL_ScrollBar(); |
| 107 }; | 135 }; |
| 108 | 136 |
| 109 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { | 137 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { |
| 110 public: | 138 public: |
| 111 CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); | 139 CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner); |
| 112 void OnProcessMessage(CFWL_Message* pMessage) override; | 140 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 113 void OnDrawWidget(CFX_Graphics* pGraphics, | 141 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 114 const CFX_Matrix* pMatrix = nullptr) override; | 142 const CFX_Matrix* pMatrix = nullptr) override; |
| 115 | 143 |
| 116 protected: | 144 protected: |
| 117 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 145 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 118 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 146 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 119 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 147 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
| 120 void OnMouseLeave(); | 148 void OnMouseLeave(); |
| 121 void OnMouseWheel(FX_FLOAT fx, | 149 void OnMouseWheel(FX_FLOAT fx, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 FX_FLOAT fx, | 162 FX_FLOAT fx, |
| 135 FX_FLOAT fy); | 163 FX_FLOAT fy); |
| 136 void DoMouseMove(int32_t iItem, | 164 void DoMouseMove(int32_t iItem, |
| 137 const CFX_RectF& rtItem, | 165 const CFX_RectF& rtItem, |
| 138 int32_t& iState, | 166 int32_t& iState, |
| 139 FX_FLOAT fx, | 167 FX_FLOAT fx, |
| 140 FX_FLOAT fy); | 168 FX_FLOAT fy); |
| 141 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 169 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
| 142 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); | 170 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState); |
| 143 | 171 |
| 144 CFWL_ScrollBarImp* m_pOwner; | 172 IFWL_ScrollBar* m_pOwner; |
| 145 }; | 173 }; |
| 146 | 174 |
| 147 #endif // XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_ | 175 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ |
| OLD | NEW |