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 "xfa/fwl/core/cfwl_message.h" | 9 #include "xfa/fwl/core/cfwl_message.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
12 #include "xfa/fwl/core/fwl_noteimp.h" | 12 #include "xfa/fwl/core/fwl_noteimp.h" |
13 #include "xfa/fwl/core/ifwl_spinbutton.h" | 13 #include "xfa/fwl/core/ifwl_spinbutton.h" |
14 #include "xfa/fwl/core/ifwl_themeprovider.h" | 14 #include "xfa/fwl/core/ifwl_themeprovider.h" |
15 #include "xfa/fwl/core/ifwl_themeprovider.h" | 15 #include "xfa/fwl/core/ifwl_themeprovider.h" |
16 #include "xfa/fwl/core/ifwl_timer.h" | 16 #include "xfa/fwl/core/ifwl_timer.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const int kMinWidth = 18; | 20 const int kMinWidth = 18; |
21 const int kMinHeight = 32; | 21 const int kMinHeight = 32; |
22 const int kElapseTime = 200; | 22 const int kElapseTime = 200; |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 // static | 26 IFWL_SpinButton::IFWL_SpinButton(const CFWL_WidgetImpProperties& properties) |
27 IFWL_SpinButton* IFWL_SpinButton::Create( | 27 : IFWL_Widget(properties, nullptr), |
28 const CFWL_WidgetImpProperties& properties, | |
29 IFWL_Widget* pOuter) { | |
30 return new IFWL_SpinButton(properties, nullptr); | |
31 } | |
32 | |
33 IFWL_SpinButton::IFWL_SpinButton(const CFWL_WidgetImpProperties& properties, | |
34 IFWL_Widget* pOuter) | |
35 : IFWL_Widget(properties, pOuter), | |
36 m_dwUpState(CFWL_PartState_Normal), | 28 m_dwUpState(CFWL_PartState_Normal), |
37 m_dwDnState(CFWL_PartState_Normal), | 29 m_dwDnState(CFWL_PartState_Normal), |
38 m_iButtonIndex(0), | 30 m_iButtonIndex(0), |
39 m_bLButtonDwn(FALSE), | 31 m_bLButtonDwn(FALSE), |
40 m_pTimerInfo(nullptr) { | 32 m_pTimerInfo(nullptr) { |
41 m_rtClient.Reset(); | 33 m_rtClient.Reset(); |
42 m_rtUpButton.Reset(); | 34 m_rtUpButton.Reset(); |
43 m_rtDnButton.Reset(); | 35 m_rtDnButton.Reset(); |
44 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 36 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
45 } | 37 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (!bUpEnable && !bDownEnable) { | 419 if (!bUpEnable && !bDownEnable) { |
428 return; | 420 return; |
429 } | 421 } |
430 CFWL_EvtSpbClick wmPosChanged; | 422 CFWL_EvtSpbClick wmPosChanged; |
431 wmPosChanged.m_pSrcTarget = m_pOwner; | 423 wmPosChanged.m_pSrcTarget = m_pOwner; |
432 wmPosChanged.m_bUp = bUpEnable; | 424 wmPosChanged.m_bUp = bUpEnable; |
433 m_pOwner->DispatchEvent(&wmPosChanged); | 425 m_pOwner->DispatchEvent(&wmPosChanged); |
434 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 426 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
435 : &m_pOwner->m_rtDnButton); | 427 : &m_pOwner->m_rtDnButton); |
436 } | 428 } |
OLD | NEW |