Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: xfa/fwl/core/fwl_formimp.cpp

Issue 1901183002: Remove CFWL_Note. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_formimp.h" 7 #include "xfa/fwl/core/fwl_formimp.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } else { 848 } else {
849 if (fTemp < fLimitMin && fHeight > fLimitMin) { 849 if (fTemp < fLimitMin && fHeight > fLimitMin) {
850 fTop += bTop ? (fHeight - fLimitMin) : 0; 850 fTop += bTop ? (fHeight - fLimitMin) : 0;
851 fHeight = fLimitMin; 851 fHeight = fLimitMin;
852 } else if (fTemp > fLimitMax && fHeight < fLimitMax) { 852 } else if (fTemp > fLimitMax && fHeight < fLimitMax) {
853 fTop -= bTop ? (fLimitMax - fHeight) : 0; 853 fTop -= bTop ? (fLimitMax - fHeight) : 0;
854 fHeight = fLimitMax; 854 fHeight = fLimitMax;
855 } 855 }
856 } 856 }
857 } 857 }
858
858 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) 859 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner)
859 : m_pOwner(pOwner) {} 860 : m_pOwner(pOwner) {}
861
860 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 862 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
861 #ifdef FWL_UseMacSystemBorder
862 if (!pMessage) 863 if (!pMessage)
863 return 0; 864 return 0;
864 uint32_t dwMsgCode = pMessage->GetClassID(); 865
866 CFWL_MessageType dwMsgCode = pMessage->GetClassID();
867
868 #ifdef FWL_UseMacSystemBorder
869
865 switch (dwMsgCode) { 870 switch (dwMsgCode) {
866 case FWL_MSGHASH_Activate: { 871 case CFWL_MessageType::Activate: {
867 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; 872 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
868 m_pOwner->Repaint(&m_pOwner->m_rtRelative); 873 m_pOwner->Repaint(&m_pOwner->m_rtRelative);
869 break; 874 break;
870 } 875 }
871 case FWL_MSGHASH_Deactivate: { 876 case CFWL_MessageType::Deactivate: {
872 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; 877 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated;
873 m_pOwner->Repaint(&m_pOwner->m_rtRelative); 878 m_pOwner->Repaint(&m_pOwner->m_rtRelative);
874 break; 879 break;
875 } 880 }
876 } 881 }
877 return FWL_ERR_Succeeded; 882 return FWL_ERR_Succeeded;
878 #else 883 #else
879 if (!pMessage)
880 return 0;
881 uint32_t dwMsgCode = pMessage->GetClassID();
882 int32_t iRet = 1; 884 int32_t iRet = 1;
883 switch (dwMsgCode) { 885 switch (dwMsgCode) {
884 case FWL_MSGHASH_Activate: { 886 case CFWL_MessageType::Activate: {
885 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; 887 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
886 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); 888 IFWL_Thread* pThread = m_pOwner->GetOwnerThread();
887 CFWL_NoteDriver* pDriver = 889 CFWL_NoteDriver* pDriver =
888 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 890 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
889 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); 891 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
890 IFWL_Widget* pSubFocus = 892 IFWL_Widget* pSubFocus =
891 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; 893 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
892 if (pSubFocus && pSubFocus != pDriver->GetFocus()) { 894 if (pSubFocus && pSubFocus != pDriver->GetFocus())
893 pDriver->SetFocus(pSubFocus); 895 pDriver->SetFocus(pSubFocus);
894 } 896
895 m_pOwner->Repaint(&m_pOwner->m_rtRelative); 897 m_pOwner->Repaint(&m_pOwner->m_rtRelative);
896 break; 898 break;
897 } 899 }
898 case FWL_MSGHASH_Deactivate: { 900 case CFWL_MessageType::Deactivate: {
899 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; 901 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated;
900 IFWL_Thread* pThread = m_pOwner->GetOwnerThread(); 902 IFWL_Thread* pThread = m_pOwner->GetOwnerThread();
901 CFWL_NoteDriver* pDriver = 903 CFWL_NoteDriver* pDriver =
902 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 904 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
903 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); 905 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
904 IFWL_Widget* pSubFocus = 906 IFWL_Widget* pSubFocus =
905 pSubFocusImp ? pSubFocusImp->GetInterface() : NULL; 907 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
906 if (pSubFocus) { 908 if (pSubFocus) {
907 if (pSubFocus == pDriver->GetFocus()) { 909 if (pSubFocus == pDriver->GetFocus()) {
908 pDriver->SetFocus(NULL); 910 pDriver->SetFocus(nullptr);
909 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { 911 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) {
910 CFWL_MsgKillFocus ms; 912 CFWL_MsgKillFocus ms;
911 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(NULL); 913 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr);
912 if (pDelegate) { 914 if (pDelegate)
913 pDelegate->OnProcessMessage(&ms); 915 pDelegate->OnProcessMessage(&ms);
914 }
915 } 916 }
916 } 917 }
917 m_pOwner->Repaint(&m_pOwner->m_rtRelative); 918 m_pOwner->Repaint(&m_pOwner->m_rtRelative);
918 break; 919 break;
919 } 920 }
920 case FWL_MSGHASH_Mouse: { 921 case CFWL_MessageType::Mouse: {
921 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 922 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
922 switch (pMsg->m_dwCmd) { 923 switch (pMsg->m_dwCmd) {
923 case FWL_MSGMOUSECMD_LButtonDown: { 924 case FWL_MSGMOUSECMD_LButtonDown: {
924 OnLButtonDown(pMsg); 925 OnLButtonDown(pMsg);
925 break; 926 break;
926 } 927 }
927 case FWL_MSGMOUSECMD_LButtonUp: { 928 case FWL_MSGMOUSECMD_LButtonUp: {
928 OnLButtonUp(pMsg); 929 OnLButtonUp(pMsg);
929 break; 930 break;
930 } 931 }
931 case FWL_MSGMOUSECMD_MouseMove: { 932 case FWL_MSGMOUSECMD_MouseMove: {
932 OnMouseMove(pMsg); 933 OnMouseMove(pMsg);
933 break; 934 break;
934 } 935 }
935 case FWL_MSGMOUSECMD_MouseHover: { 936 case FWL_MSGMOUSECMD_MouseHover: {
936 OnMouseHover(pMsg); 937 OnMouseHover(pMsg);
937 break; 938 break;
938 } 939 }
939 case FWL_MSGMOUSECMD_MouseLeave: { 940 case FWL_MSGMOUSECMD_MouseLeave: {
940 OnMouseLeave(pMsg); 941 OnMouseLeave(pMsg);
941 break; 942 break;
942 } 943 }
943 case FWL_MSGMOUSECMD_LButtonDblClk: { 944 case FWL_MSGMOUSECMD_LButtonDblClk: {
944 OnLButtonDblClk(pMsg); 945 OnLButtonDblClk(pMsg);
945 break; 946 break;
946 } 947 }
947 } 948 }
948 break; 949 break;
949 } 950 }
950 case FWL_MSGHASH_Size: { 951 case CFWL_MessageType::Size: {
951 CFWL_WidgetMgr* pWidgetMgr = 952 CFWL_WidgetMgr* pWidgetMgr =
952 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); 953 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
953 if (!pWidgetMgr) 954 if (!pWidgetMgr)
954 return 0; 955 return 0;
956
955 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); 957 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface);
956 if (!m_pOwner->m_bSetMaximize) { 958 if (!m_pOwner->m_bSetMaximize)
957 break; 959 break;
958 } 960
959 m_pOwner->m_bSetMaximize = FALSE; 961 m_pOwner->m_bSetMaximize = FALSE;
960 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); 962 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage);
961 CFX_RectF rt; 963 CFX_RectF rt;
962 pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt); 964 pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt);
963 m_pOwner->m_pProperties->m_rtWidget.left = rt.left; 965 m_pOwner->m_pProperties->m_rtWidget.left = rt.left;
964 m_pOwner->m_pProperties->m_rtWidget.top = rt.top; 966 m_pOwner->m_pProperties->m_rtWidget.top = rt.top;
965 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; 967 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth;
966 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; 968 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight;
967 m_pOwner->Update(); 969 m_pOwner->Update();
968 break; 970 break;
969 } 971 }
970 case FWL_MSGHASH_WindowMove: { 972 case CFWL_MessageType::WindowMove: {
971 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); 973 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage));
972 break; 974 break;
973 } 975 }
974 case FWL_MSGHASH_Close: { 976 case CFWL_MessageType::Close: {
975 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); 977 OnClose(static_cast<CFWL_MsgClose*>(pMessage));
976 break; 978 break;
977 } 979 }
978 default: { iRet = 0; } 980 default: {
981 iRet = 0;
982 break;
983 }
979 } 984 }
980 return iRet; 985 return iRet;
981 #endif 986 #endif // FWL_UseMacSystemBorder
982 } 987 }
988
983 FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { 989 FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
984 if (!pEvent) 990 if (!pEvent)
985 return FWL_ERR_Indefinite; 991 return FWL_ERR_Indefinite;
986 if (pEvent->GetClassID() == FWL_EVTHASH_Close &&
987 pEvent->m_pSrcTarget == m_pOwner->m_pInterface) {
988 }
989 return FWL_ERR_Succeeded; 992 return FWL_ERR_Succeeded;
990 } 993 }
994
991 FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 995 FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
992 const CFX_Matrix* pMatrix) { 996 const CFX_Matrix* pMatrix) {
993 return m_pOwner->DrawWidget(pGraphics, pMatrix); 997 return m_pOwner->DrawWidget(pGraphics, pMatrix);
994 } 998 }
995 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { 999 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
996 m_pOwner->SetGrab(TRUE); 1000 m_pOwner->SetGrab(TRUE);
997 m_pOwner->m_bLButtonDown = TRUE; 1001 m_pOwner->m_bLButtonDown = TRUE;
998 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; 1002 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None;
999 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); 1003 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy);
1000 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); 1004 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1149 }
1146 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { 1150 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) {
1147 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; 1151 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx;
1148 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; 1152 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy;
1149 } 1153 }
1150 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { 1154 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) {
1151 CFWL_EvtClose eClose; 1155 CFWL_EvtClose eClose;
1152 eClose.m_pSrcTarget = m_pOwner->m_pInterface; 1156 eClose.m_pSrcTarget = m_pOwner->m_pInterface;
1153 m_pOwner->DispatchEvent(&eClose); 1157 m_pOwner->DispatchEvent(&eClose);
1154 } 1158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698