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