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_evtclick.h" |
10 #include "xfa/fwl/core/cfwl_msgkey.h" | 11 #include "xfa/fwl/core/cfwl_msgkey.h" |
11 #include "xfa/fwl/core/cfwl_msgmouse.h" | 12 #include "xfa/fwl/core/cfwl_msgmouse.h" |
12 #include "xfa/fwl/core/cfwl_themebackground.h" | 13 #include "xfa/fwl/core/cfwl_themebackground.h" |
13 #include "xfa/fwl/core/cfwl_widgetproperties.h" | 14 #include "xfa/fwl/core/cfwl_widgetproperties.h" |
14 #include "xfa/fwl/core/fwl_noteimp.h" | 15 #include "xfa/fwl/core/fwl_noteimp.h" |
15 #include "xfa/fwl/core/ifwl_spinbutton.h" | 16 #include "xfa/fwl/core/ifwl_spinbutton.h" |
16 #include "xfa/fwl/core/ifwl_themeprovider.h" | 17 #include "xfa/fwl/core/ifwl_themeprovider.h" |
17 #include "xfa/fwl/core/ifwl_themeprovider.h" | 18 #include "xfa/fwl/core/ifwl_themeprovider.h" |
18 #include "xfa/fwl/core/ifwl_timer.h" | 19 #include "xfa/fwl/core/ifwl_timer.h" |
19 | 20 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (!bUpPress && !bDnPress) | 230 if (!bUpPress && !bDnPress) |
230 return; | 231 return; |
231 if (bUpPress) { | 232 if (bUpPress) { |
232 m_iButtonIndex = 0; | 233 m_iButtonIndex = 0; |
233 m_dwUpState = CFWL_PartState_Pressed; | 234 m_dwUpState = CFWL_PartState_Pressed; |
234 } | 235 } |
235 if (bDnPress) { | 236 if (bDnPress) { |
236 m_iButtonIndex = 1; | 237 m_iButtonIndex = 1; |
237 m_dwDnState = CFWL_PartState_Pressed; | 238 m_dwDnState = CFWL_PartState_Pressed; |
238 } | 239 } |
239 CFWL_EvtSpbClick wmPosChanged; | 240 |
| 241 CFWL_EvtClick wmPosChanged; |
240 wmPosChanged.m_pSrcTarget = this; | 242 wmPosChanged.m_pSrcTarget = this; |
241 wmPosChanged.m_bUp = bUpPress; | |
242 DispatchEvent(&wmPosChanged); | 243 DispatchEvent(&wmPosChanged); |
| 244 |
243 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); | 245 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); |
244 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true); | 246 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true); |
245 } | 247 } |
246 | 248 |
247 void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 249 void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
248 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) | 250 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) |
249 return; | 251 return; |
250 | 252 |
251 m_bLButtonDwn = false; | 253 m_bLButtonDwn = false; |
252 SetGrab(false); | 254 SetGrab(false); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 bool bDown = | 358 bool bDown = |
357 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; |
358 if (!bUp && !bDown) | 360 if (!bUp && !bDown) |
359 return; | 361 return; |
360 | 362 |
361 bool bUpEnable = IsButtonEnabled(true); | 363 bool bUpEnable = IsButtonEnabled(true); |
362 bool bDownEnable = IsButtonEnabled(false); | 364 bool bDownEnable = IsButtonEnabled(false); |
363 if (!bUpEnable && !bDownEnable) | 365 if (!bUpEnable && !bDownEnable) |
364 return; | 366 return; |
365 | 367 |
366 CFWL_EvtSpbClick wmPosChanged; | 368 CFWL_EvtClick wmPosChanged; |
367 wmPosChanged.m_pSrcTarget = this; | 369 wmPosChanged.m_pSrcTarget = this; |
368 wmPosChanged.m_bUp = bUpEnable; | |
369 DispatchEvent(&wmPosChanged); | 370 DispatchEvent(&wmPosChanged); |
| 371 |
370 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); | 372 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); |
371 } | 373 } |
372 | 374 |
373 IFWL_SpinButton::Timer::Timer(IFWL_SpinButton* pToolTip) | 375 IFWL_SpinButton::Timer::Timer(IFWL_SpinButton* pToolTip) |
374 : IFWL_Timer(pToolTip) {} | 376 : IFWL_Timer(pToolTip) {} |
375 | 377 |
376 void IFWL_SpinButton::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 378 void IFWL_SpinButton::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
377 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); | 379 IFWL_SpinButton* pButton = static_cast<IFWL_SpinButton*>(m_pWidget); |
378 | 380 |
379 if (!pButton->m_pTimerInfo) | 381 if (!pButton->m_pTimerInfo) |
380 return; | 382 return; |
381 | 383 |
382 CFWL_EvtSpbClick wmPosChanged; | 384 CFWL_EvtClick wmPosChanged; |
383 wmPosChanged.m_pSrcTarget = pButton; | 385 wmPosChanged.m_pSrcTarget = pButton; |
384 wmPosChanged.m_bUp = pButton->m_iButtonIndex == 0; | |
385 pButton->DispatchEvent(&wmPosChanged); | 386 pButton->DispatchEvent(&wmPosChanged); |
386 } | 387 } |
OLD | NEW |