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

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: 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
« no previous file with comments | « xfa/fwl/basewidget/fwl_monthcalendarimp.h ('k') | xfa/fwl/basewidget/fwl_pictureboximp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 if (!pDateInfo) 1010 if (!pDateInfo)
1011 return FALSE; 1011 return FALSE;
1012 rtDay = pDateInfo->rect; 1012 rtDay = pDateInfo->rect;
1013 return TRUE; 1013 return TRUE;
1014 } 1014 }
1015 1015
1016 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( 1016 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate(
1017 CFWL_MonthCalendarImp* pOwner) 1017 CFWL_MonthCalendarImp* pOwner)
1018 : m_pOwner(pOwner) {} 1018 : m_pOwner(pOwner) {}
1019 1019
1020 int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( 1020 void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
1021 CFWL_Message* pMessage) {
1022 if (!pMessage) 1021 if (!pMessage)
1023 return 0; 1022 return;
1024 1023
1025 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); 1024 CFWL_MessageType dwMsgCode = pMessage->GetClassID();
1026 int32_t iRet = 1;
1027 switch (dwMsgCode) { 1025 switch (dwMsgCode) {
1028 case CFWL_MessageType::SetFocus: { 1026 case CFWL_MessageType::SetFocus: {
1029 OnFocusChanged(pMessage, TRUE); 1027 OnFocusChanged(pMessage, TRUE);
1030 break; 1028 break;
1031 } 1029 }
1032 case CFWL_MessageType::KillFocus: { 1030 case CFWL_MessageType::KillFocus: {
1033 OnFocusChanged(pMessage, FALSE); 1031 OnFocusChanged(pMessage, FALSE);
1034 break; 1032 break;
1035 } 1033 }
1036 case CFWL_MessageType::Key: { 1034 case CFWL_MessageType::Key: {
(...skipping 17 matching lines...) Expand all
1054 case FWL_MouseCommand::Leave: { 1052 case FWL_MouseCommand::Leave: {
1055 OnMouseLeave(pMouse); 1053 OnMouseLeave(pMouse);
1056 break; 1054 break;
1057 } 1055 }
1058 default: 1056 default:
1059 break; 1057 break;
1060 } 1058 }
1061 break; 1059 break;
1062 } 1060 }
1063 default: { 1061 default: {
1064 iRet = 0;
1065 break; 1062 break;
1066 } 1063 }
1067 } 1064 }
1068 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1065 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1069 return iRet;
1070 } 1066 }
1071 1067
1072 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1068 void CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1073 const CFX_Matrix* pMatrix) { 1069 const CFX_Matrix* pMatrix) {
1074 return m_pOwner->DrawWidget(pGraphics, pMatrix); 1070 m_pOwner->DrawWidget(pGraphics, pMatrix);
1075 } 1071 }
1076 1072
1077 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} 1073 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {}
1078 1074
1079 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, 1075 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
1080 FX_BOOL bSet) { 1076 FX_BOOL bSet) {
1081 if (bSet) { 1077 if (bSet) {
1082 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 1078 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
1083 } else { 1079 } else {
1084 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; 1080 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 if (m_pOwner->m_iHovered > 0) { 1185 if (m_pOwner->m_iHovered > 0) {
1190 CFX_RectF rtInvalidate; 1186 CFX_RectF rtInvalidate;
1191 rtInvalidate.Set(0, 0, 0, 0); 1187 rtInvalidate.Set(0, 0, 0, 0);
1192 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); 1188 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
1193 m_pOwner->m_iHovered = -1; 1189 m_pOwner->m_iHovered = -1;
1194 if (!rtInvalidate.IsEmpty()) { 1190 if (!rtInvalidate.IsEmpty()) {
1195 m_pOwner->Repaint(&rtInvalidate); 1191 m_pOwner->Repaint(&rtInvalidate);
1196 } 1192 }
1197 } 1193 }
1198 } 1194 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_monthcalendarimp.h ('k') | xfa/fwl/basewidget/fwl_pictureboximp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698