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_monthcalendar.h" | 7 #include "xfa/fwl/core/ifwl_monthcalendar.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
| 11 #include "third_party/base/ptr_util.h" |
11 #include "xfa/fde/tto/fde_textout.h" | 12 #include "xfa/fde/tto/fde_textout.h" |
12 #include "xfa/fwl/core/cfwl_message.h" | 13 #include "xfa/fwl/core/cfwl_message.h" |
13 #include "xfa/fwl/core/cfwl_themebackground.h" | 14 #include "xfa/fwl/core/cfwl_themebackground.h" |
14 #include "xfa/fwl/core/cfwl_themetext.h" | 15 #include "xfa/fwl/core/cfwl_themetext.h" |
15 #include "xfa/fwl/core/fwl_noteimp.h" | 16 #include "xfa/fwl/core/fwl_noteimp.h" |
16 #include "xfa/fwl/core/ifwl_monthcalendar.h" | 17 #include "xfa/fwl/core/ifwl_monthcalendar.h" |
17 #include "xfa/fwl/core/ifwl_themeprovider.h" | 18 #include "xfa/fwl/core/ifwl_themeprovider.h" |
18 | 19 |
19 #define MONTHCAL_HSEP_HEIGHT 1 | 20 #define MONTHCAL_HSEP_HEIGHT 1 |
20 #define MONTHCAL_VSEP_WIDTH 1 | 21 #define MONTHCAL_VSEP_WIDTH 1 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 m_rtLBtn.Reset(); | 139 m_rtLBtn.Reset(); |
139 m_rtRBtn.Reset(); | 140 m_rtRBtn.Reset(); |
140 m_rtDates.Reset(); | 141 m_rtDates.Reset(); |
141 m_rtHSep.Reset(); | 142 m_rtHSep.Reset(); |
142 m_rtHeadText.Reset(); | 143 m_rtHeadText.Reset(); |
143 m_rtToday.Reset(); | 144 m_rtToday.Reset(); |
144 m_rtTodayFlag.Reset(); | 145 m_rtTodayFlag.Reset(); |
145 m_rtClient.Reset(); | 146 m_rtClient.Reset(); |
146 m_rtWeekNum.Reset(); | 147 m_rtWeekNum.Reset(); |
147 m_rtWeekNumSep.Reset(); | 148 m_rtWeekNumSep.Reset(); |
| 149 |
| 150 SetDelegate(pdfium::MakeUnique<CFWL_MonthCalendarImpDelegate>(this)); |
148 } | 151 } |
149 | 152 |
150 IFWL_MonthCalendar::~IFWL_MonthCalendar() { | 153 IFWL_MonthCalendar::~IFWL_MonthCalendar() { |
151 ClearDateItem(); | 154 ClearDateItem(); |
152 m_arrSelDays.RemoveAll(); | 155 m_arrSelDays.RemoveAll(); |
153 } | 156 } |
154 | 157 |
155 void IFWL_MonthCalendar::Initialize() { | |
156 IFWL_Widget::Initialize(); | |
157 m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); | |
158 } | |
159 | |
160 void IFWL_MonthCalendar::Finalize() { | |
161 delete m_pDelegate; | |
162 m_pDelegate = nullptr; | |
163 IFWL_Widget::Finalize(); | |
164 } | |
165 | |
166 FWL_Type IFWL_MonthCalendar::GetClassID() const { | 158 FWL_Type IFWL_MonthCalendar::GetClassID() const { |
167 return FWL_Type::MonthCalendar; | 159 return FWL_Type::MonthCalendar; |
168 } | 160 } |
169 | 161 |
170 FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, | 162 FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, |
171 FX_BOOL bAutoSize) { | 163 FX_BOOL bAutoSize) { |
172 if (bAutoSize) { | 164 if (bAutoSize) { |
173 CFX_SizeF fs = CalcSize(TRUE); | 165 CFX_SizeF fs = CalcSize(TRUE); |
174 rect.Set(0, 0, fs.x, fs.y); | 166 rect.Set(0, 0, fs.x, fs.y); |
175 IFWL_Widget::GetWidgetRect(rect, TRUE); | 167 IFWL_Widget::GetWidgetRect(rect, TRUE); |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 uint32_t dwSt, | 1201 uint32_t dwSt, |
1210 CFX_RectF rc, | 1202 CFX_RectF rc, |
1211 CFX_WideString& wsday) | 1203 CFX_WideString& wsday) |
1212 : iDay(day), | 1204 : iDay(day), |
1213 iDayOfWeek(dayofweek), | 1205 iDayOfWeek(dayofweek), |
1214 dwStates(dwSt), | 1206 dwStates(dwSt), |
1215 rect(rc), | 1207 rect(rc), |
1216 wsDay(wsday) {} | 1208 wsDay(wsday) {} |
1217 | 1209 |
1218 FWL_DATEINFO::~FWL_DATEINFO() {} | 1210 FWL_DATEINFO::~FWL_DATEINFO() {} |
OLD | NEW |