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_listboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_listboximp.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_comboboximp.h" | 10 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 int32_t iCount = CountSelItems(); | 975 int32_t iCount = CountSelItems(); |
976 for (int32_t i = 0; i < iCount; i++) { | 976 for (int32_t i = 0; i < iCount; i++) { |
977 FWL_HLISTITEM item = GetSelItem(i); | 977 FWL_HLISTITEM item = GetSelItem(i); |
978 if (item == NULL) { | 978 if (item == NULL) { |
979 continue; | 979 continue; |
980 } | 980 } |
981 selEvent.iarraySels.Add(i); | 981 selEvent.iarraySels.Add(i); |
982 } | 982 } |
983 DispatchEvent(&selEvent); | 983 DispatchEvent(&selEvent); |
984 } | 984 } |
985 | |
985 CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) | 986 CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) |
986 : m_pOwner(pOwner) {} | 987 : m_pOwner(pOwner) {} |
988 | |
987 int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 989 int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
988 if (!pMessage) | 990 if (!pMessage) |
989 return 0; | 991 return 0; |
990 if (!m_pOwner->IsEnabled()) { | 992 if (!m_pOwner->IsEnabled()) |
991 return 1; | 993 return 1; |
992 } | 994 |
993 uint32_t dwMsgCode = pMessage->GetClassID(); | 995 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
994 int32_t iRet = 1; | 996 int32_t iRet = 1; |
995 switch (dwMsgCode) { | 997 switch (dwMsgCode) { |
996 case FWL_MSGHASH_SetFocus: | 998 case CFWL_MessageType::SetFocus: |
Tom Sepez
2016/04/21 19:22:33
missed one.
dsinclair
2016/04/21 19:35:49
Done.
| |
997 case FWL_MSGHASH_KillFocus: { | 999 case CFWL_MessageType::KillFocus: { |
998 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1000 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
999 break; | 1001 break; |
1000 } | 1002 } |
1001 case FWL_MSGHASH_Mouse: { | 1003 case CFWL_MessageType::Mouse: { |
1002 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1004 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1003 uint32_t dwCmd = pMsg->m_dwCmd; | 1005 uint32_t dwCmd = pMsg->m_dwCmd; |
1004 switch (dwCmd) { | 1006 switch (dwCmd) { |
1005 case FWL_MSGMOUSECMD_LButtonDown: { | 1007 case FWL_MSGMOUSECMD_LButtonDown: { |
1006 OnLButtonDown(pMsg); | 1008 OnLButtonDown(pMsg); |
1007 break; | 1009 break; |
1008 } | 1010 } |
1009 case FWL_MSGMOUSECMD_LButtonUp: { | 1011 case FWL_MSGMOUSECMD_LButtonUp: { |
1010 OnLButtonUp(pMsg); | 1012 OnLButtonUp(pMsg); |
1011 break; | 1013 break; |
1012 } | 1014 } |
1013 default: {} | 1015 default: |
1016 break; | |
1014 } | 1017 } |
1015 break; | 1018 break; |
1016 } | 1019 } |
1017 case FWL_MSGHASH_MouseWheel: { | 1020 case CFWL_MessageType::MouseWheel: { |
1018 OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); | 1021 OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage)); |
1019 break; | 1022 break; |
1020 } | 1023 } |
1021 case FWL_MSGHASH_Key: { | 1024 case CFWL_MessageType::Key: { |
1022 CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); | 1025 CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage); |
1023 if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown) | 1026 if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
1024 OnKeyDown(pMsg); | 1027 OnKeyDown(pMsg); |
1025 break; | 1028 break; |
1026 } | 1029 } |
1027 default: { iRet = 0; } | 1030 default: { |
1031 iRet = 0; | |
1032 break; | |
1033 } | |
1028 } | 1034 } |
1029 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1035 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1030 return iRet; | 1036 return iRet; |
1031 } | 1037 } |
1038 | |
1032 FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1039 FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
1033 if (!pEvent) | 1040 if (!pEvent) |
1034 return FWL_ERR_Indefinite; | 1041 return FWL_ERR_Indefinite; |
1035 if (pEvent->GetClassID() != FWL_EVTHASH_Scroll) { | 1042 if (pEvent->GetClassID() != CFWL_EventType::Scroll) |
1036 return FWL_ERR_Succeeded; | 1043 return FWL_ERR_Succeeded; |
1037 } | 1044 |
1038 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; | 1045 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; |
1039 if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && | 1046 if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && |
1040 m_pOwner->m_pVertScrollBar) || | 1047 m_pOwner->m_pVertScrollBar) || |
1041 (pSrcTarget == m_pOwner->m_pHorzScrollBar.get() && | 1048 (pSrcTarget == m_pOwner->m_pHorzScrollBar.get() && |
1042 m_pOwner->m_pHorzScrollBar)) { | 1049 m_pOwner->m_pHorzScrollBar)) { |
1043 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 1050 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
1044 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), | 1051 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), |
1045 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); | 1052 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); |
1046 } | 1053 } |
1047 return FWL_ERR_Succeeded; | 1054 return FWL_ERR_Succeeded; |
1048 } | 1055 } |
1056 | |
1049 FWL_ERR CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1057 FWL_ERR CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1050 const CFX_Matrix* pMatrix) { | 1058 const CFX_Matrix* pMatrix) { |
1051 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1059 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
1052 } | 1060 } |
1053 void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { | 1061 void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { |
1054 if (m_pOwner->GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { | 1062 if (m_pOwner->GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { |
1055 if (m_pOwner->m_pVertScrollBar) { | 1063 if (m_pOwner->m_pVertScrollBar) { |
1056 m_pOwner->m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); | 1064 m_pOwner->m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); |
1057 } | 1065 } |
1058 if (m_pOwner->m_pHorzScrollBar) { | 1066 if (m_pOwner->m_pHorzScrollBar) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1236 pScrollBar->SetTrackPos(fPos); | 1244 pScrollBar->SetTrackPos(fPos); |
1237 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1245 m_pOwner->Repaint(&m_pOwner->m_rtClient); |
1238 } | 1246 } |
1239 return TRUE; | 1247 return TRUE; |
1240 } | 1248 } |
1241 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { | 1249 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { |
1242 CFWL_EvtLtbSelChanged ev; | 1250 CFWL_EvtLtbSelChanged ev; |
1243 ev.m_pSrcTarget = m_pOwner->m_pInterface; | 1251 ev.m_pSrcTarget = m_pOwner->m_pInterface; |
1244 m_pOwner->DispatchEvent(&ev); | 1252 m_pOwner->DispatchEvent(&ev); |
1245 } | 1253 } |
OLD | NEW |