Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: xfa/fwl/core/ifwl_scrollbar.h

Issue 2489013002: Continue cleaning IFWL classes (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | xfa/fwl/core/ifwl_scrollbar.cpp » ('j') | xfa/fwl/core/ifwl_scrollbar.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_widgetproperties.h" 11 #include "xfa/fwl/core/cfwl_widgetproperties.h"
12 #include "xfa/fwl/core/fwl_error.h"
13 #include "xfa/fwl/core/ifwl_dataprovider.h" 12 #include "xfa/fwl/core/ifwl_dataprovider.h"
14 #include "xfa/fwl/core/ifwl_timer.h" 13 #include "xfa/fwl/core/ifwl_timer.h"
15 #include "xfa/fwl/core/ifwl_widget.h" 14 #include "xfa/fwl/core/ifwl_widget.h"
16 15
17 class IFWL_Widget; 16 class IFWL_Widget;
18 17
19 #define FWL_STYLEEXT_SCB_Horz (0L << 0) 18 #define FWL_STYLEEXT_SCB_Horz (0L << 0)
20 #define FWL_STYLEEXT_SCB_Vert (1L << 0) 19 #define FWL_STYLEEXT_SCB_Vert (1L << 0)
21 20
22 enum FWL_SCBCODE { 21 enum FWL_SCBCODE {
(...skipping 21 matching lines...) Expand all
44 // IFWL_Widget 43 // IFWL_Widget
45 FWL_Type GetClassID() const override; 44 FWL_Type GetClassID() const override;
46 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; 45 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
47 void Update() override; 46 void Update() override;
48 void DrawWidget(CFX_Graphics* pGraphics, 47 void DrawWidget(CFX_Graphics* pGraphics,
49 const CFX_Matrix* pMatrix = nullptr) override; 48 const CFX_Matrix* pMatrix = nullptr) override;
50 void OnProcessMessage(CFWL_Message* pMessage) override; 49 void OnProcessMessage(CFWL_Message* pMessage) override;
51 void OnDrawWidget(CFX_Graphics* pGraphics, 50 void OnDrawWidget(CFX_Graphics* pGraphics,
52 const CFX_Matrix* pMatrix) override; 51 const CFX_Matrix* pMatrix) override;
53 52
54 bool IsVertical(); 53 void GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) const {
55 FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); 54 fMin = m_fRangeMin;
56 FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); 55 fMax = m_fRangeMax;
57 FX_FLOAT GetPageSize(); 56 }
58 FWL_Error SetPageSize(FX_FLOAT fPageSize); 57 void SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
59 FX_FLOAT GetStepSize(); 58 m_fRangeMin = fMin;
60 FWL_Error SetStepSize(FX_FLOAT fStepSize); 59 m_fRangeMax = fMax;
61 FX_FLOAT GetPos(); 60 }
62 FWL_Error SetPos(FX_FLOAT fPos); 61 FX_FLOAT GetPageSize() const { return m_fPageSize; }
63 FX_FLOAT GetTrackPos(); 62 void SetPageSize(FX_FLOAT fPageSize) { m_fPageSize = fPageSize; }
64 FWL_Error SetTrackPos(FX_FLOAT fTrackPos); 63 FX_FLOAT GetStepSize() const { return m_fStepSize; }
65 bool DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); 64 void SetStepSize(FX_FLOAT fStepSize) { m_fStepSize = fStepSize; }
66 FWL_Error SetOuter(IFWL_Widget* pOuter); 65 FX_FLOAT GetPos() const { return m_fPos; }
66 void SetPos(FX_FLOAT fPos) { m_fPos = fPos; }
67 void SetTrackPos(FX_FLOAT fTrackPos);
67 68
68 protected: 69 private:
69 class Timer : public IFWL_Timer { 70 class Timer : public IFWL_Timer {
70 public: 71 public:
71 explicit Timer(IFWL_ScrollBar* pToolTip); 72 explicit Timer(IFWL_ScrollBar* pToolTip);
72 ~Timer() override {} 73 ~Timer() override {}
73 74
74 void Run(IFWL_TimerInfo* pTimerInfo) override; 75 void Run(IFWL_TimerInfo* pTimerInfo) override;
75 }; 76 };
76 friend class IFWL_ScrollBar::Timer; 77 friend class IFWL_ScrollBar::Timer;
77 78
78 IFWL_ScrollBar(); 79 bool IsVertical() const {
80 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert;
Tom Sepez 2016/11/09 17:46:02 nit: should be return !!(m_pProperties->m_dwSty
dsinclair 2016/11/09 18:25:57 Done.
81 }
79 void DrawTrack(CFX_Graphics* pGraphics, 82 void DrawTrack(CFX_Graphics* pGraphics,
80 IFWL_ThemeProvider* pTheme, 83 IFWL_ThemeProvider* pTheme,
81 bool bLower = true, 84 bool bLower = true,
82 const CFX_Matrix* pMatrix = nullptr); 85 const CFX_Matrix* pMatrix = nullptr);
83 void DrawArrowBtn(CFX_Graphics* pGraphics, 86 void DrawArrowBtn(CFX_Graphics* pGraphics,
84 IFWL_ThemeProvider* pTheme, 87 IFWL_ThemeProvider* pTheme,
85 bool bMinBtn = true, 88 bool bMinBtn = true,
86 const CFX_Matrix* pMatrix = nullptr); 89 const CFX_Matrix* pMatrix = nullptr);
87 void DrawThumb(CFX_Graphics* pGraphics, 90 void DrawThumb(CFX_Graphics* pGraphics,
88 IFWL_ThemeProvider* pTheme, 91 IFWL_ThemeProvider* pTheme,
89 const CFX_Matrix* pMatrix = nullptr); 92 const CFX_Matrix* pMatrix = nullptr);
90 void Layout(); 93 void Layout();
91 void CalcButtonLen(); 94 void CalcButtonLen();
92 void CalcMinButtonRect(CFX_RectF& rect); 95 void CalcMinButtonRect(CFX_RectF& rect);
93 void CalcMaxButtonRect(CFX_RectF& rect); 96 void CalcMaxButtonRect(CFX_RectF& rect);
94 void CalcThumbButtonRect(CFX_RectF& rect); 97 void CalcThumbButtonRect(CFX_RectF& rect);
95 void CalcMinTrackRect(CFX_RectF& rect); 98 void CalcMinTrackRect(CFX_RectF& rect);
96 void CalcMaxTrackRect(CFX_RectF& rect); 99 void CalcMaxTrackRect(CFX_RectF& rect);
97 FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy); 100 FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy);
98 void GetTrackRect(CFX_RectF& rect, bool bLower = true); 101 void GetTrackRect(CFX_RectF& rect, bool bLower = true);
99 bool SendEvent(); 102 bool SendEvent();
100 bool OnScroll(uint32_t dwCode, FX_FLOAT fPos); 103 bool OnScroll(uint32_t dwCode, FX_FLOAT fPos);
104 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
105 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
106 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
107 void OnMouseLeave();
108 void OnMouseWheel(FX_FLOAT fx,
109 FX_FLOAT fy,
110 uint32_t dwFlags,
111 FX_FLOAT fDeltaX,
112 FX_FLOAT fDeltaY);
113 bool DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f);
114 void DoMouseDown(int32_t iItem,
115 const CFX_RectF& rtItem,
116 int32_t& iState,
117 FX_FLOAT fx,
118 FX_FLOAT fy);
119 void DoMouseUp(int32_t iItem,
120 const CFX_RectF& rtItem,
121 int32_t& iState,
122 FX_FLOAT fx,
123 FX_FLOAT fy);
124 void DoMouseMove(int32_t iItem,
125 const CFX_RectF& rtItem,
126 int32_t& iState,
127 FX_FLOAT fx,
128 FX_FLOAT fy);
129 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
130 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
101 131
102 IFWL_TimerInfo* m_pTimerInfo; 132 IFWL_TimerInfo* m_pTimerInfo;
103 FX_FLOAT m_fRangeMin; 133 FX_FLOAT m_fRangeMin;
104 FX_FLOAT m_fRangeMax; 134 FX_FLOAT m_fRangeMax;
105 FX_FLOAT m_fPageSize; 135 FX_FLOAT m_fPageSize;
106 FX_FLOAT m_fStepSize; 136 FX_FLOAT m_fStepSize;
107 FX_FLOAT m_fPos; 137 FX_FLOAT m_fPos;
108 FX_FLOAT m_fTrackPos; 138 FX_FLOAT m_fTrackPos;
109 int32_t m_iMinButtonState; 139 int32_t m_iMinButtonState;
110 int32_t m_iMaxButtonState; 140 int32_t m_iMaxButtonState;
111 int32_t m_iThumbButtonState; 141 int32_t m_iThumbButtonState;
112 int32_t m_iMinTrackState; 142 int32_t m_iMinTrackState;
113 int32_t m_iMaxTrackState; 143 int32_t m_iMaxTrackState;
114 FX_FLOAT m_fLastTrackPos; 144 FX_FLOAT m_fLastTrackPos;
115 FX_FLOAT m_cpTrackPointX; 145 FX_FLOAT m_cpTrackPointX;
116 FX_FLOAT m_cpTrackPointY; 146 FX_FLOAT m_cpTrackPointY;
117 int32_t m_iMouseWheel; 147 int32_t m_iMouseWheel;
118 bool m_bTrackMouseLeave;
119 bool m_bMouseHover;
120 bool m_bMouseDown; 148 bool m_bMouseDown;
121 bool m_bRepaintThumb;
122 FX_FLOAT m_fButtonLen; 149 FX_FLOAT m_fButtonLen;
123 bool m_bMinSize; 150 bool m_bMinSize;
124 CFX_RectF m_rtClient; 151 CFX_RectF m_rtClient;
125 CFX_RectF m_rtThumb; 152 CFX_RectF m_rtThumb;
126 CFX_RectF m_rtMinBtn; 153 CFX_RectF m_rtMinBtn;
127 CFX_RectF m_rtMaxBtn; 154 CFX_RectF m_rtMaxBtn;
128 CFX_RectF m_rtMinTrack; 155 CFX_RectF m_rtMinTrack;
129 CFX_RectF m_rtMaxTrack; 156 CFX_RectF m_rtMaxTrack;
130 bool m_bCustomLayout; 157 bool m_bCustomLayout;
131 FX_FLOAT m_fMinThumb; 158 FX_FLOAT m_fMinThumb;
132 IFWL_ScrollBar::Timer m_Timer; 159 IFWL_ScrollBar::Timer m_Timer;
133
134 private:
135 void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
136 void OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
137 void OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy);
138 void OnMouseLeave();
139 void OnMouseWheel(FX_FLOAT fx,
140 FX_FLOAT fy,
141 uint32_t dwFlags,
142 FX_FLOAT fDeltaX,
143 FX_FLOAT fDeltaY);
144 void DoMouseDown(int32_t iItem,
145 const CFX_RectF& rtItem,
146 int32_t& iState,
147 FX_FLOAT fx,
148 FX_FLOAT fy);
149 void DoMouseUp(int32_t iItem,
150 const CFX_RectF& rtItem,
151 int32_t& iState,
152 FX_FLOAT fx,
153 FX_FLOAT fy);
154 void DoMouseMove(int32_t iItem,
155 const CFX_RectF& rtItem,
156 int32_t& iState,
157 FX_FLOAT fx,
158 FX_FLOAT fy);
159 void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
160 void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
161 }; 160 };
162 161
163 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_ 162 #endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_
OLDNEW
« no previous file with comments | « no previous file | xfa/fwl/core/ifwl_scrollbar.cpp » ('j') | xfa/fwl/core/ifwl_scrollbar.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698