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_monthcalendarimp.h" | 7 #include "xfa/fwl/basewidget/fwl_monthcalendarimp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { | 915 FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { |
916 if (iDay <= 0 || iDay > m_arrDates.GetSize()) { | 916 if (iDay <= 0 || iDay > m_arrDates.GetSize()) { |
917 return FALSE; | 917 return FALSE; |
918 } | 918 } |
919 FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; | 919 FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; |
920 if (!pDateInfo) | 920 if (!pDateInfo) |
921 return FALSE; | 921 return FALSE; |
922 rtDay = pDateInfo->rect; | 922 rtDay = pDateInfo->rect; |
923 return TRUE; | 923 return TRUE; |
924 } | 924 } |
| 925 |
925 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( | 926 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( |
926 CFWL_MonthCalendarImp* pOwner) | 927 CFWL_MonthCalendarImp* pOwner) |
927 : m_pOwner(pOwner) {} | 928 : m_pOwner(pOwner) {} |
| 929 |
928 int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( | 930 int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( |
929 CFWL_Message* pMessage) { | 931 CFWL_Message* pMessage) { |
930 if (!pMessage) | 932 if (!pMessage) |
931 return 0; | 933 return 0; |
932 uint32_t dwMsgCode = pMessage->GetClassID(); | 934 |
| 935 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
933 int32_t iRet = 1; | 936 int32_t iRet = 1; |
934 switch (dwMsgCode) { | 937 switch (dwMsgCode) { |
935 case FWL_MSGHASH_SetFocus: | 938 case CFWL_MessageType::SetFocus: |
936 case FWL_MSGHASH_KillFocus: { | 939 case CFWL_MessageType::KillFocus: { |
937 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 940 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
938 break; | 941 break; |
939 } | 942 } |
940 case FWL_MSGHASH_Key: { | 943 case CFWL_MessageType::Key: { |
941 break; | 944 break; |
942 } | 945 } |
943 case FWL_MSGHASH_Mouse: { | 946 case CFWL_MessageType::Mouse: { |
944 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 947 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
945 uint32_t dwCmd = pMouse->m_dwCmd; | 948 uint32_t dwCmd = pMouse->m_dwCmd; |
946 switch (dwCmd) { | 949 switch (dwCmd) { |
947 case FWL_MSGMOUSECMD_LButtonDown: { | 950 case FWL_MSGMOUSECMD_LButtonDown: { |
948 OnLButtonDown(pMouse); | 951 OnLButtonDown(pMouse); |
949 break; | 952 break; |
950 } | 953 } |
951 case FWL_MSGMOUSECMD_LButtonUp: { | 954 case FWL_MSGMOUSECMD_LButtonUp: { |
952 OnLButtonUp(pMouse); | 955 OnLButtonUp(pMouse); |
953 break; | 956 break; |
954 } | 957 } |
955 case FWL_MSGMOUSECMD_MouseMove: { | 958 case FWL_MSGMOUSECMD_MouseMove: { |
956 OnMouseMove(pMouse); | 959 OnMouseMove(pMouse); |
957 break; | 960 break; |
958 } | 961 } |
959 case FWL_MSGMOUSECMD_MouseLeave: { | 962 case FWL_MSGMOUSECMD_MouseLeave: { |
960 OnMouseLeave(pMouse); | 963 OnMouseLeave(pMouse); |
961 break; | 964 break; |
962 } | 965 } |
963 default: { break; } | 966 default: |
| 967 break; |
964 } | 968 } |
965 break; | 969 break; |
966 } | 970 } |
967 default: { | 971 default: { |
968 iRet = 0; | 972 iRet = 0; |
969 break; | 973 break; |
970 } | 974 } |
971 } | 975 } |
972 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 976 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
973 return iRet; | 977 return iRet; |
974 } | 978 } |
| 979 |
975 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 980 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
976 const CFX_Matrix* pMatrix) { | 981 const CFX_Matrix* pMatrix) { |
977 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 982 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
978 } | 983 } |
979 | 984 |
980 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} | 985 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} |
981 | 986 |
982 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 987 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
983 FX_BOOL bSet) { | 988 FX_BOOL bSet) { |
984 if (bSet) { | 989 if (bSet) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 if (m_pOwner->m_iHovered > 0) { | 1097 if (m_pOwner->m_iHovered > 0) { |
1093 CFX_RectF rtInvalidate; | 1098 CFX_RectF rtInvalidate; |
1094 rtInvalidate.Set(0, 0, 0, 0); | 1099 rtInvalidate.Set(0, 0, 0, 0); |
1095 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); | 1100 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); |
1096 m_pOwner->m_iHovered = -1; | 1101 m_pOwner->m_iHovered = -1; |
1097 if (!rtInvalidate.IsEmpty()) { | 1102 if (!rtInvalidate.IsEmpty()) { |
1098 m_pOwner->Repaint(&rtInvalidate); | 1103 m_pOwner->Repaint(&rtInvalidate); |
1099 } | 1104 } |
1100 } | 1105 } |
1101 } | 1106 } |
OLD | NEW |