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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 m_bLButtonDwn(FALSE), | 31 m_bLButtonDwn(FALSE), |
32 m_pTimerInfo(nullptr) { | 32 m_pTimerInfo(nullptr) { |
33 m_rtClient.Reset(); | 33 m_rtClient.Reset(); |
34 m_rtUpButton.Reset(); | 34 m_rtUpButton.Reset(); |
35 m_rtDnButton.Reset(); | 35 m_rtDnButton.Reset(); |
36 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 36 m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
37 } | 37 } |
38 | 38 |
39 IFWL_SpinButton::~IFWL_SpinButton() {} | 39 IFWL_SpinButton::~IFWL_SpinButton() {} |
40 | 40 |
41 FWL_Error IFWL_SpinButton::GetClassName(CFX_WideString& wsClass) const { | |
42 wsClass = FWL_CLASS_SpinButton; | |
43 return FWL_Error::Succeeded; | |
44 } | |
45 | |
46 FWL_Type IFWL_SpinButton::GetClassID() const { | 41 FWL_Type IFWL_SpinButton::GetClassID() const { |
47 return FWL_Type::SpinButton; | 42 return FWL_Type::SpinButton; |
48 } | 43 } |
49 | 44 |
50 FWL_Error IFWL_SpinButton::Initialize() { | 45 FWL_Error IFWL_SpinButton::Initialize() { |
51 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 46 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
52 return FWL_Error::Indefinite; | 47 return FWL_Error::Indefinite; |
53 | 48 |
54 m_pDelegate = new CFWL_SpinButtonImpDelegate(this); | 49 m_pDelegate = new CFWL_SpinButtonImpDelegate(this); |
55 return FWL_Error::Succeeded; | 50 return FWL_Error::Succeeded; |
56 } | 51 } |
57 | 52 |
58 FWL_Error IFWL_SpinButton::Finalize() { | 53 void IFWL_SpinButton::Finalize() { |
59 delete m_pDelegate; | 54 delete m_pDelegate; |
60 m_pDelegate = nullptr; | 55 m_pDelegate = nullptr; |
61 return IFWL_Widget::Finalize(); | 56 IFWL_Widget::Finalize(); |
62 } | 57 } |
63 | 58 |
64 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 59 FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
65 if (bAutoSize) { | 60 if (bAutoSize) { |
66 rect.Set(0, 0, kMinWidth, kMinHeight); | 61 rect.Set(0, 0, kMinWidth, kMinHeight); |
67 IFWL_Widget::GetWidgetRect(rect, TRUE); | 62 IFWL_Widget::GetWidgetRect(rect, TRUE); |
68 } else { | 63 } else { |
69 rect = m_pProperties->m_rtWidget; | 64 rect = m_pProperties->m_rtWidget; |
70 } | 65 } |
71 return FWL_Error::Succeeded; | 66 return FWL_Error::Succeeded; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (!bUpEnable && !bDownEnable) { | 414 if (!bUpEnable && !bDownEnable) { |
420 return; | 415 return; |
421 } | 416 } |
422 CFWL_EvtSpbClick wmPosChanged; | 417 CFWL_EvtSpbClick wmPosChanged; |
423 wmPosChanged.m_pSrcTarget = m_pOwner; | 418 wmPosChanged.m_pSrcTarget = m_pOwner; |
424 wmPosChanged.m_bUp = bUpEnable; | 419 wmPosChanged.m_bUp = bUpEnable; |
425 m_pOwner->DispatchEvent(&wmPosChanged); | 420 m_pOwner->DispatchEvent(&wmPosChanged); |
426 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton | 421 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton |
427 : &m_pOwner->m_rtDnButton); | 422 : &m_pOwner->m_rtDnButton); |
428 } | 423 } |
OLD | NEW |