| 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/ifwl_edit.h" | 7 #include "xfa/fwl/core/ifwl_edit.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 break; | 1341 break; |
| 1342 } | 1342 } |
| 1343 } | 1343 } |
| 1344 | 1344 |
| 1345 void IFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { | 1345 void IFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) { |
| 1346 if (!pMessage) | 1346 if (!pMessage) |
| 1347 return; | 1347 return; |
| 1348 | 1348 |
| 1349 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); | 1349 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| 1350 switch (dwMsgCode) { | 1350 switch (dwMsgCode) { |
| 1351 case CFWL_MessageType::Activate: | |
| 1352 DoActivate(static_cast<CFWL_MsgActivate*>(pMessage)); | |
| 1353 break; | |
| 1354 case CFWL_MessageType::Deactivate: | |
| 1355 DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage)); | |
| 1356 break; | |
| 1357 case CFWL_MessageType::SetFocus: | 1351 case CFWL_MessageType::SetFocus: |
| 1358 case CFWL_MessageType::KillFocus: | 1352 case CFWL_MessageType::KillFocus: |
| 1359 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); | 1353 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
| 1360 break; | 1354 break; |
| 1361 case CFWL_MessageType::Mouse: { | 1355 case CFWL_MessageType::Mouse: { |
| 1362 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1356 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1363 switch (pMsg->m_dwCmd) { | 1357 switch (pMsg->m_dwCmd) { |
| 1364 case FWL_MouseCommand::LeftButtonDown: | 1358 case FWL_MouseCommand::LeftButtonDown: |
| 1365 OnLButtonDown(pMsg); | 1359 OnLButtonDown(pMsg); |
| 1366 break; | 1360 break; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), | 1402 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), |
| 1409 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); | 1403 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); |
| 1410 } | 1404 } |
| 1411 } | 1405 } |
| 1412 | 1406 |
| 1413 void IFWL_Edit::OnDrawWidget(CFX_Graphics* pGraphics, | 1407 void IFWL_Edit::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1414 const CFX_Matrix* pMatrix) { | 1408 const CFX_Matrix* pMatrix) { |
| 1415 DrawWidget(pGraphics, pMatrix); | 1409 DrawWidget(pGraphics, pMatrix); |
| 1416 } | 1410 } |
| 1417 | 1411 |
| 1418 void IFWL_Edit::DoActivate(CFWL_MsgActivate* pMsg) { | |
| 1419 m_pProperties->m_dwStates |= ~FWL_WGTSTATE_Deactivated; | |
| 1420 Repaint(&m_rtClient); | |
| 1421 } | |
| 1422 | |
| 1423 void IFWL_Edit::DoDeactivate(CFWL_MsgDeactivate* pMsg) { | |
| 1424 m_pProperties->m_dwStates &= FWL_WGTSTATE_Deactivated; | |
| 1425 Repaint(&m_rtClient); | |
| 1426 } | |
| 1427 | |
| 1428 void IFWL_Edit::DoButtonDown(CFWL_MsgMouse* pMsg) { | 1412 void IFWL_Edit::DoButtonDown(CFWL_MsgMouse* pMsg) { |
| 1429 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) | 1413 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) |
| 1430 SetFocus(true); | 1414 SetFocus(true); |
| 1431 | 1415 |
| 1432 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); | 1416 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); |
| 1433 if (!pPage) | 1417 if (!pPage) |
| 1434 return; | 1418 return; |
| 1435 CFX_PointF pt(pMsg->m_fx, pMsg->m_fy); | 1419 CFX_PointF pt(pMsg->m_fx, pMsg->m_fy); |
| 1436 DeviceToEngine(pt); | 1420 DeviceToEngine(pt); |
| 1437 bool bBefore = true; | 1421 bool bBefore = true; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 UpdateCaret(); | 1704 UpdateCaret(); |
| 1721 | 1705 |
| 1722 CFX_RectF rect; | 1706 CFX_RectF rect; |
| 1723 GetWidgetRect(rect); | 1707 GetWidgetRect(rect); |
| 1724 CFX_RectF rtInvalidate; | 1708 CFX_RectF rtInvalidate; |
| 1725 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 1709 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 1726 Repaint(&rtInvalidate); | 1710 Repaint(&rtInvalidate); |
| 1727 } | 1711 } |
| 1728 return true; | 1712 return true; |
| 1729 } | 1713 } |
| OLD | NEW |