| 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/basewidget/fwl_datetimepickerimp.h" | 7 #include "xfa/fwl/basewidget/fwl_datetimepickerimp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/fwl_editimp.h" | 9 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 rtInvalidate.Union(lpDatesInfo->rect); | 414 rtInvalidate.Union(lpDatesInfo->rect); |
| 415 } | 415 } |
| 416 m_pOwner->AddSelDay(iCurSel); | 416 m_pOwner->AddSelDay(iCurSel); |
| 417 CFWL_DateTimePickerImp* pDateTime = | 417 CFWL_DateTimePickerImp* pDateTime = |
| 418 static_cast<CFWL_DateTimePickerImp*>(m_pOwner->m_pOuter->GetImpl()); | 418 static_cast<CFWL_DateTimePickerImp*>(m_pOwner->m_pOuter->GetImpl()); |
| 419 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, | 419 pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth, |
| 420 iCurSel); | 420 iCurSel); |
| 421 pDateTime->ShowMonthCalendar(FALSE); | 421 pDateTime->ShowMonthCalendar(FALSE); |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 |
| 424 CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( | 425 CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( |
| 425 const CFWL_WidgetImpProperties& properties, | 426 const CFWL_WidgetImpProperties& properties, |
| 426 IFWL_Widget* pOuter) | 427 IFWL_Widget* pOuter) |
| 427 : CFWL_WidgetImp(properties, pOuter), | 428 : CFWL_WidgetImp(properties, pOuter), |
| 428 m_iBtnState(1), | 429 m_iBtnState(1), |
| 429 m_iYear(-1), | 430 m_iYear(-1), |
| 430 m_iMonth(-1), | 431 m_iMonth(-1), |
| 431 m_iDay(-1), | 432 m_iDay(-1), |
| 432 m_bLBtnDown(FALSE), | 433 m_bLBtnDown(FALSE), |
| 433 m_pEdit(nullptr), | 434 m_pEdit(nullptr), |
| 434 m_pMonthCal(nullptr), | 435 m_pMonthCal(nullptr), |
| 435 m_pForm(nullptr) { | 436 m_pForm(nullptr) { |
| 436 m_rtBtn.Set(0, 0, 0, 0); | 437 m_rtBtn.Set(0, 0, 0, 0); |
| 437 } | 438 } |
| 439 |
| 438 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} | 440 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} |
| 441 |
| 439 FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { | 442 FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { |
| 440 wsClass = FWL_CLASS_DateTimePicker; | 443 wsClass = FWL_CLASS_DateTimePicker; |
| 441 return FWL_Error::Succeeded; | 444 return FWL_Error::Succeeded; |
| 442 } | 445 } |
| 443 uint32_t CFWL_DateTimePickerImp::GetClassID() const { | 446 |
| 444 return FWL_CLASSHASH_DateTimePicker; | 447 FWL_Type CFWL_DateTimePickerImp::GetClassID() const { |
| 448 return FWL_Type::DateTimePicker; |
| 445 } | 449 } |
| 450 |
| 446 FWL_Error CFWL_DateTimePickerImp::Initialize() { | 451 FWL_Error CFWL_DateTimePickerImp::Initialize() { |
| 447 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) | 452 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
| 448 return FWL_Error::Indefinite; | 453 return FWL_Error::Indefinite; |
| 454 |
| 449 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); | 455 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); |
| 450 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; | 456 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; |
| 451 CFWL_WidgetImpProperties propMonth; | 457 CFWL_WidgetImpProperties propMonth; |
| 452 propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; | 458 propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; |
| 453 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; | 459 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; |
| 454 propMonth.m_pDataProvider = &m_MonthCalendarDP; | 460 propMonth.m_pDataProvider = &m_MonthCalendarDP; |
| 455 propMonth.m_pParent = m_pInterface; | 461 propMonth.m_pParent = m_pInterface; |
| 456 propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 462 propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
| 457 m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface)); | 463 m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface)); |
| 458 m_pMonthCal->Initialize(); | 464 m_pMonthCal->Initialize(); |
| 459 CFX_RectF rtMonthCal; | 465 CFX_RectF rtMonthCal; |
| 460 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); | 466 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); |
| 461 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); | 467 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); |
| 462 m_pMonthCal->SetWidgetRect(rtMonthCal); | 468 m_pMonthCal->SetWidgetRect(rtMonthCal); |
| 463 CFWL_WidgetImpProperties propEdit; | 469 CFWL_WidgetImpProperties propEdit; |
| 464 propEdit.m_pParent = m_pInterface; | 470 propEdit.m_pParent = m_pInterface; |
| 465 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 471 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
| 466 m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface)); | 472 m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface)); |
| 467 m_pEdit->Initialize(); | 473 m_pEdit->Initialize(); |
| 468 RegisterEventTarget(m_pMonthCal.get()); | 474 RegisterEventTarget(m_pMonthCal.get()); |
| 469 RegisterEventTarget(m_pEdit.get()); | 475 RegisterEventTarget(m_pEdit.get()); |
| 470 return FWL_Error::Succeeded; | 476 return FWL_Error::Succeeded; |
| 471 } | 477 } |
| 478 |
| 472 FWL_Error CFWL_DateTimePickerImp::Finalize() { | 479 FWL_Error CFWL_DateTimePickerImp::Finalize() { |
| 473 if (m_pEdit) { | 480 if (m_pEdit) { |
| 474 m_pEdit->Finalize(); | 481 m_pEdit->Finalize(); |
| 475 } | 482 } |
| 476 if (m_pMonthCal) { | 483 if (m_pMonthCal) { |
| 477 m_pMonthCal->Finalize(); | 484 m_pMonthCal->Finalize(); |
| 478 } | 485 } |
| 479 if (m_pForm) { | 486 if (m_pForm) { |
| 480 m_pForm->Finalize(); | 487 m_pForm->Finalize(); |
| 481 } | 488 } |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 } | 1181 } |
| 1175 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1182 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
| 1176 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1183 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); |
| 1177 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1184 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
| 1178 pDelegate->OnProcessMessage(pMsg); | 1185 pDelegate->OnProcessMessage(pMsg); |
| 1179 } | 1186 } |
| 1180 } | 1187 } |
| 1181 rtInvalidate.Inflate(2, 2); | 1188 rtInvalidate.Inflate(2, 2); |
| 1182 m_pOwner->Repaint(&rtInvalidate); | 1189 m_pOwner->Repaint(&rtInvalidate); |
| 1183 } | 1190 } |
| OLD | NEW |