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 #include "xfa/fwl/core/ifwl_spinbutton.h" | 7 #include "xfa/fwl/core/ifwl_spinbutton.h" |
8 | 8 |
9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 const int kElapseTime = 200; | 23 const int kElapseTime = 200; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 IFWL_SpinButton::IFWL_SpinButton(const IFWL_App* app, | 27 IFWL_SpinButton::IFWL_SpinButton(const IFWL_App* app, |
28 const CFWL_WidgetImpProperties& properties) | 28 const CFWL_WidgetImpProperties& properties) |
29 : IFWL_Widget(app, properties, nullptr), | 29 : IFWL_Widget(app, properties, nullptr), |
30 m_dwUpState(CFWL_PartState_Normal), | 30 m_dwUpState(CFWL_PartState_Normal), |
31 m_dwDnState(CFWL_PartState_Normal), | 31 m_dwDnState(CFWL_PartState_Normal), |
32 m_iButtonIndex(0), | 32 m_iButtonIndex(0), |
33 m_bLButtonDwn(FALSE), | 33 m_bLButtonDwn(false), |
34 m_pTimerInfo(nullptr), | 34 m_pTimerInfo(nullptr), |
35 m_Timer(this) { | 35 m_Timer(this) { |
36 m_rtClient.Reset(); | 36 m_rtClient.Reset(); |
37 m_rtUpButton.Reset(); | 37 m_rtUpButton.Reset(); |
38 m_rtDnButton.Reset(); | 38 m_rtDnButton.Reset(); |
39 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 39 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
40 } | 40 } |
41 | 41 |
42 IFWL_SpinButton::~IFWL_SpinButton() {} | 42 IFWL_SpinButton::~IFWL_SpinButton() {} |
43 | 43 |
44 FWL_Type IFWL_SpinButton::GetClassID() const { | 44 FWL_Type IFWL_SpinButton::GetClassID() const { |
45 return FWL_Type::SpinButton; | 45 return FWL_Type::SpinButton; |
46 } | 46 } |
47 | 47 |
48 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 48 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { |
49 if (bAutoSize) { | 49 if (bAutoSize) { |
50 rect.Set(0, 0, kMinWidth, kMinHeight); | 50 rect.Set(0, 0, kMinWidth, kMinHeight); |
51 IFWL_Widget::GetWidgetRect(rect, TRUE); | 51 IFWL_Widget::GetWidgetRect(rect, true); |
52 } else { | 52 } else { |
53 rect = m_pProperties->m_rtWidget; | 53 rect = m_pProperties->m_rtWidget; |
54 } | 54 } |
55 return FWL_Error::Succeeded; | 55 return FWL_Error::Succeeded; |
56 } | 56 } |
57 | 57 |
58 FWL_Error IFWL_SpinButton::Update() { | 58 FWL_Error IFWL_SpinButton::Update() { |
59 if (IsLocked()) { | 59 if (IsLocked()) { |
60 return FWL_Error::Indefinite; | 60 return FWL_Error::Indefinite; |
61 } | 61 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 if (HasBorder()) | 105 if (HasBorder()) |
106 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 106 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
107 if (HasEdge()) | 107 if (HasEdge()) |
108 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | 108 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); |
109 | 109 |
110 DrawUpButton(pGraphics, pTheme, pMatrix); | 110 DrawUpButton(pGraphics, pTheme, pMatrix); |
111 DrawDownButton(pGraphics, pTheme, pMatrix); | 111 DrawDownButton(pGraphics, pTheme, pMatrix); |
112 return FWL_Error::Succeeded; | 112 return FWL_Error::Succeeded; |
113 } | 113 } |
114 | 114 |
115 FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { | 115 FWL_Error IFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { |
116 if (bUp) | 116 if (bUp) |
117 m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; | 117 m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; |
118 else | 118 else |
119 m_dwDnState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; | 119 m_dwDnState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; |
120 | 120 |
121 return FWL_Error::Succeeded; | 121 return FWL_Error::Succeeded; |
122 } | 122 } |
123 | 123 |
124 FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) { | 124 bool IFWL_SpinButton::IsButtonEnable(bool bUp) { |
125 if (bUp) | 125 if (bUp) |
126 return (m_dwUpState != CFWL_PartState_Disabled); | 126 return (m_dwUpState != CFWL_PartState_Disabled); |
127 return (m_dwDnState != CFWL_PartState_Disabled); | 127 return (m_dwDnState != CFWL_PartState_Disabled); |
128 } | 128 } |
129 | 129 |
130 void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics, | 130 void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics, |
131 IFWL_ThemeProvider* pTheme, | 131 IFWL_ThemeProvider* pTheme, |
132 const CFX_Matrix* pMatrix) { | 132 const CFX_Matrix* pMatrix) { |
133 CFWL_ThemeBackground params; | 133 CFWL_ThemeBackground params; |
134 params.m_pWidget = this; | 134 params.m_pWidget = this; |
(...skipping 22 matching lines...) Expand all Loading... |
157 pTheme->DrawBackground(¶ms); | 157 pTheme->DrawBackground(¶ms); |
158 } | 158 } |
159 | 159 |
160 void IFWL_SpinButton::OnProcessMessage(CFWL_Message* pMessage) { | 160 void IFWL_SpinButton::OnProcessMessage(CFWL_Message* pMessage) { |
161 if (!pMessage) | 161 if (!pMessage) |
162 return; | 162 return; |
163 | 163 |
164 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 164 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
165 switch (dwMsgCode) { | 165 switch (dwMsgCode) { |
166 case CFWL_MessageType::SetFocus: { | 166 case CFWL_MessageType::SetFocus: { |
167 OnFocusChanged(pMessage, TRUE); | 167 OnFocusChanged(pMessage, true); |
168 break; | 168 break; |
169 } | 169 } |
170 case CFWL_MessageType::KillFocus: { | 170 case CFWL_MessageType::KillFocus: { |
171 OnFocusChanged(pMessage, FALSE); | 171 OnFocusChanged(pMessage, false); |
172 break; | 172 break; |
173 } | 173 } |
174 case CFWL_MessageType::Mouse: { | 174 case CFWL_MessageType::Mouse: { |
175 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 175 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
176 switch (pMsg->m_dwCmd) { | 176 switch (pMsg->m_dwCmd) { |
177 case FWL_MouseCommand::LeftButtonDown: | 177 case FWL_MouseCommand::LeftButtonDown: |
178 OnLButtonDown(pMsg); | 178 OnLButtonDown(pMsg); |
179 break; | 179 break; |
180 case FWL_MouseCommand::LeftButtonUp: | 180 case FWL_MouseCommand::LeftButtonUp: |
181 OnLButtonUp(pMsg); | 181 OnLButtonUp(pMsg); |
(...skipping 19 matching lines...) Expand all Loading... |
201 break; | 201 break; |
202 } | 202 } |
203 IFWL_Widget::OnProcessMessage(pMessage); | 203 IFWL_Widget::OnProcessMessage(pMessage); |
204 } | 204 } |
205 | 205 |
206 void IFWL_SpinButton::OnDrawWidget(CFX_Graphics* pGraphics, | 206 void IFWL_SpinButton::OnDrawWidget(CFX_Graphics* pGraphics, |
207 const CFX_Matrix* pMatrix) { | 207 const CFX_Matrix* pMatrix) { |
208 DrawWidget(pGraphics, pMatrix); | 208 DrawWidget(pGraphics, pMatrix); |
209 } | 209 } |
210 | 210 |
211 void IFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { | 211 void IFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { |
212 if (bSet) | 212 if (bSet) |
213 m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); | 213 m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); |
214 else | 214 else |
215 m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused); | 215 m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused); |
216 | 216 |
217 Repaint(&m_rtClient); | 217 Repaint(&m_rtClient); |
218 } | 218 } |
219 | 219 |
220 void IFWL_SpinButton::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 220 void IFWL_SpinButton::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
221 m_bLButtonDwn = TRUE; | 221 m_bLButtonDwn = true; |
222 SetGrab(TRUE); | 222 SetGrab(true); |
223 SetFocus(TRUE); | 223 SetFocus(true); |
224 if (!m_pProperties->m_pDataProvider) | 224 if (!m_pProperties->m_pDataProvider) |
225 return; | 225 return; |
226 | 226 |
227 FX_BOOL bUpPress = | 227 bool bUpPress = |
228 (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(TRUE)); | 228 (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(true)); |
229 FX_BOOL bDnPress = | 229 bool bDnPress = |
230 (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(FALSE)); | 230 (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(false)); |
231 if (!bUpPress && !bDnPress) | 231 if (!bUpPress && !bDnPress) |
232 return; | 232 return; |
233 if (bUpPress) { | 233 if (bUpPress) { |
234 m_iButtonIndex = 0; | 234 m_iButtonIndex = 0; |
235 m_dwUpState = CFWL_PartState_Pressed; | 235 m_dwUpState = CFWL_PartState_Pressed; |
236 } | 236 } |
237 if (bDnPress) { | 237 if (bDnPress) { |
238 m_iButtonIndex = 1; | 238 m_iButtonIndex = 1; |
239 m_dwDnState = CFWL_PartState_Pressed; | 239 m_dwDnState = CFWL_PartState_Pressed; |
240 } | 240 } |
241 CFWL_EvtSpbClick wmPosChanged; | 241 CFWL_EvtSpbClick wmPosChanged; |
242 wmPosChanged.m_pSrcTarget = this; | 242 wmPosChanged.m_pSrcTarget = this; |
243 wmPosChanged.m_bUp = bUpPress; | 243 wmPosChanged.m_bUp = bUpPress; |
244 DispatchEvent(&wmPosChanged); | 244 DispatchEvent(&wmPosChanged); |
245 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); | 245 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); |
246 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true); | 246 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true); |
247 } | 247 } |
248 | 248 |
249 void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 249 void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
250 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) | 250 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) |
251 return; | 251 return; |
252 | 252 |
253 m_bLButtonDwn = FALSE; | 253 m_bLButtonDwn = false; |
254 SetGrab(FALSE); | 254 SetGrab(false); |
255 SetFocus(FALSE); | 255 SetFocus(false); |
256 if (m_pTimerInfo) { | 256 if (m_pTimerInfo) { |
257 m_pTimerInfo->StopTimer(); | 257 m_pTimerInfo->StopTimer(); |
258 m_pTimerInfo = nullptr; | 258 m_pTimerInfo = nullptr; |
259 } | 259 } |
260 FX_BOOL bRepaint = FALSE; | 260 bool bRepaint = false; |
261 CFX_RectF rtInvalidate; | 261 CFX_RectF rtInvalidate; |
262 if (m_dwUpState == CFWL_PartState_Pressed && IsButtonEnable(TRUE)) { | 262 if (m_dwUpState == CFWL_PartState_Pressed && IsButtonEnable(true)) { |
263 m_dwUpState = CFWL_PartState_Normal; | 263 m_dwUpState = CFWL_PartState_Normal; |
264 bRepaint = TRUE; | 264 bRepaint = true; |
265 rtInvalidate = m_rtUpButton; | 265 rtInvalidate = m_rtUpButton; |
266 } else if (m_dwDnState == CFWL_PartState_Pressed && IsButtonEnable(FALSE)) { | 266 } else if (m_dwDnState == CFWL_PartState_Pressed && IsButtonEnable(false)) { |
267 m_dwDnState = CFWL_PartState_Normal; | 267 m_dwDnState = CFWL_PartState_Normal; |
268 bRepaint = TRUE; | 268 bRepaint = true; |
269 rtInvalidate = m_rtDnButton; | 269 rtInvalidate = m_rtDnButton; |
270 } | 270 } |
271 if (bRepaint) | 271 if (bRepaint) |
272 Repaint(&rtInvalidate); | 272 Repaint(&rtInvalidate); |
273 } | 273 } |
274 | 274 |
275 void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) { | 275 void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) { |
276 if (!m_pProperties->m_pDataProvider) | 276 if (!m_pProperties->m_pDataProvider) |
277 return; | 277 return; |
278 if (m_bLButtonDwn) | 278 if (m_bLButtonDwn) |
279 return; | 279 return; |
280 | 280 |
281 FX_BOOL bRepaint = FALSE; | 281 bool bRepaint = false; |
282 CFX_RectF rtInvlidate; | 282 CFX_RectF rtInvlidate; |
283 rtInvlidate.Reset(); | 283 rtInvlidate.Reset(); |
284 if (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) { | 284 if (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) { |
285 if (IsButtonEnable(TRUE)) { | 285 if (IsButtonEnable(true)) { |
286 if (m_dwUpState == CFWL_PartState_Hovered) { | 286 if (m_dwUpState == CFWL_PartState_Hovered) { |
287 m_dwUpState = CFWL_PartState_Hovered; | 287 m_dwUpState = CFWL_PartState_Hovered; |
288 bRepaint = TRUE; | 288 bRepaint = true; |
289 rtInvlidate = m_rtUpButton; | 289 rtInvlidate = m_rtUpButton; |
290 } | 290 } |
291 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(FALSE)) { | 291 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(false)) { |
292 m_dwDnState = CFWL_PartState_Normal; | 292 m_dwDnState = CFWL_PartState_Normal; |
293 if (bRepaint) | 293 if (bRepaint) |
294 rtInvlidate.Union(m_rtDnButton); | 294 rtInvlidate.Union(m_rtDnButton); |
295 else | 295 else |
296 rtInvlidate = m_rtDnButton; | 296 rtInvlidate = m_rtDnButton; |
297 | 297 |
298 bRepaint = TRUE; | 298 bRepaint = true; |
299 } | 299 } |
300 } | 300 } |
301 if (!IsButtonEnable(FALSE)) | 301 if (!IsButtonEnable(false)) |
302 EnableButton(FALSE, FALSE); | 302 EnableButton(false, false); |
303 | 303 |
304 } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) { | 304 } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) { |
305 if (IsButtonEnable(FALSE)) { | 305 if (IsButtonEnable(false)) { |
306 if (m_dwDnState != CFWL_PartState_Hovered) { | 306 if (m_dwDnState != CFWL_PartState_Hovered) { |
307 m_dwDnState = CFWL_PartState_Hovered; | 307 m_dwDnState = CFWL_PartState_Hovered; |
308 bRepaint = TRUE; | 308 bRepaint = true; |
309 rtInvlidate = m_rtDnButton; | 309 rtInvlidate = m_rtDnButton; |
310 } | 310 } |
311 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(TRUE)) { | 311 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(true)) { |
312 m_dwUpState = CFWL_PartState_Normal; | 312 m_dwUpState = CFWL_PartState_Normal; |
313 if (bRepaint) | 313 if (bRepaint) |
314 rtInvlidate.Union(m_rtUpButton); | 314 rtInvlidate.Union(m_rtUpButton); |
315 else | 315 else |
316 rtInvlidate = m_rtUpButton; | 316 rtInvlidate = m_rtUpButton; |
317 bRepaint = TRUE; | 317 bRepaint = true; |
318 } | 318 } |
319 } | 319 } |
320 } else if (m_dwUpState != CFWL_PartState_Normal || | 320 } else if (m_dwUpState != CFWL_PartState_Normal || |
321 m_dwDnState != CFWL_PartState_Normal) { | 321 m_dwDnState != CFWL_PartState_Normal) { |
322 if (m_dwUpState != CFWL_PartState_Normal) { | 322 if (m_dwUpState != CFWL_PartState_Normal) { |
323 m_dwUpState = CFWL_PartState_Normal; | 323 m_dwUpState = CFWL_PartState_Normal; |
324 bRepaint = TRUE; | 324 bRepaint = true; |
325 rtInvlidate = m_rtUpButton; | 325 rtInvlidate = m_rtUpButton; |
326 } | 326 } |
327 if (m_dwDnState != CFWL_PartState_Normal) { | 327 if (m_dwDnState != CFWL_PartState_Normal) { |
328 m_dwDnState = CFWL_PartState_Normal; | 328 m_dwDnState = CFWL_PartState_Normal; |
329 if (bRepaint) | 329 if (bRepaint) |
330 rtInvlidate.Union(m_rtDnButton); | 330 rtInvlidate.Union(m_rtDnButton); |
331 else | 331 else |
332 rtInvlidate = m_rtDnButton; | 332 rtInvlidate = m_rtDnButton; |
333 | 333 |
334 bRepaint = TRUE; | 334 bRepaint = true; |
335 } | 335 } |
336 } | 336 } |
337 if (bRepaint) | 337 if (bRepaint) |
338 Repaint(&rtInvlidate); | 338 Repaint(&rtInvlidate); |
339 } | 339 } |
340 | 340 |
341 void IFWL_SpinButton::OnMouseLeave(CFWL_MsgMouse* pMsg) { | 341 void IFWL_SpinButton::OnMouseLeave(CFWL_MsgMouse* pMsg) { |
342 if (!pMsg) | 342 if (!pMsg) |
343 return; | 343 return; |
344 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(TRUE)) | 344 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(true)) |
345 m_dwUpState = CFWL_PartState_Normal; | 345 m_dwUpState = CFWL_PartState_Normal; |
346 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(FALSE)) | 346 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(false)) |
347 m_dwDnState = CFWL_PartState_Normal; | 347 m_dwDnState = CFWL_PartState_Normal; |
348 | 348 |
349 Repaint(&m_rtClient); | 349 Repaint(&m_rtClient); |
350 } | 350 } |
351 | 351 |
352 void IFWL_SpinButton::OnKeyDown(CFWL_MsgKey* pMsg) { | 352 void IFWL_SpinButton::OnKeyDown(CFWL_MsgKey* pMsg) { |
353 if (!m_pProperties->m_pDataProvider) | 353 if (!m_pProperties->m_pDataProvider) |
354 return; | 354 return; |
355 | 355 |
356 FX_BOOL bUp = | 356 bool bUp = |
357 pMsg->m_dwKeyCode == FWL_VKEY_Up || pMsg->m_dwKeyCode == FWL_VKEY_Left; | 357 pMsg->m_dwKeyCode == FWL_VKEY_Up || pMsg->m_dwKeyCode == FWL_VKEY_Left; |
358 FX_BOOL bDown = | 358 bool bDown = |
359 pMsg->m_dwKeyCode == FWL_VKEY_Down || pMsg->m_dwKeyCode == FWL_VKEY_Right; | 359 pMsg->m_dwKeyCode == FWL_VKEY_Down || pMsg->m_dwKeyCode == FWL_VKEY_Right; |
360 if (!bUp && !bDown) | 360 if (!bUp && !bDown) |
361 return; | 361 return; |
362 | 362 |
363 FX_BOOL bUpEnable = IsButtonEnable(TRUE); | 363 bool bUpEnable = IsButtonEnable(true); |
364 FX_BOOL bDownEnable = IsButtonEnable(FALSE); | 364 bool bDownEnable = IsButtonEnable(false); |
365 if (!bUpEnable && !bDownEnable) | 365 if (!bUpEnable && !bDownEnable) |
366 return; | 366 return; |
367 | 367 |
368 CFWL_EvtSpbClick wmPosChanged; | 368 CFWL_EvtSpbClick wmPosChanged; |
369 wmPosChanged.m_pSrcTarget = this; | 369 wmPosChanged.m_pSrcTarget = this; |
370 wmPosChanged.m_bUp = bUpEnable; | 370 wmPosChanged.m_bUp = bUpEnable; |
371 DispatchEvent(&wmPosChanged); | 371 DispatchEvent(&wmPosChanged); |
372 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); | 372 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); |
373 } | 373 } |
374 | 374 |
375 IFWL_SpinButton::Timer::Timer(IFWL_SpinButton* pToolTip) | 375 IFWL_SpinButton::Timer::Timer(IFWL_SpinButton* pToolTip) |
376 : IFWL_Timer(pToolTip) {} | 376 : IFWL_Timer(pToolTip) {} |
377 | 377 |
378 void IFWL_SpinButton::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 378 void IFWL_SpinButton::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
379 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); | 379 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); |
380 | 380 |
381 if (!pButton->m_pTimerInfo) | 381 if (!pButton->m_pTimerInfo) |
382 return; | 382 return; |
383 | 383 |
384 CFWL_EvtSpbClick wmPosChanged; | 384 CFWL_EvtSpbClick wmPosChanged; |
385 wmPosChanged.m_pSrcTarget = pButton; | 385 wmPosChanged.m_pSrcTarget = pButton; |
386 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; | 386 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; |
387 pButton->DispatchEvent(&wmPosChanged); | 387 pButton->DispatchEvent(&wmPosChanged); |
388 } | 388 } |
OLD | NEW |