| 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/core/fwl_widgetimp.h" | 7 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(NULL); | 846 IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(NULL); |
| 847 pDelegate->OnProcessEvent(pEvent); | 847 pDelegate->OnProcessEvent(pEvent); |
| 848 return; | 848 return; |
| 849 } | 849 } |
| 850 IFWL_Thread* pThread = GetOwnerThread(); | 850 IFWL_Thread* pThread = GetOwnerThread(); |
| 851 if (!pThread) | 851 if (!pThread) |
| 852 return; | 852 return; |
| 853 IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver(); | 853 IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver(); |
| 854 if (!pNoteDriver) | 854 if (!pNoteDriver) |
| 855 return; | 855 return; |
| 856 pNoteDriver->SendNote(pEvent); | 856 pNoteDriver->SendEvent(pEvent); |
| 857 } | 857 } |
| 858 void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) { | 858 void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) { |
| 859 if (pRect) { | 859 if (pRect) { |
| 860 m_pWidgetMgr->RepaintWidget(m_pInterface, pRect); | 860 m_pWidgetMgr->RepaintWidget(m_pInterface, pRect); |
| 861 return; | 861 return; |
| 862 } | 862 } |
| 863 CFX_RectF rect; | 863 CFX_RectF rect; |
| 864 rect = m_pProperties->m_rtWidget; | 864 rect = m_pProperties->m_rtWidget; |
| 865 rect.left = rect.top = 0; | 865 rect.left = rect.top = 0; |
| 866 m_pWidgetMgr->RepaintWidget(m_pInterface, &rect); | 866 m_pWidgetMgr->RepaintWidget(m_pInterface, &rect); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 945 } |
| 946 FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) { | 946 FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) { |
| 947 IFWL_Widget* pUpWidget = GetParent(); | 947 IFWL_Widget* pUpWidget = GetParent(); |
| 948 while (pUpWidget) { | 948 while (pUpWidget) { |
| 949 if (pUpWidget == pParent) | 949 if (pUpWidget == pParent) |
| 950 return TRUE; | 950 return TRUE; |
| 951 pUpWidget = pUpWidget->GetParent(); | 951 pUpWidget = pUpWidget->GetParent(); |
| 952 } | 952 } |
| 953 return FALSE; | 953 return FALSE; |
| 954 } | 954 } |
| 955 |
| 955 CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} | 956 CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} |
| 957 |
| 956 int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 958 int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 957 if (!pMessage->m_pDstTarget) | 959 if (!pMessage->m_pDstTarget) |
| 958 return 0; | 960 return 0; |
| 961 |
| 959 CFWL_WidgetImp* pWidget = | 962 CFWL_WidgetImp* pWidget = |
| 960 static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); | 963 static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); |
| 961 uint32_t dwMsgCode = pMessage->GetClassID(); | 964 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| 962 switch (dwMsgCode) { | 965 switch (dwMsgCode) { |
| 963 case FWL_MSGHASH_Mouse: { | 966 case CFWL_MessageType::Mouse: { |
| 964 CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 967 CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
| 965 CFWL_EvtMouse evt; | 968 CFWL_EvtMouse evt; |
| 966 evt.m_pSrcTarget = pWidget->m_pInterface; | 969 evt.m_pSrcTarget = pWidget->m_pInterface; |
| 967 evt.m_pDstTarget = pWidget->m_pInterface; | 970 evt.m_pDstTarget = pWidget->m_pInterface; |
| 968 evt.m_dwCmd = pMsgMouse->m_dwCmd; | 971 evt.m_dwCmd = pMsgMouse->m_dwCmd; |
| 969 evt.m_dwFlags = pMsgMouse->m_dwFlags; | 972 evt.m_dwFlags = pMsgMouse->m_dwFlags; |
| 970 evt.m_fx = pMsgMouse->m_fx; | 973 evt.m_fx = pMsgMouse->m_fx; |
| 971 evt.m_fy = pMsgMouse->m_fy; | 974 evt.m_fy = pMsgMouse->m_fy; |
| 972 pWidget->DispatchEvent(&evt); | 975 pWidget->DispatchEvent(&evt); |
| 973 break; | 976 break; |
| 974 } | 977 } |
| 975 case FWL_MSGHASH_MouseWheel: { | 978 case CFWL_MessageType::MouseWheel: { |
| 976 CFWL_MsgMouseWheel* pMsgMouseWheel = | 979 CFWL_MsgMouseWheel* pMsgMouseWheel = |
| 977 static_cast<CFWL_MsgMouseWheel*>(pMessage); | 980 static_cast<CFWL_MsgMouseWheel*>(pMessage); |
| 978 CFWL_EvtMouseWheel evt; | 981 CFWL_EvtMouseWheel evt; |
| 979 evt.m_pSrcTarget = pWidget->m_pInterface; | 982 evt.m_pSrcTarget = pWidget->m_pInterface; |
| 980 evt.m_pDstTarget = pWidget->m_pInterface; | 983 evt.m_pDstTarget = pWidget->m_pInterface; |
| 981 evt.m_dwFlags = pMsgMouseWheel->m_dwFlags; | 984 evt.m_dwFlags = pMsgMouseWheel->m_dwFlags; |
| 982 evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX; | 985 evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX; |
| 983 evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY; | 986 evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY; |
| 984 evt.m_fx = pMsgMouseWheel->m_fx; | 987 evt.m_fx = pMsgMouseWheel->m_fx; |
| 985 evt.m_fy = pMsgMouseWheel->m_fy; | 988 evt.m_fy = pMsgMouseWheel->m_fy; |
| 986 pWidget->DispatchEvent(&evt); | 989 pWidget->DispatchEvent(&evt); |
| 987 break; | 990 break; |
| 988 } | 991 } |
| 989 case FWL_MSGHASH_Key: { | 992 case CFWL_MessageType::Key: { |
| 990 CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage); | 993 CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 991 CFWL_EvtKey evt; | 994 CFWL_EvtKey evt; |
| 992 evt.m_pSrcTarget = pWidget->m_pInterface; | 995 evt.m_pSrcTarget = pWidget->m_pInterface; |
| 993 evt.m_pDstTarget = pWidget->m_pInterface; | 996 evt.m_pDstTarget = pWidget->m_pInterface; |
| 994 evt.m_dwKeyCode = pMsgKey->m_dwKeyCode; | 997 evt.m_dwKeyCode = pMsgKey->m_dwKeyCode; |
| 995 evt.m_dwFlags = pMsgKey->m_dwFlags; | 998 evt.m_dwFlags = pMsgKey->m_dwFlags; |
| 996 evt.m_dwCmd = pMsgKey->m_dwCmd; | 999 evt.m_dwCmd = pMsgKey->m_dwCmd; |
| 997 pWidget->DispatchEvent(&evt); | 1000 pWidget->DispatchEvent(&evt); |
| 998 break; | 1001 break; |
| 999 } | 1002 } |
| 1000 case FWL_MSGHASH_SetFocus: { | 1003 case CFWL_MessageType::SetFocus: { |
| 1001 CFWL_MsgSetFocus* pMsgSetFocus = static_cast<CFWL_MsgSetFocus*>(pMessage); | 1004 CFWL_MsgSetFocus* pMsgSetFocus = static_cast<CFWL_MsgSetFocus*>(pMessage); |
| 1002 CFWL_EvtSetFocus evt; | 1005 CFWL_EvtSetFocus evt; |
| 1003 evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget; | 1006 evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget; |
| 1004 evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget; | 1007 evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget; |
| 1005 evt.m_pSetFocus = pWidget->m_pInterface; | 1008 evt.m_pSetFocus = pWidget->m_pInterface; |
| 1006 pWidget->DispatchEvent(&evt); | 1009 pWidget->DispatchEvent(&evt); |
| 1007 break; | 1010 break; |
| 1008 } | 1011 } |
| 1009 case FWL_MSGHASH_KillFocus: { | 1012 case CFWL_MessageType::KillFocus: { |
| 1010 CFWL_MsgKillFocus* pMsgKillFocus = | 1013 CFWL_MsgKillFocus* pMsgKillFocus = |
| 1011 static_cast<CFWL_MsgKillFocus*>(pMessage); | 1014 static_cast<CFWL_MsgKillFocus*>(pMessage); |
| 1012 CFWL_EvtKillFocus evt; | 1015 CFWL_EvtKillFocus evt; |
| 1013 evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget; | 1016 evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget; |
| 1014 evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget; | 1017 evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget; |
| 1015 evt.m_pKillFocus = pWidget->m_pInterface; | 1018 evt.m_pKillFocus = pWidget->m_pInterface; |
| 1016 pWidget->DispatchEvent(&evt); | 1019 pWidget->DispatchEvent(&evt); |
| 1017 break; | 1020 break; |
| 1018 } | 1021 } |
| 1019 default: {} | 1022 default: |
| 1023 break; |
| 1020 } | 1024 } |
| 1021 return 1; | 1025 return 1; |
| 1022 } | 1026 } |
| 1027 |
| 1023 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1028 FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| 1024 return FWL_ERR_Succeeded; | 1029 return FWL_ERR_Succeeded; |
| 1025 } | 1030 } |
| 1031 |
| 1026 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1032 FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1027 const CFX_Matrix* pMatrix) { | 1033 const CFX_Matrix* pMatrix) { |
| 1028 CFWL_EvtDraw evt; | 1034 CFWL_EvtDraw evt; |
| 1029 evt.m_pGraphics = pGraphics; | 1035 evt.m_pGraphics = pGraphics; |
| 1030 return FWL_ERR_Succeeded; | 1036 return FWL_ERR_Succeeded; |
| 1031 } | 1037 } |
| OLD | NEW |