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 "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 #include "xfa/fwl/core/ifwl_formproxy.h" | 11 #include "xfa/fwl/core/ifwl_formproxy.h" |
12 | 12 |
13 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( | 13 IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( |
| 14 const IFWL_App* app, |
14 const CFWL_WidgetImpProperties& properties, | 15 const CFWL_WidgetImpProperties& properties, |
15 IFWL_Widget* pOuter) | 16 IFWL_Widget* pOuter) |
16 : IFWL_MonthCalendar(properties, pOuter) {} | 17 : IFWL_MonthCalendar(app, properties, pOuter) {} |
17 | 18 |
18 FWL_Error IFWL_DateTimeCalendar::Initialize() { | 19 void IFWL_DateTimeCalendar::Initialize() { |
19 if (IFWL_MonthCalendar::Initialize() != FWL_Error::Succeeded) | 20 IFWL_MonthCalendar::Initialize(); |
20 return FWL_Error::Indefinite; | 21 |
| 22 // Delete delegated set by IFWL_MonthCalendar::Initialize. |
21 delete m_pDelegate; | 23 delete m_pDelegate; |
22 m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); | 24 m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); |
23 return FWL_Error::Succeeded; | |
24 } | 25 } |
25 | 26 |
26 void IFWL_DateTimeCalendar::Finalize() { | 27 void IFWL_DateTimeCalendar::Finalize() { |
27 delete m_pDelegate; | 28 delete m_pDelegate; |
28 m_pDelegate = nullptr; | 29 m_pDelegate = nullptr; |
29 IFWL_MonthCalendar::Finalize(); | 30 IFWL_MonthCalendar::Finalize(); |
30 } | 31 } |
31 | 32 |
32 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( | 33 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( |
33 IFWL_DateTimeCalendar* pOwner) | 34 IFWL_DateTimeCalendar* pOwner) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 rtInvalidate.Union(lpDatesInfo->rect); | 207 rtInvalidate.Union(lpDatesInfo->rect); |
207 } | 208 } |
208 m_pOwner->AddSelDay(iCurSel); | 209 m_pOwner->AddSelDay(iCurSel); |
209 IFWL_DateTimePicker* pDateTime = | 210 IFWL_DateTimePicker* pDateTime = |
210 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); | 211 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); |
211 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, | 212 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, |
212 iCurSel); | 213 iCurSel); |
213 pDateTime->ShowMonthCalendar(FALSE); | 214 pDateTime->ShowMonthCalendar(FALSE); |
214 } | 215 } |
215 } | 216 } |
OLD | NEW |