Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: xfa/fwl/basewidget/fwl_monthcalendarimp.cpp

Issue 1943413002: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@bcdattribute
Patch Set: Mac XFA build Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/basewidget/fwl_monthcalendarimp.h" 7 #include "xfa/fwl/basewidget/fwl_monthcalendarimp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 m_rtWeekNumSep.Reset(); 173 m_rtWeekNumSep.Reset();
174 m_pDateTime = new CFX_DateTime; 174 m_pDateTime = new CFX_DateTime;
175 m_bInit = FALSE; 175 m_bInit = FALSE;
176 m_iMaxSel = 1; 176 m_iMaxSel = 1;
177 } 177 }
178 CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() { 178 CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() {
179 ClearDateItem(); 179 ClearDateItem();
180 delete m_pDateTime; 180 delete m_pDateTime;
181 m_arrSelDays.RemoveAll(); 181 m_arrSelDays.RemoveAll();
182 } 182 }
183 FWL_ERR CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { 183 FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const {
184 wsClass = FWL_CLASS_MonthCalendar; 184 wsClass = FWL_CLASS_MonthCalendar;
185 return FWL_ERR_Succeeded; 185 return FWL_Error::Succeeded;
186 } 186 }
187 uint32_t CFWL_MonthCalendarImp::GetClassID() const { 187 uint32_t CFWL_MonthCalendarImp::GetClassID() const {
188 return FWL_CLASSHASH_MonthCalendar; 188 return FWL_CLASSHASH_MonthCalendar;
189 } 189 }
190 FWL_ERR CFWL_MonthCalendarImp::Initialize() { 190 FWL_Error CFWL_MonthCalendarImp::Initialize() {
191 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) 191 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
192 return FWL_ERR_Indefinite; 192 return FWL_Error::Indefinite;
193 m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); 193 m_pDelegate = new CFWL_MonthCalendarImpDelegate(this);
194 return FWL_ERR_Succeeded; 194 return FWL_Error::Succeeded;
195 } 195 }
196 FWL_ERR CFWL_MonthCalendarImp::Finalize() { 196 FWL_Error CFWL_MonthCalendarImp::Finalize() {
197 delete m_pDelegate; 197 delete m_pDelegate;
198 m_pDelegate = nullptr; 198 m_pDelegate = nullptr;
199 return CFWL_WidgetImp::Finalize(); 199 return CFWL_WidgetImp::Finalize();
200 } 200 }
201 FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, 201 FWL_Error CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect,
202 FX_BOOL bAutoSize) { 202 FX_BOOL bAutoSize) {
203 if (bAutoSize) { 203 if (bAutoSize) {
204 CFX_SizeF fs = CalcSize(TRUE); 204 CFX_SizeF fs = CalcSize(TRUE);
205 rect.Set(0, 0, fs.x, fs.y); 205 rect.Set(0, 0, fs.x, fs.y);
206 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); 206 CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
207 } else { 207 } else {
208 rect = m_pProperties->m_rtWidget; 208 rect = m_pProperties->m_rtWidget;
209 } 209 }
210 return FWL_ERR_Succeeded; 210 return FWL_Error::Succeeded;
211 } 211 }
212 FWL_ERR CFWL_MonthCalendarImp::Update() { 212 FWL_Error CFWL_MonthCalendarImp::Update() {
213 if (IsLocked()) { 213 if (IsLocked()) {
214 return FWL_ERR_Indefinite; 214 return FWL_Error::Indefinite;
215 } 215 }
216 if (!m_pProperties->m_pThemeProvider) { 216 if (!m_pProperties->m_pThemeProvider) {
217 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 217 m_pProperties->m_pThemeProvider = GetAvailableTheme();
218 } 218 }
219 GetCapValue(); 219 GetCapValue();
220 if (!m_bInit) { 220 if (!m_bInit) {
221 m_bInit = InitDate(); 221 m_bInit = InitDate();
222 } 222 }
223 ClearDateItem(); 223 ClearDateItem();
224 ReSetDateItem(); 224 ReSetDateItem();
225 LayOut(); 225 LayOut();
226 return FWL_ERR_Succeeded; 226 return FWL_Error::Succeeded;
227 } 227 }
228 FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, 228 FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
229 const CFX_Matrix* pMatrix) { 229 const CFX_Matrix* pMatrix) {
230 if (!pGraphics) 230 if (!pGraphics)
231 return FWL_ERR_Indefinite; 231 return FWL_Error::Indefinite;
232 if (m_pProperties->m_pThemeProvider == NULL) { 232 if (m_pProperties->m_pThemeProvider == NULL) {
233 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 233 m_pProperties->m_pThemeProvider = GetAvailableTheme();
234 } 234 }
235 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; 235 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
236 if (HasBorder()) { 236 if (HasBorder()) {
237 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 237 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
238 } 238 }
239 if (HasEdge()) { 239 if (HasEdge()) {
240 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 240 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
241 } 241 }
242 DrawBkground(pGraphics, pTheme, pMatrix); 242 DrawBkground(pGraphics, pTheme, pMatrix);
243 DrawHeadBK(pGraphics, pTheme, pMatrix); 243 DrawHeadBK(pGraphics, pTheme, pMatrix);
244 DrawLButton(pGraphics, pTheme, pMatrix); 244 DrawLButton(pGraphics, pTheme, pMatrix);
245 DrawRButton(pGraphics, pTheme, pMatrix); 245 DrawRButton(pGraphics, pTheme, pMatrix);
246 DrawSeperator(pGraphics, pTheme, pMatrix); 246 DrawSeperator(pGraphics, pTheme, pMatrix);
247 DrawDatesInBK(pGraphics, pTheme, pMatrix); 247 DrawDatesInBK(pGraphics, pTheme, pMatrix);
248 DrawDatesInCircle(pGraphics, pTheme, pMatrix); 248 DrawDatesInCircle(pGraphics, pTheme, pMatrix);
249 DrawCaption(pGraphics, pTheme, pMatrix); 249 DrawCaption(pGraphics, pTheme, pMatrix);
250 DrawWeek(pGraphics, pTheme, pMatrix); 250 DrawWeek(pGraphics, pTheme, pMatrix);
251 DrawDatesIn(pGraphics, pTheme, pMatrix); 251 DrawDatesIn(pGraphics, pTheme, pMatrix);
252 DrawDatesOut(pGraphics, pTheme, pMatrix); 252 DrawDatesOut(pGraphics, pTheme, pMatrix);
253 DrawToday(pGraphics, pTheme, pMatrix); 253 DrawToday(pGraphics, pTheme, pMatrix);
254 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) { 254 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) {
255 DrawWeekNumberSep(pGraphics, pTheme, pMatrix); 255 DrawWeekNumberSep(pGraphics, pTheme, pMatrix);
256 DrawWeekNumber(pGraphics, pTheme, pMatrix); 256 DrawWeekNumber(pGraphics, pTheme, pMatrix);
257 } 257 }
258 return FWL_ERR_Succeeded; 258 return FWL_Error::Succeeded;
259 } 259 }
260 int32_t CFWL_MonthCalendarImp::CountSelect() { 260 int32_t CFWL_MonthCalendarImp::CountSelect() {
261 return m_arrSelDays.GetSize(); 261 return m_arrSelDays.GetSize();
262 } 262 }
263 FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear, 263 FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear,
264 int32_t& iMonth, 264 int32_t& iMonth,
265 int32_t& iDay, 265 int32_t& iDay,
266 int32_t nIndex) { 266 int32_t nIndex) {
267 if (nIndex >= m_arrSelDays.GetSize()) { 267 if (nIndex >= m_arrSelDays.GetSize()) {
268 return FALSE; 268 return FALSE;
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 } 1062 }
1063 default: { 1063 default: {
1064 iRet = 0; 1064 iRet = 0;
1065 break; 1065 break;
1066 } 1066 }
1067 } 1067 }
1068 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1068 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1069 return iRet; 1069 return iRet;
1070 } 1070 }
1071 1071
1072 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1072 FWL_Error CFWL_MonthCalendarImpDelegate::OnDrawWidget(
1073 const CFX_Matrix* pMatrix) { 1073 CFX_Graphics* pGraphics,
1074 const CFX_Matrix* pMatrix) {
1074 return m_pOwner->DrawWidget(pGraphics, pMatrix); 1075 return m_pOwner->DrawWidget(pGraphics, pMatrix);
1075 } 1076 }
1076 1077
1077 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} 1078 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {}
1078 1079
1079 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, 1080 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
1080 FX_BOOL bSet) { 1081 FX_BOOL bSet) {
1081 if (bSet) { 1082 if (bSet) {
1082 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 1083 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
1083 } else { 1084 } else {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 if (m_pOwner->m_iHovered > 0) { 1190 if (m_pOwner->m_iHovered > 0) {
1190 CFX_RectF rtInvalidate; 1191 CFX_RectF rtInvalidate;
1191 rtInvalidate.Set(0, 0, 0, 0); 1192 rtInvalidate.Set(0, 0, 0, 0);
1192 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); 1193 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
1193 m_pOwner->m_iHovered = -1; 1194 m_pOwner->m_iHovered = -1;
1194 if (!rtInvalidate.IsEmpty()) { 1195 if (!rtInvalidate.IsEmpty()) {
1195 m_pOwner->Repaint(&rtInvalidate); 1196 m_pOwner->Repaint(&rtInvalidate);
1196 } 1197 }
1197 } 1198 }
1198 } 1199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698