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 case CFWL_MessageType::KillFocus: { |
1028 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1031 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
Tom Sepez
2016/04/21 19:22:33
missed another
dsinclair
2016/04/21 19:35:49
Done.
| |
1029 break; | 1032 break; |
1030 } | 1033 } |
1031 case FWL_MSGHASH_Key: { | 1034 case CFWL_MessageType::Key: { |
1032 break; | 1035 break; |
1033 } | 1036 } |
1034 case FWL_MSGHASH_Mouse: { | 1037 case CFWL_MessageType::Mouse: { |
1035 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 1038 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
1036 uint32_t dwCmd = pMouse->m_dwCmd; | 1039 uint32_t dwCmd = pMouse->m_dwCmd; |
1037 switch (dwCmd) { | 1040 switch (dwCmd) { |
1038 case FWL_MSGMOUSECMD_LButtonDown: { | 1041 case FWL_MSGMOUSECMD_LButtonDown: { |
1039 OnLButtonDown(pMouse); | 1042 OnLButtonDown(pMouse); |
1040 break; | 1043 break; |
1041 } | 1044 } |
1042 case FWL_MSGMOUSECMD_LButtonUp: { | 1045 case FWL_MSGMOUSECMD_LButtonUp: { |
1043 OnLButtonUp(pMouse); | 1046 OnLButtonUp(pMouse); |
1044 break; | 1047 break; |
1045 } | 1048 } |
1046 case FWL_MSGMOUSECMD_MouseMove: { | 1049 case FWL_MSGMOUSECMD_MouseMove: { |
1047 OnMouseMove(pMouse); | 1050 OnMouseMove(pMouse); |
1048 break; | 1051 break; |
1049 } | 1052 } |
1050 case FWL_MSGMOUSECMD_MouseLeave: { | 1053 case FWL_MSGMOUSECMD_MouseLeave: { |
1051 OnMouseLeave(pMouse); | 1054 OnMouseLeave(pMouse); |
1052 break; | 1055 break; |
1053 } | 1056 } |
1054 default: { break; } | 1057 default: |
1058 break; | |
1055 } | 1059 } |
1056 break; | 1060 break; |
1057 } | 1061 } |
1058 default: { | 1062 default: { |
1059 iRet = 0; | 1063 iRet = 0; |
1060 break; | 1064 break; |
1061 } | 1065 } |
1062 } | 1066 } |
1063 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1067 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1064 return iRet; | 1068 return iRet; |
1065 } | 1069 } |
1070 | |
1066 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1071 FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1067 const CFX_Matrix* pMatrix) { | 1072 const CFX_Matrix* pMatrix) { |
1068 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1073 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
1069 } | 1074 } |
1070 | 1075 |
1071 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} | 1076 void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} |
1072 | 1077 |
1073 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 1078 void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
1074 FX_BOOL bSet) { | 1079 FX_BOOL bSet) { |
1075 if (bSet) { | 1080 if (bSet) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1183 if (m_pOwner->m_iHovered > 0) { | 1188 if (m_pOwner->m_iHovered > 0) { |
1184 CFX_RectF rtInvalidate; | 1189 CFX_RectF rtInvalidate; |
1185 rtInvalidate.Set(0, 0, 0, 0); | 1190 rtInvalidate.Set(0, 0, 0, 0); |
1186 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); | 1191 m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate); |
1187 m_pOwner->m_iHovered = -1; | 1192 m_pOwner->m_iHovered = -1; |
1188 if (!rtInvalidate.IsEmpty()) { | 1193 if (!rtInvalidate.IsEmpty()) { |
1189 m_pOwner->Repaint(&rtInvalidate); | 1194 m_pOwner->Repaint(&rtInvalidate); |
1190 } | 1195 } |
1191 } | 1196 } |
1192 } | 1197 } |
OLD | NEW |