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

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

Powered by Google App Engine
This is Rietveld 408576698