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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { | 1006 FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { |
1007 if (iDay <= 0 || iDay > m_arrDates.GetSize()) { | 1007 if (iDay <= 0 || iDay > m_arrDates.GetSize()) { |
1008 return FALSE; | 1008 return FALSE; |
1009 } | 1009 } |
1010 FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; | 1010 FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; |
1011 if (!pDateInfo) | 1011 if (!pDateInfo) |
1012 return FALSE; | 1012 return FALSE; |
1013 rtDay = pDateInfo->rect; | 1013 rtDay = pDateInfo->rect; |
1014 return TRUE; | 1014 return TRUE; |
1015 } | 1015 } |
| 1016 |
1016 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( | 1017 CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( |
1017 CFWL_MonthCalendarImp* pOwner) | 1018 CFWL_MonthCalendarImp* pOwner) |
1018 : m_pOwner(pOwner) {} | 1019 : m_pOwner(pOwner) {} |
| 1020 |
1019 int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( | 1021 int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( |
1020 CFWL_Message* pMessage) { | 1022 CFWL_Message* pMessage) { |
1021 if (!pMessage) | 1023 if (!pMessage) |
1022 return 0; | 1024 return 0; |
1023 uint32_t dwMsgCode = pMessage->GetClassID(); | 1025 |
| 1026 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
1024 int32_t iRet = 1; | 1027 int32_t iRet = 1; |
1025 switch (dwMsgCode) { | 1028 switch (dwMsgCode) { |
1026 case FWL_MSGHASH_SetFocus: | 1029 case CFWL_MessageType::SetFocus: { |
1027 case FWL_MSGHASH_KillFocus: { | 1030 OnFocusChanged(pMessage, TRUE); |
1028 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | |
1029 break; | 1031 break; |
1030 } | 1032 } |
1031 case FWL_MSGHASH_Key: { | 1033 case CFWL_MessageType::KillFocus: { |
| 1034 OnFocusChanged(pMessage, FALSE); |
1032 break; | 1035 break; |
1033 } | 1036 } |
1034 case FWL_MSGHASH_Mouse: { | 1037 case CFWL_MessageType::Key: { |
| 1038 break; |
| 1039 } |
| 1040 case CFWL_MessageType::Mouse: { |
1035 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 1041 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
1036 uint32_t dwCmd = pMouse->m_dwCmd; | 1042 switch (pMouse->m_dwCmd) { |
1037 switch (dwCmd) { | |
1038 case FWL_MSGMOUSECMD_LButtonDown: { | 1043 case FWL_MSGMOUSECMD_LButtonDown: { |
1039 OnLButtonDown(pMouse); | 1044 OnLButtonDown(pMouse); |
1040 break; | 1045 break; |
1041 } | 1046 } |
1042 case FWL_MSGMOUSECMD_LButtonUp: { | 1047 case FWL_MSGMOUSECMD_LButtonUp: { |
1043 OnLButtonUp(pMouse); | 1048 OnLButtonUp(pMouse); |
1044 break; | 1049 break; |
1045 } | 1050 } |
1046 case FWL_MSGMOUSECMD_MouseMove: { | 1051 case FWL_MSGMOUSECMD_MouseMove: { |
1047 OnMouseMove(pMouse); | 1052 OnMouseMove(pMouse); |
1048 break; | 1053 break; |
1049 } | 1054 } |
1050 case FWL_MSGMOUSECMD_MouseLeave: { | 1055 case FWL_MSGMOUSECMD_MouseLeave: { |
1051 OnMouseLeave(pMouse); | 1056 OnMouseLeave(pMouse); |
1052 break; | 1057 break; |
1053 } | 1058 } |
1054 default: { break; } | 1059 default: |
| 1060 break; |
1055 } | 1061 } |
1056 break; | 1062 break; |
1057 } | 1063 } |
1058 default: { | 1064 default: { |
1059 iRet = 0; | 1065 iRet = 0; |
1060 break; | 1066 break; |
1061 } | 1067 } |
1062 } | 1068 } |
1063 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1069 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1064 return iRet; | 1070 return iRet; |
1065 } | 1071 } |
| 1072 |
1066 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1073 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1067 const CFX_Matrix* pMatrix) { | 1074 const CFX_Matrix* pMatrix) { |
1068 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1075 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
1069 } | 1076 } |
1070 | 1077 |
1071 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} | 1078 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} |
1072 | 1079 |
1073 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 1080 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
1074 FX_BOOL bSet) { | 1081 FX_BOOL bSet) { |
1075 if (bSet) { | 1082 if (bSet) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 if (m_pOwner->m_iHovered > 0) { | 1190 if (m_pOwner->m_iHovered > 0) { |
1184 CFX_RectF rtInvalidate; | 1191 CFX_RectF rtInvalidate; |
1185 rtInvalidate.Set(0, 0, 0, 0); | 1192 rtInvalidate.Set(0, 0, 0, 0); |
1186 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); | 1193 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); |
1187 m_pOwner->m_iHovered = -1; | 1194 m_pOwner->m_iHovered = -1; |
1188 if (!rtInvalidate.IsEmpty()) { | 1195 if (!rtInvalidate.IsEmpty()) { |
1189 m_pOwner->Repaint(&rtInvalidate); | 1196 m_pOwner->Repaint(&rtInvalidate); |
1190 } | 1197 } |
1191 } | 1198 } |
1192 } | 1199 } |
OLD | NEW |