| 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_comboboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_comboboximp.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_editimp.h" | 10 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 11 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | 11 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
| 12 #include "xfa/fwl/basewidget/fwl_listboximp.h" | 12 #include "xfa/fwl/basewidget/fwl_listboximp.h" |
| 13 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" | 13 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" |
| 14 #include "xfa/fwl/core/cfwl_message.h" | 14 #include "xfa/fwl/core/cfwl_message.h" |
| 15 #include "xfa/fwl/core/cfwl_themebackground.h" | 15 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 16 #include "xfa/fwl/core/cfwl_themepart.h" | 16 #include "xfa/fwl/core/cfwl_themepart.h" |
| 17 #include "xfa/fwl/core/cfwl_themetext.h" | 17 #include "xfa/fwl/core/cfwl_themetext.h" |
| 18 #include "xfa/fwl/core/fwl_appimp.h" | 18 #include "xfa/fwl/core/fwl_appimp.h" |
| 19 #include "xfa/fwl/core/fwl_formimp.h" | 19 #include "xfa/fwl/core/fwl_formimp.h" |
| 20 #include "xfa/fwl/core/fwl_noteimp.h" | 20 #include "xfa/fwl/core/fwl_noteimp.h" |
| 21 #include "xfa/fwl/core/fwl_panelimp.h" | 21 #include "xfa/fwl/core/fwl_panelimp.h" |
| 22 #include "xfa/fwl/core/fwl_targetimp.h" | 22 #include "xfa/fwl/core/fwl_targetimp.h" |
| 23 #include "xfa/fwl/core/fwl_threadimp.h" | 23 #include "xfa/fwl/core/fwl_threadimp.h" |
| 24 #include "xfa/fwl/core/fwl_widgetimp.h" | 24 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 25 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 25 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 26 #include "xfa/fwl/core/ifwl_notethread.h" | |
| 27 #include "xfa/fwl/core/ifwl_themeprovider.h" | 26 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 27 #include "xfa/fwl/core/ifwl_thread.h" |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 IFWL_ComboBox* IFWL_ComboBox::Create( | 30 IFWL_ComboBox* IFWL_ComboBox::Create( |
| 31 const CFWL_WidgetImpProperties& properties) { | 31 const CFWL_WidgetImpProperties& properties) { |
| 32 IFWL_ComboBox* pComboBox = new IFWL_ComboBox; | 32 IFWL_ComboBox* pComboBox = new IFWL_ComboBox; |
| 33 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr); | 33 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr); |
| 34 pComboBox->SetImpl(pComboBoxImpl); | 34 pComboBox->SetImpl(pComboBoxImpl); |
| 35 pComboBoxImpl->SetInterface(pComboBox); | 35 pComboBoxImpl->SetInterface(pComboBox); |
| 36 return pComboBox; | 36 return pComboBox; |
| 37 } | 37 } |
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 dwMsgCode == FWL_MSGHASH_SetFocus); | 1766 dwMsgCode == FWL_MSGHASH_SetFocus); |
| 1767 } | 1767 } |
| 1768 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1768 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1769 } | 1769 } |
| 1770 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1770 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1771 const CFX_Matrix* pMatrix) { | 1771 const CFX_Matrix* pMatrix) { |
| 1772 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); | 1772 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); |
| 1773 return FWL_ERR_Succeeded; | 1773 return FWL_ERR_Succeeded; |
| 1774 } | 1774 } |
| 1775 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1775 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 1776 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread(); | 1776 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); |
| 1777 if (!pThread) | 1777 if (!pThread) |
| 1778 return; | 1778 return; |
| 1779 CFWL_NoteDriver* pDriver = | 1779 CFWL_NoteDriver* pDriver = |
| 1780 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 1780 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 1781 CFX_RectF rtWidget; | 1781 CFX_RectF rtWidget; |
| 1782 m_pForm->GetWidgetRect(rtWidget); | 1782 m_pForm->GetWidgetRect(rtWidget); |
| 1783 rtWidget.left = rtWidget.top = 0; | 1783 rtWidget.left = rtWidget.top = 0; |
| 1784 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { | 1784 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 1785 m_bLButtonDown = TRUE; | 1785 m_bLButtonDown = TRUE; |
| 1786 pDriver->SetGrab(m_pForm, TRUE); | 1786 pDriver->SetGrab(m_pForm, TRUE); |
| 1787 } else { | 1787 } else { |
| 1788 m_bLButtonDown = FALSE; | 1788 m_bLButtonDown = FALSE; |
| 1789 pDriver->SetGrab(m_pForm, FALSE); | 1789 pDriver->SetGrab(m_pForm, FALSE); |
| 1790 m_pComboBox->ShowDropList(FALSE); | 1790 m_pComboBox->ShowDropList(FALSE); |
| 1791 } | 1791 } |
| 1792 } | 1792 } |
| 1793 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { | 1793 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { |
| 1794 m_bLButtonDown = FALSE; | 1794 m_bLButtonDown = FALSE; |
| 1795 IFWL_NoteThread* pThread = m_pForm->GetOwnerThread(); | 1795 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); |
| 1796 if (!pThread) | 1796 if (!pThread) |
| 1797 return; | 1797 return; |
| 1798 CFWL_NoteDriver* pDriver = | 1798 CFWL_NoteDriver* pDriver = |
| 1799 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); | 1799 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); |
| 1800 pDriver->SetGrab(m_pForm, FALSE); | 1800 pDriver->SetGrab(m_pForm, FALSE); |
| 1801 if (m_bLButtonUpSelf) { | 1801 if (m_bLButtonUpSelf) { |
| 1802 CFX_RectF rect; | 1802 CFX_RectF rect; |
| 1803 m_pForm->GetWidgetRect(rect); | 1803 m_pForm->GetWidgetRect(rect); |
| 1804 rect.left = rect.top = 0; | 1804 rect.left = rect.top = 0; |
| 1805 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && | 1805 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && |
| 1806 m_pComboBox->IsDropListShowed()) { | 1806 m_pComboBox->IsDropListShowed()) { |
| 1807 m_pComboBox->ShowDropList(FALSE); | 1807 m_pComboBox->ShowDropList(FALSE); |
| 1808 } | 1808 } |
| 1809 } else { | 1809 } else { |
| 1810 m_bLButtonUpSelf = TRUE; | 1810 m_bLButtonUpSelf = TRUE; |
| 1811 } | 1811 } |
| 1812 } | 1812 } |
| 1813 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {} | 1813 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {} |
| 1814 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { | 1814 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { |
| 1815 m_pComboBox->ShowDropList(FALSE); | 1815 m_pComboBox->ShowDropList(FALSE); |
| 1816 } | 1816 } |
| 1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
| 1818 FX_BOOL bSet) { | 1818 FX_BOOL bSet) { |
| 1819 if (!bSet) { | 1819 if (!bSet) { |
| 1820 if (pMsg->m_pSetFocus == NULL) { | 1820 if (pMsg->m_pSetFocus == NULL) { |
| 1821 m_pComboBox->ShowDropList(FALSE); | 1821 m_pComboBox->ShowDropList(FALSE); |
| 1822 } | 1822 } |
| 1823 } | 1823 } |
| 1824 } | 1824 } |
| OLD | NEW |