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/cfwl_monthcalendar.h" | 7 #include "xfa/fwl/core/cfwl_monthcalendar.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 CFWL_MonthCalendar::~CFWL_MonthCalendar() { | 154 CFWL_MonthCalendar::~CFWL_MonthCalendar() { |
155 ClearDateItem(); | 155 ClearDateItem(); |
156 m_arrSelDays.RemoveAll(); | 156 m_arrSelDays.RemoveAll(); |
157 } | 157 } |
158 | 158 |
159 FWL_Type CFWL_MonthCalendar::GetClassID() const { | 159 FWL_Type CFWL_MonthCalendar::GetClassID() const { |
160 return FWL_Type::MonthCalendar; | 160 return FWL_Type::MonthCalendar; |
161 } | 161 } |
162 | 162 |
163 void CFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | 163 CFX_RectF CFWL_MonthCalendar::GetAutosizedWidgetRect() { |
164 if (!bAutoSize) { | |
165 rect = m_pProperties->m_rtWidget; | |
166 return; | |
167 } | |
168 | |
169 CFX_SizeF fs = CalcSize(); | 164 CFX_SizeF fs = CalcSize(); |
| 165 CFX_RectF rect; |
170 rect.Set(0, 0, fs.x, fs.y); | 166 rect.Set(0, 0, fs.x, fs.y); |
171 InflateWidgetRect(rect); | 167 InflateWidgetRect(rect); |
| 168 return rect; |
172 } | 169 } |
173 | 170 |
174 void CFWL_MonthCalendar::Update() { | 171 void CFWL_MonthCalendar::Update() { |
175 if (IsLocked()) | 172 if (IsLocked()) |
176 return; | 173 return; |
177 if (!m_pProperties->m_pThemeProvider) | 174 if (!m_pProperties->m_pThemeProvider) |
178 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 175 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
179 | 176 |
180 GetCapValue(); | 177 GetCapValue(); |
181 if (!m_bInitialized) { | 178 if (!m_bInitialized) { |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 return; | 966 return; |
970 } | 967 } |
971 if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) | 968 if (m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) |
972 return; | 969 return; |
973 | 970 |
974 int32_t iOldSel = 0; | 971 int32_t iOldSel = 0; |
975 if (m_arrSelDays.GetSize() > 0) | 972 if (m_arrSelDays.GetSize() > 0) |
976 iOldSel = m_arrSelDays[0]; | 973 iOldSel = m_arrSelDays[0]; |
977 | 974 |
978 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); | 975 int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); |
979 CFX_RectF rt; | |
980 CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter); | 976 CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter); |
981 pIPicker->GetFormProxy()->GetWidgetRect(rt, false); | 977 CFX_RectF rt = pIPicker->GetFormProxy()->GetWidgetRect(); |
982 rt.Set(0, 0, rt.width, rt.height); | 978 rt.Set(0, 0, rt.width, rt.height); |
983 if (iCurSel > 0) { | 979 if (iCurSel > 0) { |
984 DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); | 980 DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); |
985 CFX_RectF rtInvalidate(lpDatesInfo->rect); | 981 CFX_RectF rtInvalidate(lpDatesInfo->rect); |
986 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { | 982 if (iOldSel > 0 && iOldSel <= m_arrDates.GetSize()) { |
987 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); | 983 lpDatesInfo = m_arrDates.GetAt(iOldSel - 1); |
988 rtInvalidate.Union(lpDatesInfo->rect); | 984 rtInvalidate.Union(lpDatesInfo->rect); |
989 } | 985 } |
990 AddSelDay(iCurSel); | 986 AddSelDay(iCurSel); |
991 if (!m_pOuter) | 987 if (!m_pOuter) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 uint32_t dwSt, | 1080 uint32_t dwSt, |
1085 CFX_RectF rc, | 1081 CFX_RectF rc, |
1086 CFX_WideString& wsday) | 1082 CFX_WideString& wsday) |
1087 : iDay(day), | 1083 : iDay(day), |
1088 iDayOfWeek(dayofweek), | 1084 iDayOfWeek(dayofweek), |
1089 dwStates(dwSt), | 1085 dwStates(dwSt), |
1090 rect(rc), | 1086 rect(rc), |
1091 wsDay(wsday) {} | 1087 wsDay(wsday) {} |
1092 | 1088 |
1093 CFWL_MonthCalendar::DATEINFO::~DATEINFO() {} | 1089 CFWL_MonthCalendar::DATEINFO::~DATEINFO() {} |
OLD | NEW |