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_datetimecalendar.h" | 7 #include "xfa/fwl/core/ifwl_datetimecalendar.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 #include "xfa/fwl/core/ifwl_formproxy.h" | 12 #include "xfa/fwl/core/ifwl_formproxy.h" |
12 | 13 |
13 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( | 14 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( |
14 const IFWL_App* app, | 15 const IFWL_App* app, |
15 const CFWL_WidgetImpProperties& properties, | 16 const CFWL_WidgetImpProperties& properties, |
16 IFWL_Widget* pOuter) | 17 IFWL_Widget* pOuter) |
17 : IFWL_MonthCalendar(app, properties, pOuter) {} | 18 : IFWL_MonthCalendar(app, properties, pOuter) { |
18 | 19 SetDelegate(pdfium::MakeUnique<CFWL_DateTimeCalendarImpDelegate>(this)); |
19 void IFWL_DateTimeCalendar::Initialize() { | |
20 IFWL_MonthCalendar::Initialize(); | |
21 | |
22 // Delete delegated set by IFWL_MonthCalendar::Initialize. | |
23 delete m_pDelegate; | |
24 m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); | |
25 } | |
26 | |
27 void IFWL_DateTimeCalendar::Finalize() { | |
28 delete m_pDelegate; | |
29 m_pDelegate = nullptr; | |
30 IFWL_MonthCalendar::Finalize(); | |
31 } | 20 } |
32 | 21 |
33 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( | 22 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( |
34 IFWL_DateTimeCalendar* pOwner) | 23 IFWL_DateTimeCalendar* pOwner) |
35 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { | 24 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { |
36 m_bFlag = FALSE; | 25 m_bFlag = FALSE; |
37 } | 26 } |
38 | 27 |
39 void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( | 28 void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( |
40 CFWL_Message* pMessage) { | 29 CFWL_Message* pMessage) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 rtInvalidate.Union(lpDatesInfo->rect); | 195 rtInvalidate.Union(lpDatesInfo->rect); |
207 } | 196 } |
208 m_pOwner->AddSelDay(iCurSel); | 197 m_pOwner->AddSelDay(iCurSel); |
209 IFWL_DateTimePicker* pDateTime = | 198 IFWL_DateTimePicker* pDateTime = |
210 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); | 199 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); |
211 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, | 200 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, |
212 iCurSel); | 201 iCurSel); |
213 pDateTime->ShowMonthCalendar(FALSE); | 202 pDateTime->ShowMonthCalendar(FALSE); |
214 } | 203 } |
215 } | 204 } |
OLD | NEW |