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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 CFX_RectF rtMonthCal; | 531 CFX_RectF rtMonthCal; |
532 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); | 532 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); |
533 CFX_RectF rtPopUp; | 533 CFX_RectF rtPopUp; |
534 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + FWL_DTP_HEIGHT, | 534 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + FWL_DTP_HEIGHT, |
535 rtMonthCal.width, rtMonthCal.height); | 535 rtMonthCal.width, rtMonthCal.height); |
536 m_pMonthCal->SetWidgetRect(rtPopUp); | 536 m_pMonthCal->SetWidgetRect(rtPopUp); |
537 m_pMonthCal->Update(); | 537 m_pMonthCal->Update(); |
538 return FWL_ERR_Succeeded; | 538 return FWL_ERR_Succeeded; |
539 } | 539 } |
540 uint32_t CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 540 FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
541 if (m_pWidgetMgr->IsFormDisabled()) { | 541 if (m_pWidgetMgr->IsFormDisabled()) |
542 return DisForm_HitTest(fx, fy); | 542 return DisForm_HitTest(fx, fy); |
543 } | 543 if (m_rtClient.Contains(fx, fy)) |
544 if (m_rtClient.Contains(fx, fy)) { | 544 return FWL_WidgetHit::Client; |
545 return FWL_WGTHITTEST_Client; | |
546 } | |
547 if (IsMonthCalendarShowed()) { | 545 if (IsMonthCalendarShowed()) { |
548 CFX_RectF rect; | 546 CFX_RectF rect; |
549 m_pMonthCal->GetWidgetRect(rect); | 547 m_pMonthCal->GetWidgetRect(rect); |
550 if (rect.Contains(fx, fy)) { | 548 if (rect.Contains(fx, fy)) |
551 return FWL_WGTHITTEST_Client; | 549 return FWL_WidgetHit::Client; |
552 } | |
553 } | 550 } |
554 return FWL_WGTHITTEST_Unknown; | 551 return FWL_WidgetHit::Unknown; |
555 } | 552 } |
556 FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, | 553 FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, |
557 const CFX_Matrix* pMatrix) { | 554 const CFX_Matrix* pMatrix) { |
558 if (!pGraphics) | 555 if (!pGraphics) |
559 return FWL_ERR_Indefinite; | 556 return FWL_ERR_Indefinite; |
560 if (!m_pProperties->m_pThemeProvider) | 557 if (!m_pProperties->m_pThemeProvider) |
561 return FWL_ERR_Indefinite; | 558 return FWL_ERR_Indefinite; |
562 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 559 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
563 if (HasBorder()) { | 560 if (HasBorder()) { |
564 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 561 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 pDelegate->OnProcessMessage(&msg); | 897 pDelegate->OnProcessMessage(&msg); |
901 } | 898 } |
902 CFX_RectF rtInvalidate, rtCal; | 899 CFX_RectF rtInvalidate, rtCal; |
903 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, | 900 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, |
904 m_pProperties->m_rtWidget.height); | 901 m_pProperties->m_rtWidget.height); |
905 m_pMonthCal->GetWidgetRect(rtCal); | 902 m_pMonthCal->GetWidgetRect(rtCal); |
906 rtInvalidate.Union(rtCal); | 903 rtInvalidate.Union(rtCal); |
907 rtInvalidate.Inflate(2, 2); | 904 rtInvalidate.Inflate(2, 2); |
908 Repaint(&rtInvalidate); | 905 Repaint(&rtInvalidate); |
909 } | 906 } |
910 uint32_t CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 907 FWL_WidgetHit CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx, |
| 908 FX_FLOAT fy) { |
911 CFX_RectF rect; | 909 CFX_RectF rect; |
912 rect.Set(0, 0, m_pProperties->m_rtWidget.width, | 910 rect.Set(0, 0, m_pProperties->m_rtWidget.width, |
913 m_pProperties->m_rtWidget.height); | 911 m_pProperties->m_rtWidget.height); |
914 if (rect.Contains(fx, fy)) { | 912 if (rect.Contains(fx, fy)) |
915 return FWL_WGTHITTEST_Edit; | 913 return FWL_WidgetHit::Edit; |
916 } | 914 if (DisForm_IsNeedShowButton()) |
917 if (DisForm_IsNeedShowButton()) { | |
918 rect.width += m_fBtn; | 915 rect.width += m_fBtn; |
919 } | 916 if (rect.Contains(fx, fy)) |
920 if (rect.Contains(fx, fy)) { | 917 return FWL_WidgetHit::Client; |
921 return FWL_WGTHITTEST_Client; | |
922 } | |
923 if (IsMonthCalendarShowed()) { | 918 if (IsMonthCalendarShowed()) { |
924 m_pMonthCal->GetWidgetRect(rect); | 919 m_pMonthCal->GetWidgetRect(rect); |
925 if (rect.Contains(fx, fy)) { | 920 if (rect.Contains(fx, fy)) |
926 return FWL_WGTHITTEST_Client; | 921 return FWL_WidgetHit::Client; |
927 } | |
928 } | 922 } |
929 return FWL_WGTHITTEST_Unknown; | 923 return FWL_WidgetHit::Unknown; |
930 } | 924 } |
931 FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { | 925 FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { |
932 FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || | 926 FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || |
933 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || | 927 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || |
934 m_pEdit->GetStates() & FWL_WGTSTATE_Focused; | 928 m_pEdit->GetStates() & FWL_WGTSTATE_Focused; |
935 return bFocus; | 929 return bFocus; |
936 } | 930 } |
937 FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { | 931 FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { |
938 if (m_iLock) { | 932 if (m_iLock) { |
939 return FWL_ERR_Indefinite; | 933 return FWL_ERR_Indefinite; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 } | 1164 } |
1171 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1165 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
1172 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1166 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); |
1173 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1167 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
1174 pDelegate->OnProcessMessage(pMsg); | 1168 pDelegate->OnProcessMessage(pMsg); |
1175 } | 1169 } |
1176 } | 1170 } |
1177 rtInvalidate.Inflate(2, 2); | 1171 rtInvalidate.Inflate(2, 2); |
1178 m_pOwner->Repaint(&rtInvalidate); | 1172 m_pOwner->Repaint(&rtInvalidate); |
1179 } | 1173 } |
OLD | NEW |