| 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 "third_party/base/ptr_util.h" |
| 9 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 10 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 10 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 11 #include "xfa/fwl/core/ifwl_datetimepicker.h" |
| 11 | 12 |
| 12 IFWL_DateTimeEdit::IFWL_DateTimeEdit(const IFWL_App* app, | 13 IFWL_DateTimeEdit::IFWL_DateTimeEdit(const IFWL_App* app, |
| 13 const CFWL_WidgetImpProperties& properties, | 14 const CFWL_WidgetImpProperties& properties, |
| 14 IFWL_Widget* pOuter) | 15 IFWL_Widget* pOuter) |
| 15 : IFWL_Edit(app, properties, pOuter) {} | 16 : IFWL_Edit(app, properties, pOuter) { |
| 16 | 17 SetDelegate(pdfium::MakeUnique<CFWL_DateTimeEditImpDelegate>(this)); |
| 17 void IFWL_DateTimeEdit::Initialize() { | |
| 18 IFWL_Edit::Initialize(); | |
| 19 | |
| 20 // Delete delegate set by IFWL_Edit::Initialize. | |
| 21 delete m_pDelegate; | |
| 22 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); | |
| 23 } | |
| 24 | |
| 25 void IFWL_DateTimeEdit::Finalize() { | |
| 26 delete m_pDelegate; | |
| 27 m_pDelegate = nullptr; | |
| 28 IFWL_Edit::Finalize(); | |
| 29 } | 18 } |
| 30 | 19 |
| 31 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( | 20 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( |
| 32 IFWL_DateTimeEdit* pOwner) | 21 IFWL_DateTimeEdit* pOwner) |
| 33 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} | 22 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
| 34 | 23 |
| 35 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 24 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 36 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 25 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
| 37 DisForm_OnProcessMessage(pMessage); | 26 DisForm_OnProcessMessage(pMessage); |
| 38 return; | 27 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 64 pDateTime->GetWidgetRect(rtInvalidate); | 53 pDateTime->GetWidgetRect(rtInvalidate); |
| 65 pDateTime->ShowMonthCalendar(FALSE); | 54 pDateTime->ShowMonthCalendar(FALSE); |
| 66 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); | 55 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); |
| 67 pDateTime->Repaint(&rtInvalidate); | 56 pDateTime->Repaint(&rtInvalidate); |
| 68 } | 57 } |
| 69 } | 58 } |
| 70 } | 59 } |
| 71 } | 60 } |
| 72 CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 61 CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
| 73 } | 62 } |
| OLD | NEW |