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

Side by Side Diff: xfa/fwl/basewidget/fwl_scrollbarimp.cpp

Issue 1943413002: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@bcdattribute
Patch Set: Created 4 years, 7 months 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 | « xfa/fwl/basewidget/fwl_scrollbarimp.h ('k') | xfa/fwl/basewidget/fwl_spinbuttonimp.h » ('j') | no next file with comments »
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 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" 7 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
8 8
9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" 9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
(...skipping 13 matching lines...) Expand all
24 IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar; 24 IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar;
25 CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(properties, pOuter); 25 CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(properties, pOuter);
26 pScrollBar->SetImpl(pScrollBarImpl); 26 pScrollBar->SetImpl(pScrollBarImpl);
27 pScrollBarImpl->SetInterface(pScrollBar); 27 pScrollBarImpl->SetInterface(pScrollBar);
28 return pScrollBar; 28 return pScrollBar;
29 } 29 }
30 IFWL_ScrollBar::IFWL_ScrollBar() {} 30 IFWL_ScrollBar::IFWL_ScrollBar() {}
31 FX_BOOL IFWL_ScrollBar::IsVertical() { 31 FX_BOOL IFWL_ScrollBar::IsVertical() {
32 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->IsVertical(); 32 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->IsVertical();
33 } 33 }
34 FWL_ERR IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { 34 FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
35 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetRange(fMin, fMax); 35 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetRange(fMin, fMax);
36 } 36 }
37 FWL_ERR IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { 37 FWL_Error IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
38 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetRange(fMin, fMax); 38 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetRange(fMin, fMax);
39 } 39 }
40 FX_FLOAT IFWL_ScrollBar::GetPageSize() { 40 FX_FLOAT IFWL_ScrollBar::GetPageSize() {
41 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPageSize(); 41 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPageSize();
42 } 42 }
43 FWL_ERR IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { 43 FWL_Error IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
44 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPageSize(fPageSize); 44 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPageSize(fPageSize);
45 } 45 }
46 FX_FLOAT IFWL_ScrollBar::GetStepSize() { 46 FX_FLOAT IFWL_ScrollBar::GetStepSize() {
47 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetStepSize(); 47 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetStepSize();
48 } 48 }
49 FWL_ERR IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { 49 FWL_Error IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
50 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetStepSize(fStepSize); 50 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetStepSize(fStepSize);
51 } 51 }
52 FX_FLOAT IFWL_ScrollBar::GetPos() { 52 FX_FLOAT IFWL_ScrollBar::GetPos() {
53 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPos(); 53 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPos();
54 } 54 }
55 FWL_ERR IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { 55 FWL_Error IFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
56 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPos(fPos); 56 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPos(fPos);
57 } 57 }
58 FX_FLOAT IFWL_ScrollBar::GetTrackPos() { 58 FX_FLOAT IFWL_ScrollBar::GetTrackPos() {
59 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetTrackPos(); 59 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetTrackPos();
60 } 60 }
61 FWL_ERR IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { 61 FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
62 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetTrackPos(fTrackPos); 62 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetTrackPos(fTrackPos);
63 } 63 }
64 FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { 64 FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
65 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->DoScroll(dwCode, fPos); 65 return static_cast<CFWL_ScrollBarImp*>(GetImpl())->DoScroll(dwCode, fPos);
66 } 66 }
67 CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, 67 CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
68 IFWL_Widget* pOuter) 68 IFWL_Widget* pOuter)
69 : CFWL_WidgetImp(properties, pOuter), 69 : CFWL_WidgetImp(properties, pOuter),
70 m_hTimer(nullptr), 70 m_hTimer(nullptr),
71 m_fRangeMin(0), 71 m_fRangeMin(0),
(...skipping 20 matching lines...) Expand all
92 m_bCustomLayout(FALSE), 92 m_bCustomLayout(FALSE),
93 m_fMinThumb(FWL_SCROLLBAR_MinThumb) { 93 m_fMinThumb(FWL_SCROLLBAR_MinThumb) {
94 m_rtClient.Reset(); 94 m_rtClient.Reset();
95 m_rtThumb.Reset(); 95 m_rtThumb.Reset();
96 m_rtMinBtn.Reset(); 96 m_rtMinBtn.Reset();
97 m_rtMaxBtn.Reset(); 97 m_rtMaxBtn.Reset();
98 m_rtMinTrack.Reset(); 98 m_rtMinTrack.Reset();
99 m_rtMaxTrack.Reset(); 99 m_rtMaxTrack.Reset();
100 } 100 }
101 CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {} 101 CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {}
102 FWL_ERR CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { 102 FWL_Error CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const {
103 wsClass = FWL_CLASS_ScrollBar; 103 wsClass = FWL_CLASS_ScrollBar;
104 return FWL_ERR_Succeeded; 104 return FWL_Error::Succeeded;
105 } 105 }
106 uint32_t CFWL_ScrollBarImp::GetClassID() const { 106 uint32_t CFWL_ScrollBarImp::GetClassID() const {
107 return FWL_CLASSHASH_ScrollBar; 107 return FWL_CLASSHASH_ScrollBar;
108 } 108 }
109 FWL_ERR CFWL_ScrollBarImp::Initialize() { 109 FWL_Error CFWL_ScrollBarImp::Initialize() {
110 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) 110 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
111 return FWL_ERR_Indefinite; 111 return FWL_Error::Indefinite;
112 m_pDelegate = new CFWL_ScrollBarImpDelegate(this); 112 m_pDelegate = new CFWL_ScrollBarImpDelegate(this);
113 return FWL_ERR_Succeeded; 113 return FWL_Error::Succeeded;
114 } 114 }
115 FWL_ERR CFWL_ScrollBarImp::Finalize() { 115 FWL_Error CFWL_ScrollBarImp::Finalize() {
116 delete m_pDelegate; 116 delete m_pDelegate;
117 m_pDelegate = nullptr; 117 m_pDelegate = nullptr;
118 return CFWL_WidgetImp::Finalize(); 118 return CFWL_WidgetImp::Finalize();
119 } 119 }
120 FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 120 FWL_Error CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
121 if (bAutoSize) { 121 if (bAutoSize) {
122 rect.Set(0, 0, 0, 0); 122 rect.Set(0, 0, 0, 0);
123 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( 123 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>(
124 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 124 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
125 if (!pfMinWidth) 125 if (!pfMinWidth)
126 return FWL_ERR_Indefinite; 126 return FWL_Error::Indefinite;
127 if (IsVertical()) { 127 if (IsVertical()) {
128 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); 128 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3);
129 } else { 129 } else {
130 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); 130 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth));
131 } 131 }
132 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); 132 CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
133 } else { 133 } else {
134 rect = m_pProperties->m_rtWidget; 134 rect = m_pProperties->m_rtWidget;
135 } 135 }
136 return FWL_ERR_Succeeded; 136 return FWL_Error::Succeeded;
137 } 137 }
138 FWL_ERR CFWL_ScrollBarImp::Update() { 138 FWL_Error CFWL_ScrollBarImp::Update() {
139 if (IsLocked()) { 139 if (IsLocked()) {
140 return FWL_ERR_Indefinite; 140 return FWL_Error::Indefinite;
141 } 141 }
142 if (!m_pProperties->m_pThemeProvider) { 142 if (!m_pProperties->m_pThemeProvider) {
143 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 143 m_pProperties->m_pThemeProvider = GetAvailableTheme();
144 } 144 }
145 Layout(); 145 Layout();
146 return FWL_ERR_Succeeded; 146 return FWL_Error::Succeeded;
147 } 147 }
148 FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, 148 FWL_Error CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics,
149 const CFX_Matrix* pMatrix) { 149 const CFX_Matrix* pMatrix) {
150 if (!pGraphics) 150 if (!pGraphics)
151 return FWL_ERR_Indefinite; 151 return FWL_Error::Indefinite;
152 if (!m_pProperties->m_pThemeProvider) 152 if (!m_pProperties->m_pThemeProvider)
153 return FWL_ERR_Indefinite; 153 return FWL_Error::Indefinite;
154 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; 154 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
155 if (HasBorder()) { 155 if (HasBorder()) {
156 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 156 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
157 } 157 }
158 if (HasEdge()) { 158 if (HasEdge()) {
159 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 159 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
160 } 160 }
161 DrawTrack(pGraphics, pTheme, TRUE, pMatrix); 161 DrawTrack(pGraphics, pTheme, TRUE, pMatrix);
162 DrawTrack(pGraphics, pTheme, FALSE, pMatrix); 162 DrawTrack(pGraphics, pTheme, FALSE, pMatrix);
163 DrawArrowBtn(pGraphics, pTheme, TRUE, pMatrix); 163 DrawArrowBtn(pGraphics, pTheme, TRUE, pMatrix);
164 DrawArrowBtn(pGraphics, pTheme, FALSE, pMatrix); 164 DrawArrowBtn(pGraphics, pTheme, FALSE, pMatrix);
165 DrawThumb(pGraphics, pTheme, pMatrix); 165 DrawThumb(pGraphics, pTheme, pMatrix);
166 return FWL_ERR_Succeeded; 166 return FWL_Error::Succeeded;
167 } 167 }
168 inline FX_BOOL CFWL_ScrollBarImp::IsVertical() { 168 inline FX_BOOL CFWL_ScrollBarImp::IsVertical() {
169 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert; 169 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert;
170 } 170 }
171 FWL_ERR CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { 171 FWL_Error CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
172 fMin = m_fRangeMin; 172 fMin = m_fRangeMin;
173 fMax = m_fRangeMax; 173 fMax = m_fRangeMax;
174 return FWL_ERR_Succeeded; 174 return FWL_Error::Succeeded;
175 } 175 }
176 FWL_ERR CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { 176 FWL_Error CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
177 m_fRangeMin = fMin; 177 m_fRangeMin = fMin;
178 m_fRangeMax = fMax; 178 m_fRangeMax = fMax;
179 return FWL_ERR_Succeeded; 179 return FWL_Error::Succeeded;
180 } 180 }
181 FX_FLOAT CFWL_ScrollBarImp::GetPageSize() { 181 FX_FLOAT CFWL_ScrollBarImp::GetPageSize() {
182 return m_fPageSize; 182 return m_fPageSize;
183 } 183 }
184 FWL_ERR CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) { 184 FWL_Error CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) {
185 m_fPageSize = fPageSize; 185 m_fPageSize = fPageSize;
186 return FWL_ERR_Succeeded; 186 return FWL_Error::Succeeded;
187 } 187 }
188 FX_FLOAT CFWL_ScrollBarImp::GetStepSize() { 188 FX_FLOAT CFWL_ScrollBarImp::GetStepSize() {
189 return m_fStepSize; 189 return m_fStepSize;
190 } 190 }
191 FWL_ERR CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) { 191 FWL_Error CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) {
192 m_fStepSize = fStepSize; 192 m_fStepSize = fStepSize;
193 return FWL_ERR_Succeeded; 193 return FWL_Error::Succeeded;
194 } 194 }
195 FX_FLOAT CFWL_ScrollBarImp::GetPos() { 195 FX_FLOAT CFWL_ScrollBarImp::GetPos() {
196 return m_fPos; 196 return m_fPos;
197 } 197 }
198 FWL_ERR CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) { 198 FWL_Error CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) {
199 m_fPos = fPos; 199 m_fPos = fPos;
200 return FWL_ERR_Succeeded; 200 return FWL_Error::Succeeded;
201 } 201 }
202 FX_FLOAT CFWL_ScrollBarImp::GetTrackPos() { 202 FX_FLOAT CFWL_ScrollBarImp::GetTrackPos() {
203 return m_fTrackPos; 203 return m_fTrackPos;
204 } 204 }
205 FWL_ERR CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) { 205 FWL_Error CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) {
206 m_fTrackPos = fTrackPos; 206 m_fTrackPos = fTrackPos;
207 CalcThumbButtonRect(m_rtThumb); 207 CalcThumbButtonRect(m_rtThumb);
208 CalcMinTrackRect(m_rtMinTrack); 208 CalcMinTrackRect(m_rtMinTrack);
209 CalcMaxTrackRect(m_rtMaxTrack); 209 CalcMaxTrackRect(m_rtMaxTrack);
210 return FWL_ERR_Succeeded; 210 return FWL_Error::Succeeded;
211 } 211 }
212 FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { 212 FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
213 switch (dwCode) { 213 switch (dwCode) {
214 case FWL_SCBCODE_Min: 214 case FWL_SCBCODE_Min:
215 case FWL_SCBCODE_Max: 215 case FWL_SCBCODE_Max:
216 case FWL_SCBCODE_PageBackward: 216 case FWL_SCBCODE_PageBackward:
217 case FWL_SCBCODE_PageForward: 217 case FWL_SCBCODE_PageForward:
218 case FWL_SCBCODE_StepBackward: 218 case FWL_SCBCODE_StepBackward:
219 break; 219 break;
220 case FWL_SCBCODE_StepForward: 220 case FWL_SCBCODE_StepForward:
221 break; 221 break;
222 case FWL_SCBCODE_Pos: 222 case FWL_SCBCODE_Pos:
223 case FWL_SCBCODE_TrackPos: 223 case FWL_SCBCODE_TrackPos:
224 case FWL_SCBCODE_EndScroll: 224 case FWL_SCBCODE_EndScroll:
225 break; 225 break;
226 default: { return FALSE; } 226 default: { return FALSE; }
227 } 227 }
228 return OnScroll(dwCode, fPos); 228 return OnScroll(dwCode, fPos);
229 } 229 }
230 int32_t CFWL_ScrollBarImp::Run(FWL_HTIMER hTimer) { 230 int32_t CFWL_ScrollBarImp::Run(FWL_HTIMER hTimer) {
231 if (m_hTimer) { 231 if (m_hTimer) {
232 FWL_StopTimer(m_hTimer); 232 FWL_StopTimer(m_hTimer);
233 } 233 }
234 if (!SendEvent()) { 234 if (!SendEvent()) {
235 m_hTimer = FWL_StartTimer(this, 0); 235 m_hTimer = FWL_StartTimer(this, 0);
236 } 236 }
237 return 1; 237 return 1;
238 } 238 }
239 FWL_ERR CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) { 239 FWL_Error CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) {
240 m_pOuter = pOuter; 240 m_pOuter = pOuter;
241 return FWL_ERR_Succeeded; 241 return FWL_Error::Succeeded;
242 } 242 }
243 void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics, 243 void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics,
244 IFWL_ThemeProvider* pTheme, 244 IFWL_ThemeProvider* pTheme,
245 FX_BOOL bLower, 245 FX_BOOL bLower,
246 const CFX_Matrix* pMatrix) { 246 const CFX_Matrix* pMatrix) {
247 CFWL_ThemeBackground param; 247 CFWL_ThemeBackground param;
248 param.m_pWidget = m_pInterface; 248 param.m_pWidget = m_pInterface;
249 param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack; 249 param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack;
250 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) 250 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
251 ? CFWL_PartState_Disabled 251 ? CFWL_PartState_Disabled
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ev.m_pSrcTarget = m_pInterface; 621 ev.m_pSrcTarget = m_pInterface;
622 ev.m_fPos = fPos; 622 ev.m_fPos = fPos;
623 ev.m_pRet = &bRet; 623 ev.m_pRet = &bRet;
624 DispatchEvent(&ev); 624 DispatchEvent(&ev);
625 return bRet; 625 return bRet;
626 } 626 }
627 627
628 CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) 628 CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner)
629 : m_pOwner(pOwner) {} 629 : m_pOwner(pOwner) {}
630 630
631 int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 631 void CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
632 if (!pMessage) 632 if (!pMessage)
633 return 0; 633 return;
634 634
635 int32_t iRet = 1;
636 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); 635 CFWL_MessageType dwMsgCode = pMessage->GetClassID();
637 if (dwMsgCode == CFWL_MessageType::Mouse) { 636 if (dwMsgCode == CFWL_MessageType::Mouse) {
638 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 637 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
639 switch (pMsg->m_dwCmd) { 638 switch (pMsg->m_dwCmd) {
640 case FWL_MouseCommand::LeftButtonDown: { 639 case FWL_MouseCommand::LeftButtonDown: {
641 OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); 640 OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
642 break; 641 break;
643 } 642 }
644 case FWL_MouseCommand::LeftButtonUp: { 643 case FWL_MouseCommand::LeftButtonUp: {
645 OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); 644 OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
646 break; 645 break;
647 } 646 }
648 case FWL_MouseCommand::Move: { 647 case FWL_MouseCommand::Move: {
649 OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); 648 OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
650 break; 649 break;
651 } 650 }
652 case FWL_MouseCommand::Leave: { 651 case FWL_MouseCommand::Leave: {
653 OnMouseLeave(); 652 OnMouseLeave();
654 break; 653 break;
655 } 654 }
656 default: { 655 default: {
657 iRet = 0;
658 break; 656 break;
659 } 657 }
660 } 658 }
661 } else if (dwMsgCode == CFWL_MessageType::MouseWheel) { 659 } else if (dwMsgCode == CFWL_MessageType::MouseWheel) {
662 CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage); 660 CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage);
663 OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, 661 OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX,
664 pMsg->m_fDeltaY); 662 pMsg->m_fDeltaY);
665 } else {
666 iRet = 0;
667 } 663 }
668 return iRet;
669 } 664 }
670 665
671 FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 666 void CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
672 const CFX_Matrix* pMatrix) { 667 const CFX_Matrix* pMatrix) {
673 return m_pOwner->DrawWidget(pGraphics, pMatrix); 668 m_pOwner->DrawWidget(pGraphics, pMatrix);
674 } 669 }
670
675 void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, 671 void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags,
676 FX_FLOAT fx, 672 FX_FLOAT fx,
677 FX_FLOAT fy) { 673 FX_FLOAT fy) {
678 if (!m_pOwner->IsEnabled()) { 674 if (!m_pOwner->IsEnabled()) {
679 return; 675 return;
680 } 676 }
681 m_pOwner->m_bMouseDown = TRUE; 677 m_pOwner->m_bMouseDown = TRUE;
682 m_pOwner->SetGrab(TRUE); 678 m_pOwner->SetGrab(TRUE);
683 m_pOwner->m_cpTrackPointX = fx; 679 m_pOwner->m_cpTrackPointX = fx;
684 m_pOwner->m_cpTrackPointY = fy; 680 m_pOwner->m_cpTrackPointY = fy;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 } 800 }
805 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, 801 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem,
806 const CFX_RectF& rtItem, 802 const CFX_RectF& rtItem,
807 int32_t& iState) { 803 int32_t& iState) {
808 if (iState == CFWL_PartState_Hovered) { 804 if (iState == CFWL_PartState_Hovered) {
809 return; 805 return;
810 } 806 }
811 iState = CFWL_PartState_Hovered; 807 iState = CFWL_PartState_Hovered;
812 m_pOwner->Repaint(&rtItem); 808 m_pOwner->Repaint(&rtItem);
813 } 809 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_scrollbarimp.h ('k') | xfa/fwl/basewidget/fwl_spinbuttonimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698