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