| 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 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 IFWL_MonthCalendar::~IFWL_MonthCalendar() { | 151 IFWL_MonthCalendar::~IFWL_MonthCalendar() { |
| 152 ClearDateItem(); | 152 ClearDateItem(); |
| 153 m_arrSelDays.RemoveAll(); | 153 m_arrSelDays.RemoveAll(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 FWL_Type IFWL_MonthCalendar::GetClassID() const { | 156 FWL_Type IFWL_MonthCalendar::GetClassID() const { |
| 157 return FWL_Type::MonthCalendar; | 157 return FWL_Type::MonthCalendar; |
| 158 } | 158 } |
| 159 | 159 |
| 160 FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { | 160 void IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { |
| 161 if (bAutoSize) { | 161 if (bAutoSize) { |
| 162 CFX_SizeF fs = CalcSize(true); | 162 CFX_SizeF fs = CalcSize(true); |
| 163 rect.Set(0, 0, fs.x, fs.y); | 163 rect.Set(0, 0, fs.x, fs.y); |
| 164 IFWL_Widget::GetWidgetRect(rect, true); | 164 IFWL_Widget::GetWidgetRect(rect, true); |
| 165 } else { | 165 } else { |
| 166 rect = m_pProperties->m_rtWidget; | 166 rect = m_pProperties->m_rtWidget; |
| 167 } | 167 } |
| 168 return FWL_Error::Succeeded; | |
| 169 } | 168 } |
| 170 | 169 |
| 171 FWL_Error IFWL_MonthCalendar::Update() { | 170 void IFWL_MonthCalendar::Update() { |
| 172 if (IsLocked()) { | 171 if (IsLocked()) { |
| 173 return FWL_Error::Indefinite; | 172 return; |
| 174 } | 173 } |
| 175 if (!m_pProperties->m_pThemeProvider) { | 174 if (!m_pProperties->m_pThemeProvider) { |
| 176 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 175 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 177 } | 176 } |
| 178 GetCapValue(); | 177 GetCapValue(); |
| 179 if (!m_bInit) { | 178 if (!m_bInit) { |
| 180 m_bInit = InitDate(); | 179 m_bInit = InitDate(); |
| 181 } | 180 } |
| 182 ClearDateItem(); | 181 ClearDateItem(); |
| 183 ReSetDateItem(); | 182 ReSetDateItem(); |
| 184 LayOut(); | 183 LayOut(); |
| 185 return FWL_Error::Succeeded; | |
| 186 } | 184 } |
| 187 | 185 |
| 188 FWL_Error IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, | 186 void IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics, |
| 189 const CFX_Matrix* pMatrix) { | 187 const CFX_Matrix* pMatrix) { |
| 190 if (!pGraphics) | 188 if (!pGraphics) |
| 191 return FWL_Error::Indefinite; | 189 return; |
| 192 if (!m_pProperties->m_pThemeProvider) { | 190 if (!m_pProperties->m_pThemeProvider) { |
| 193 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 191 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 194 } | 192 } |
| 195 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 193 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 196 if (HasBorder()) { | 194 if (HasBorder()) { |
| 197 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 195 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
| 198 } | 196 } |
| 199 if (HasEdge()) { | 197 if (HasEdge()) { |
| 200 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | 198 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); |
| 201 } | 199 } |
| 202 DrawBkground(pGraphics, pTheme, pMatrix); | 200 DrawBkground(pGraphics, pTheme, pMatrix); |
| 203 DrawHeadBK(pGraphics, pTheme, pMatrix); | 201 DrawHeadBK(pGraphics, pTheme, pMatrix); |
| 204 DrawLButton(pGraphics, pTheme, pMatrix); | 202 DrawLButton(pGraphics, pTheme, pMatrix); |
| 205 DrawRButton(pGraphics, pTheme, pMatrix); | 203 DrawRButton(pGraphics, pTheme, pMatrix); |
| 206 DrawSeperator(pGraphics, pTheme, pMatrix); | 204 DrawSeperator(pGraphics, pTheme, pMatrix); |
| 207 DrawDatesInBK(pGraphics, pTheme, pMatrix); | 205 DrawDatesInBK(pGraphics, pTheme, pMatrix); |
| 208 DrawDatesInCircle(pGraphics, pTheme, pMatrix); | 206 DrawDatesInCircle(pGraphics, pTheme, pMatrix); |
| 209 DrawCaption(pGraphics, pTheme, pMatrix); | 207 DrawCaption(pGraphics, pTheme, pMatrix); |
| 210 DrawWeek(pGraphics, pTheme, pMatrix); | 208 DrawWeek(pGraphics, pTheme, pMatrix); |
| 211 DrawDatesIn(pGraphics, pTheme, pMatrix); | 209 DrawDatesIn(pGraphics, pTheme, pMatrix); |
| 212 DrawDatesOut(pGraphics, pTheme, pMatrix); | 210 DrawDatesOut(pGraphics, pTheme, pMatrix); |
| 213 DrawToday(pGraphics, pTheme, pMatrix); | 211 DrawToday(pGraphics, pTheme, pMatrix); |
| 214 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { | 212 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { |
| 215 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); | 213 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); |
| 216 DrawWeekNumber(pGraphics, pTheme, pMatrix); | 214 DrawWeekNumber(pGraphics, pTheme, pMatrix); |
| 217 } | 215 } |
| 218 return FWL_Error::Succeeded; | |
| 219 } | 216 } |
| 220 | 217 |
| 221 int32_t IFWL_MonthCalendar::CountSelect() { | 218 int32_t IFWL_MonthCalendar::CountSelect() { |
| 222 return m_arrSelDays.GetSize(); | 219 return m_arrSelDays.GetSize(); |
| 223 } | 220 } |
| 224 | 221 |
| 225 bool IFWL_MonthCalendar::GetSelect(int32_t& iYear, | 222 bool IFWL_MonthCalendar::GetSelect(int32_t& iYear, |
| 226 int32_t& iMonth, | 223 int32_t& iMonth, |
| 227 int32_t& iDay, | 224 int32_t& iDay, |
| 228 int32_t nIndex) { | 225 int32_t nIndex) { |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 uint32_t dwSt, | 1175 uint32_t dwSt, |
| 1179 CFX_RectF rc, | 1176 CFX_RectF rc, |
| 1180 CFX_WideString& wsday) | 1177 CFX_WideString& wsday) |
| 1181 : iDay(day), | 1178 : iDay(day), |
| 1182 iDayOfWeek(dayofweek), | 1179 iDayOfWeek(dayofweek), |
| 1183 dwStates(dwSt), | 1180 dwStates(dwSt), |
| 1184 rect(rc), | 1181 rect(rc), |
| 1185 wsDay(wsday) {} | 1182 wsDay(wsday) {} |
| 1186 | 1183 |
| 1187 FWL_DATEINFO::~FWL_DATEINFO() {} | 1184 FWL_DATEINFO::~FWL_DATEINFO() {} |
| OLD | NEW |