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_datetimepicker.h" | 7 #include "xfa/fwl/core/ifwl_datetimepicker.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 18 matching lines...) Expand all Loading... |
29 m_iBtnState(1), | 29 m_iBtnState(1), |
30 m_iYear(-1), | 30 m_iYear(-1), |
31 m_iMonth(-1), | 31 m_iMonth(-1), |
32 m_iDay(-1), | 32 m_iDay(-1), |
33 m_bLBtnDown(FALSE) { | 33 m_bLBtnDown(FALSE) { |
34 m_rtBtn.Set(0, 0, 0, 0); | 34 m_rtBtn.Set(0, 0, 0, 0); |
35 } | 35 } |
36 | 36 |
37 IFWL_DateTimePicker::~IFWL_DateTimePicker() {} | 37 IFWL_DateTimePicker::~IFWL_DateTimePicker() {} |
38 | 38 |
39 FWL_Error IFWL_DateTimePicker::GetClassName(CFX_WideString& wsClass) const { | |
40 wsClass = FWL_CLASS_DateTimePicker; | |
41 return FWL_Error::Succeeded; | |
42 } | |
43 | |
44 FWL_Type IFWL_DateTimePicker::GetClassID() const { | 39 FWL_Type IFWL_DateTimePicker::GetClassID() const { |
45 return FWL_Type::DateTimePicker; | 40 return FWL_Type::DateTimePicker; |
46 } | 41 } |
47 | 42 |
48 FWL_Error IFWL_DateTimePicker::Initialize() { | 43 FWL_Error IFWL_DateTimePicker::Initialize() { |
49 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 44 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
50 return FWL_Error::Indefinite; | 45 return FWL_Error::Indefinite; |
51 | 46 |
52 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); | 47 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); |
53 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; | 48 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; |
(...skipping 14 matching lines...) Expand all Loading... |
68 propEdit.m_pParent = this; | 63 propEdit.m_pParent = this; |
69 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 64 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
70 | 65 |
71 m_pEdit.reset(new IFWL_DateTimeEdit(propEdit, this)); | 66 m_pEdit.reset(new IFWL_DateTimeEdit(propEdit, this)); |
72 m_pEdit->Initialize(); | 67 m_pEdit->Initialize(); |
73 RegisterEventTarget(m_pMonthCal.get()); | 68 RegisterEventTarget(m_pMonthCal.get()); |
74 RegisterEventTarget(m_pEdit.get()); | 69 RegisterEventTarget(m_pEdit.get()); |
75 return FWL_Error::Succeeded; | 70 return FWL_Error::Succeeded; |
76 } | 71 } |
77 | 72 |
78 FWL_Error IFWL_DateTimePicker::Finalize() { | 73 void IFWL_DateTimePicker::Finalize() { |
79 if (m_pEdit) { | 74 if (m_pEdit) |
80 m_pEdit->Finalize(); | 75 m_pEdit->Finalize(); |
81 } | 76 if (m_pMonthCal) |
82 if (m_pMonthCal) { | |
83 m_pMonthCal->Finalize(); | 77 m_pMonthCal->Finalize(); |
84 } | 78 if (m_pForm) |
85 if (m_pForm) { | |
86 m_pForm->Finalize(); | 79 m_pForm->Finalize(); |
87 } | 80 |
88 UnregisterEventTarget(); | 81 UnregisterEventTarget(); |
89 delete m_pDelegate; | 82 delete m_pDelegate; |
90 m_pDelegate = nullptr; | 83 m_pDelegate = nullptr; |
91 return IFWL_Widget::Finalize(); | 84 IFWL_Widget::Finalize(); |
92 } | 85 } |
93 | 86 |
94 FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, | 87 FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, |
95 FX_BOOL bAutoSize) { | 88 FX_BOOL bAutoSize) { |
96 if (m_pWidgetMgr->IsFormDisabled()) { | 89 if (m_pWidgetMgr->IsFormDisabled()) { |
97 return DisForm_GetWidgetRect(rect, bAutoSize); | 90 return DisForm_GetWidgetRect(rect, bAutoSize); |
98 } | 91 } |
99 if (bAutoSize) { | 92 if (bAutoSize) { |
100 rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); | 93 rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); |
101 IFWL_Widget::GetWidgetRect(rect, TRUE); | 94 IFWL_Widget::GetWidgetRect(rect, TRUE); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 | 854 |
862 int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurMonth( | 855 int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurMonth( |
863 IFWL_Widget* pWidget) { | 856 IFWL_Widget* pWidget) { |
864 return m_iCurMonth; | 857 return m_iCurMonth; |
865 } | 858 } |
866 | 859 |
867 int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurYear( | 860 int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurYear( |
868 IFWL_Widget* pWidget) { | 861 IFWL_Widget* pWidget) { |
869 return m_iCurYear; | 862 return m_iCurYear; |
870 } | 863 } |
OLD | NEW |