| 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_editimp.h" | 7 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 switch (iError) { | 1722 switch (iError) { |
| 1723 case -2: { | 1723 case -2: { |
| 1724 CFWL_EvtEdtTextFull textFullEvent; | 1724 CFWL_EvtEdtTextFull textFullEvent; |
| 1725 textFullEvent.m_pSrcTarget = m_pInterface; | 1725 textFullEvent.m_pSrcTarget = m_pInterface; |
| 1726 DispatchEvent(&textFullEvent); | 1726 DispatchEvent(&textFullEvent); |
| 1727 break; | 1727 break; |
| 1728 } | 1728 } |
| 1729 default: {} | 1729 default: {} |
| 1730 } | 1730 } |
| 1731 } | 1731 } |
| 1732 |
| 1732 CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner) | 1733 CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner) |
| 1733 : m_pOwner(pOwner) {} | 1734 : m_pOwner(pOwner) {} |
| 1735 |
| 1734 int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1736 int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 1735 if (!pMessage) | 1737 if (!pMessage) |
| 1736 return 0; | 1738 return 0; |
| 1737 uint32_t dwMsgCode = pMessage->GetClassID(); | 1739 |
| 1740 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| 1738 int32_t iRet = 1; | 1741 int32_t iRet = 1; |
| 1739 switch (dwMsgCode) { | 1742 switch (dwMsgCode) { |
| 1740 case FWL_MSGHASH_Activate: { | 1743 case CFWL_MessageType::Activate: { |
| 1741 DoActivate(static_cast<CFWL_MsgActivate*>(pMessage)); | 1744 DoActivate(static_cast<CFWL_MsgActivate*>(pMessage)); |
| 1742 break; | 1745 break; |
| 1743 } | 1746 } |
| 1744 case FWL_MSGHASH_Deactivate: { | 1747 case CFWL_MessageType::Deactivate: { |
| 1745 DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage)); | 1748 DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage)); |
| 1746 break; | 1749 break; |
| 1747 } | 1750 } |
| 1748 case FWL_MSGHASH_SetFocus: | 1751 case CFWL_MessageType::SetFocus: |
| 1749 case FWL_MSGHASH_KillFocus: { | 1752 case CFWL_MessageType::KillFocus: { |
| 1750 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1753 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
| 1751 break; | 1754 break; |
| 1752 } | 1755 } |
| 1753 case FWL_MSGHASH_Mouse: { | 1756 case CFWL_MessageType::Mouse: { |
| 1754 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1757 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1755 uint32_t dwCmd = pMsg->m_dwCmd; | 1758 uint32_t dwCmd = pMsg->m_dwCmd; |
| 1756 switch (dwCmd) { | 1759 switch (dwCmd) { |
| 1757 case FWL_MSGMOUSECMD_LButtonDown: { | 1760 case FWL_MSGMOUSECMD_LButtonDown: { |
| 1758 OnLButtonDown(pMsg); | 1761 OnLButtonDown(pMsg); |
| 1759 break; | 1762 break; |
| 1760 } | 1763 } |
| 1761 case FWL_MSGMOUSECMD_LButtonUp: { | 1764 case FWL_MSGMOUSECMD_LButtonUp: { |
| 1762 OnLButtonUp(pMsg); | 1765 OnLButtonUp(pMsg); |
| 1763 break; | 1766 break; |
| 1764 } | 1767 } |
| 1765 case FWL_MSGMOUSECMD_LButtonDblClk: { | 1768 case FWL_MSGMOUSECMD_LButtonDblClk: { |
| 1766 OnButtonDblClk(pMsg); | 1769 OnButtonDblClk(pMsg); |
| 1767 break; | 1770 break; |
| 1768 } | 1771 } |
| 1769 case FWL_MSGMOUSECMD_MouseMove: { | 1772 case FWL_MSGMOUSECMD_MouseMove: { |
| 1770 OnMouseMove(pMsg); | 1773 OnMouseMove(pMsg); |
| 1771 break; | 1774 break; |
| 1772 } | 1775 } |
| 1773 case FWL_MSGMOUSECMD_RButtonDown: { | 1776 case FWL_MSGMOUSECMD_RButtonDown: { |
| 1774 DoButtonDown(pMsg); | 1777 DoButtonDown(pMsg); |
| 1775 break; | 1778 break; |
| 1776 } | 1779 } |
| 1777 default: {} | 1780 default: |
| 1781 break; |
| 1778 } | 1782 } |
| 1779 break; | 1783 break; |
| 1780 } | 1784 } |
| 1781 case FWL_MSGHASH_Key: { | 1785 case CFWL_MessageType::Key: { |
| 1782 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 1786 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 1783 uint32_t dwCmd = pKey->m_dwCmd; | 1787 uint32_t dwCmd = pKey->m_dwCmd; |
| 1784 if (dwCmd == FWL_MSGKEYCMD_KeyDown) { | 1788 if (dwCmd == FWL_MSGKEYCMD_KeyDown) |
| 1785 OnKeyDown(pKey); | 1789 OnKeyDown(pKey); |
| 1786 } else if (dwCmd == FWL_MSGKEYCMD_Char) { | 1790 else if (dwCmd == FWL_MSGKEYCMD_Char) |
| 1787 OnChar(pKey); | 1791 OnChar(pKey); |
| 1788 } | |
| 1789 break; | 1792 break; |
| 1790 } | 1793 } |
| 1791 default: { iRet = 0; } | 1794 default: { |
| 1795 iRet = 0; |
| 1796 break; |
| 1797 } |
| 1792 } | 1798 } |
| 1793 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1799 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1794 return iRet; | 1800 return iRet; |
| 1795 } | 1801 } |
| 1802 |
| 1796 FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1803 FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| 1797 if (!pEvent) | 1804 if (!pEvent) |
| 1798 return FWL_ERR_Indefinite; | 1805 return FWL_ERR_Indefinite; |
| 1799 uint32_t dwHashCode = pEvent->GetClassID(); | 1806 if (pEvent->GetClassID() != CFWL_EventType::Scroll) |
| 1800 if (dwHashCode != FWL_EVTHASH_Scroll) { | |
| 1801 return FWL_ERR_Succeeded; | 1807 return FWL_ERR_Succeeded; |
| 1802 } | 1808 |
| 1803 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; | 1809 IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; |
| 1804 if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && | 1810 if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && |
| 1805 m_pOwner->m_pVertScrollBar) || | 1811 m_pOwner->m_pVertScrollBar) || |
| 1806 (pSrcTarget == m_pOwner->m_pHorzScrollBar.get() && | 1812 (pSrcTarget == m_pOwner->m_pHorzScrollBar.get() && |
| 1807 m_pOwner->m_pHorzScrollBar)) { | 1813 m_pOwner->m_pHorzScrollBar)) { |
| 1808 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 1814 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
| 1809 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), | 1815 OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), |
| 1810 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); | 1816 pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); |
| 1811 } | 1817 } |
| 1812 return FWL_ERR_Succeeded; | 1818 return FWL_ERR_Succeeded; |
| 1813 } | 1819 } |
| 1820 |
| 1814 FWL_ERR CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1821 FWL_ERR CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1815 const CFX_Matrix* pMatrix) { | 1822 const CFX_Matrix* pMatrix) { |
| 1816 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1823 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 1817 } | 1824 } |
| 1818 void CFWL_EditImpDelegate::DoActivate(CFWL_MsgActivate* pMsg) { | 1825 void CFWL_EditImpDelegate::DoActivate(CFWL_MsgActivate* pMsg) { |
| 1819 m_pOwner->m_pProperties->m_dwStates |= ~FWL_WGTSTATE_Deactivated; | 1826 m_pOwner->m_pProperties->m_dwStates |= ~FWL_WGTSTATE_Deactivated; |
| 1820 m_pOwner->Repaint(&m_pOwner->m_rtClient); | 1827 m_pOwner->Repaint(&m_pOwner->m_rtClient); |
| 1821 } | 1828 } |
| 1822 void CFWL_EditImpDelegate::DoDeactivate(CFWL_MsgDeactivate* pMsg) { | 1829 void CFWL_EditImpDelegate::DoDeactivate(CFWL_MsgDeactivate* pMsg) { |
| 1823 m_pOwner->m_pProperties->m_dwStates &= FWL_WGTSTATE_Deactivated; | 1830 m_pOwner->m_pProperties->m_dwStates &= FWL_WGTSTATE_Deactivated; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 } | 2173 } |
| 2167 CFX_RectF rect; | 2174 CFX_RectF rect; |
| 2168 m_pOwner->GetWidgetRect(rect); | 2175 m_pOwner->GetWidgetRect(rect); |
| 2169 CFX_RectF rtInvalidate; | 2176 CFX_RectF rtInvalidate; |
| 2170 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2177 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 2171 m_pOwner->Repaint(&rtInvalidate); | 2178 m_pOwner->Repaint(&rtInvalidate); |
| 2172 } | 2179 } |
| 2173 return TRUE; | 2180 return TRUE; |
| 2174 } | 2181 } |
| 2175 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2182 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
| OLD | NEW |