Chromium Code Reviews| 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/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
| 8 #include "xfa/src/fwl/src/core/include/fwl_threadimp.h" | 8 #include "xfa/src/fwl/src/core/include/fwl_threadimp.h" |
| 9 #include "xfa/src/fwl/src/core/include/fwl_appimp.h" | 9 #include "xfa/src/fwl/src/core/include/fwl_appimp.h" |
| 10 #include "xfa/src/fwl/src/core/include/fwl_targetimp.h" | 10 #include "xfa/src/fwl/src/core/include/fwl_targetimp.h" |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1779 CFX_RectF rtWidget; | 1779 CFX_RectF rtWidget; |
| 1780 m_pForm->GetWidgetRect(rtWidget); | 1780 m_pForm->GetWidgetRect(rtWidget); |
| 1781 rtWidget.left = rtWidget.top = 0; | 1781 rtWidget.left = rtWidget.top = 0; |
| 1782 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1782 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 1783 m_bLButtonDown = TRUE; | 1783 m_bLButtonDown = TRUE; |
| 1784 pDriver->SetGrab(m_pForm, TRUE); | 1784 pDriver->SetGrab(m_pForm, TRUE); |
| 1785 } else { | 1785 } else { |
| 1786 m_bLButtonDown = FALSE; | 1786 m_bLButtonDown = FALSE; |
| 1787 pDriver->SetGrab(m_pForm, FALSE); | 1787 pDriver->SetGrab(m_pForm, FALSE); |
| 1788 m_pComboBox->ShowDropList(FALSE); | 1788 m_pComboBox->ShowDropList(FALSE); |
| 1789 return; | |
| 1790 } | 1789 } |
| 1791 IFWL_AdapterNative* pNative = FWL_GetAdapterNative(); | |
| 1792 IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr(); | |
| 1793 FWL_HCURSOR hCursor = pCursorMgr->GetSystemCursor(FWL_CURSORTYPE_SizeNS); | |
|
Tom Sepez
2016/02/09 00:20:32
segv.
| |
| 1794 pCursorMgr->SetCursor(hCursor); | |
| 1795 pCursorMgr->ShowCursor(TRUE); | |
| 1796 m_pForm->TransformTo(NULL, pMsg->m_fx, pMsg->m_fy); | |
| 1797 m_fStartPos = pMsg->m_fy; | |
| 1798 } | 1790 } |
| 1799 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 1791 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
| 1800 m_bLButtonDown = FALSE; | 1792 m_bLButtonDown = FALSE; |
| 1801 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread(); | 1793 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread(); |
| 1802 if (!pThread) | 1794 if (!pThread) |
| 1803 return; | 1795 return; |
| 1804 CFWL_NoteDriver* pDriver = | 1796 CFWL_NoteDriver* pDriver = |
| 1805 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 1797 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 1806 pDriver->SetGrab(m_pForm, FALSE); | 1798 pDriver->SetGrab(m_pForm, FALSE); |
| 1807 if (m_bLButtonUpSelf) { | 1799 if (m_bLButtonUpSelf) { |
| 1808 CFX_RectF rect; | 1800 CFX_RectF rect; |
| 1809 m_pForm->GetWidgetRect(rect); | 1801 m_pForm->GetWidgetRect(rect); |
| 1810 rect.left = rect.top = 0; | 1802 rect.left = rect.top = 0; |
| 1811 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && | 1803 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && |
| 1812 m_pComboBox->IsDropListShowed()) { | 1804 m_pComboBox->IsDropListShowed()) { |
| 1813 m_pComboBox->ShowDropList(FALSE); | 1805 m_pComboBox->ShowDropList(FALSE); |
| 1814 } | 1806 } |
| 1815 } else { | 1807 } else { |
| 1816 m_bLButtonUpSelf = TRUE; | 1808 m_bLButtonUpSelf = TRUE; |
| 1817 } | 1809 } |
| 1818 } | 1810 } |
| 1819 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { | 1811 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { |
| 1820 IFWL_AdapterNative* pNative = FWL_GetAdapterNative(); | |
| 1821 IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr(); | |
| 1822 FWL_CURSORTYPE cursorType = FWL_CURSORTYPE_Arrow; | |
| 1823 if (m_pComboBox->m_rtHandler.Contains(pMsg->m_fx, pMsg->m_fy)) { | |
| 1824 cursorType = FWL_CURSORTYPE_SizeNS; | |
| 1825 } | |
| 1826 FWL_HCURSOR hCursor = pCursorMgr->GetSystemCursor(cursorType); | |
|
Tom Sepez
2016/02/09 00:20:32
segv.
| |
| 1827 pCursorMgr->SetCursor(hCursor); | |
| 1828 pCursorMgr->ShowCursor(TRUE); | |
| 1829 if (!m_bLButtonDown) { | |
| 1830 return; | |
| 1831 } | |
| 1832 m_pForm->TransformTo(NULL, pMsg->m_fx, pMsg->m_fy); | |
| 1833 FX_FLOAT fChanged = pMsg->m_fy - m_fStartPos; | |
| 1834 if (m_pComboBox->m_bUpFormHandler) { | |
| 1835 fChanged = m_fStartPos - pMsg->m_fy; | |
| 1836 } | |
| 1837 if (m_pComboBox->m_rtList.height + fChanged < m_pComboBox->m_fItemHeight) { | |
| 1838 return; | |
| 1839 } | |
| 1840 m_pComboBox->m_rtList.height += fChanged; | |
| 1841 m_pComboBox->m_rtProxy.height += fChanged; | |
| 1842 if (m_pComboBox->m_bUpFormHandler) { | |
| 1843 m_pComboBox->m_rtProxy.top -= fChanged; | |
| 1844 m_pComboBox->m_rtHandler.Set(0, 0, m_pComboBox->m_rtList.width, | |
| 1845 m_pComboBox->m_fComboFormHandler); | |
| 1846 } else { | |
| 1847 m_pComboBox->m_rtHandler.Set(0, m_pComboBox->m_rtList.height, | |
| 1848 m_pComboBox->m_rtList.width, | |
| 1849 m_pComboBox->m_fComboFormHandler); | |
| 1850 } | |
| 1851 m_pForm->SetWidgetRect(m_pComboBox->m_rtProxy); | |
| 1852 m_pComboBox->m_pListBox->SetWidgetRect(m_pComboBox->m_rtList); | |
| 1853 m_pComboBox->m_pListBox->Update(); | |
| 1854 m_fStartPos = pMsg->m_fy; | |
| 1855 } | 1812 } |
| 1856 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { | 1813 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { |
| 1857 m_pComboBox->ShowDropList(FALSE); | 1814 m_pComboBox->ShowDropList(FALSE); |
| 1858 } | 1815 } |
| 1859 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1816 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
| 1860 FX_BOOL bSet) { | 1817 FX_BOOL bSet) { |
| 1861 if (!bSet) { | 1818 if (!bSet) { |
| 1862 if (pMsg->m_pSetFocus == NULL) { | 1819 if (pMsg->m_pSetFocus == NULL) { |
| 1863 m_pComboBox->ShowDropList(FALSE); | 1820 m_pComboBox->ShowDropList(FALSE); |
| 1864 } | 1821 } |
| 1865 } | 1822 } |
| 1866 } | 1823 } |
| OLD | NEW |