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_datetimeedit.h" | 7 #include "xfa/fwl/core/ifwl_datetimeedit.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 9 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
10 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 10 #include "xfa/fwl/core/ifwl_datetimepicker.h" |
11 | 11 |
12 IFWL_DateTimeEdit::IFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, | 12 IFWL_DateTimeEdit::IFWL_DateTimeEdit(const IFWL_App* app, |
| 13 const CFWL_WidgetImpProperties& properties, |
13 IFWL_Widget* pOuter) | 14 IFWL_Widget* pOuter) |
14 : IFWL_Edit(properties, pOuter) {} | 15 : IFWL_Edit(app, properties, pOuter) {} |
15 | 16 |
16 FWL_Error IFWL_DateTimeEdit::Initialize() { | 17 void IFWL_DateTimeEdit::Initialize() { |
| 18 IFWL_Edit::Initialize(); |
| 19 |
| 20 // Delete delegate set by IFWL_Edit::Initialize. |
| 21 delete m_pDelegate; |
17 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); | 22 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); |
18 if (IFWL_Edit::Initialize() != FWL_Error::Succeeded) | |
19 return FWL_Error::Indefinite; | |
20 return FWL_Error::Succeeded; | |
21 } | 23 } |
22 | 24 |
23 void IFWL_DateTimeEdit::Finalize() { | 25 void IFWL_DateTimeEdit::Finalize() { |
24 delete m_pDelegate; | 26 delete m_pDelegate; |
25 m_pDelegate = nullptr; | 27 m_pDelegate = nullptr; |
26 IFWL_Edit::Finalize(); | 28 IFWL_Edit::Finalize(); |
27 } | 29 } |
28 | 30 |
29 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( | 31 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( |
30 IFWL_DateTimeEdit* pOwner) | 32 IFWL_DateTimeEdit* pOwner) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 pDateTime->GetWidgetRect(rtInvalidate); | 65 pDateTime->GetWidgetRect(rtInvalidate); |
64 pDateTime->ShowMonthCalendar(FALSE); | 66 pDateTime->ShowMonthCalendar(FALSE); |
65 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); | 67 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); |
66 pDateTime->Repaint(&rtInvalidate); | 68 pDateTime->Repaint(&rtInvalidate); |
67 } | 69 } |
68 } | 70 } |
69 } | 71 } |
70 } | 72 } |
71 CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 73 CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
72 } | 74 } |
OLD | NEW |