Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: xfa/fwl/basewidget/fwl_comboboximp.cpp

Issue 1921853006: More FWL interface cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_targetimp.h"
22 #include "xfa/fwl/core/fwl_threadimp.h"
23 #include "xfa/fwl/core/fwl_widgetimp.h" 21 #include "xfa/fwl/core/fwl_widgetimp.h"
24 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 22 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
23 #include "xfa/fwl/core/ifwl_app.h"
25 #include "xfa/fwl/core/ifwl_themeprovider.h" 24 #include "xfa/fwl/core/ifwl_themeprovider.h"
26 #include "xfa/fwl/core/ifwl_thread.h"
27 25
28 // static 26 // static
29 IFWL_ComboBox* IFWL_ComboBox::Create( 27 IFWL_ComboBox* IFWL_ComboBox::Create(
30 const CFWL_WidgetImpProperties& properties) { 28 const CFWL_WidgetImpProperties& properties) {
31 IFWL_ComboBox* pComboBox = new IFWL_ComboBox; 29 IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
32 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr); 30 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
33 pComboBox->SetImpl(pComboBoxImpl); 31 pComboBox->SetImpl(pComboBoxImpl);
34 pComboBoxImpl->SetInterface(pComboBox); 32 pComboBoxImpl->SetInterface(pComboBox);
35 return pComboBox; 33 return pComboBox;
36 } 34 }
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 } 1448 }
1451 return FWL_ERR_Succeeded; 1449 return FWL_ERR_Succeeded;
1452 } 1450 }
1453 1451
1454 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1452 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1455 const CFX_Matrix* pMatrix) { 1453 const CFX_Matrix* pMatrix) {
1456 return m_pOwner->DrawWidget(pGraphics, pMatrix); 1454 return m_pOwner->DrawWidget(pGraphics, pMatrix);
1457 } 1455 }
1458 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, 1456 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
1459 FX_BOOL bSet) { 1457 FX_BOOL bSet) {
1460 IFWL_Target* pDstTarget = pMsg->m_pDstTarget; 1458 IFWL_Widget* pDstTarget = pMsg->m_pDstTarget;
1461 IFWL_Target* pSrcTarget = pMsg->m_pSrcTarget; 1459 IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget;
1462 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); 1460 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
1463 if (bSet) { 1461 if (bSet) {
1464 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 1462 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
1465 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) { 1463 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) {
1466 if (!m_pOwner->m_pEdit) 1464 if (!m_pOwner->m_pEdit)
1467 return; 1465 return;
1468 static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl()) 1466 static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
1469 ->SetSelected(); 1467 ->SetSelected();
1470 } else { 1468 } else {
1471 m_pOwner->Repaint(&m_pOwner->m_rtClient); 1469 m_pOwner->Repaint(&m_pOwner->m_rtClient);
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 } 1794 }
1797 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1795 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1798 } 1796 }
1799 1797
1800 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1798 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1801 const CFX_Matrix* pMatrix) { 1799 const CFX_Matrix* pMatrix) {
1802 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); 1800 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix);
1803 return FWL_ERR_Succeeded; 1801 return FWL_ERR_Succeeded;
1804 } 1802 }
1805 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { 1803 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
1806 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); 1804 IFWL_App* pThread = m_pForm->GetOwnerThread();
1807 if (!pThread) 1805 if (!pThread)
1808 return; 1806 return;
1809 CFWL_NoteDriver* pDriver = 1807 CFWL_NoteDriver* pDriver =
1810 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 1808 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
1811 CFX_RectF rtWidget; 1809 CFX_RectF rtWidget;
1812 m_pForm->GetWidgetRect(rtWidget); 1810 m_pForm->GetWidgetRect(rtWidget);
1813 rtWidget.left = rtWidget.top = 0; 1811 rtWidget.left = rtWidget.top = 0;
1814 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { 1812 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) {
1815 m_bLButtonDown = TRUE; 1813 m_bLButtonDown = TRUE;
1816 pDriver->SetGrab(m_pForm, TRUE); 1814 pDriver->SetGrab(m_pForm, TRUE);
1817 } else { 1815 } else {
1818 m_bLButtonDown = FALSE; 1816 m_bLButtonDown = FALSE;
1819 pDriver->SetGrab(m_pForm, FALSE); 1817 pDriver->SetGrab(m_pForm, FALSE);
1820 m_pComboBox->ShowDropList(FALSE); 1818 m_pComboBox->ShowDropList(FALSE);
1821 } 1819 }
1822 } 1820 }
1823 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { 1821 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
1824 m_bLButtonDown = FALSE; 1822 m_bLButtonDown = FALSE;
1825 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); 1823 IFWL_App* pThread = m_pForm->GetOwnerThread();
1826 if (!pThread) 1824 if (!pThread)
1827 return; 1825 return;
1828 CFWL_NoteDriver* pDriver = 1826 CFWL_NoteDriver* pDriver =
1829 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 1827 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
1830 pDriver->SetGrab(m_pForm, FALSE); 1828 pDriver->SetGrab(m_pForm, FALSE);
1831 if (m_bLButtonUpSelf) { 1829 if (m_bLButtonUpSelf) {
1832 CFX_RectF rect; 1830 CFX_RectF rect;
1833 m_pForm->GetWidgetRect(rect); 1831 m_pForm->GetWidgetRect(rect);
1834 rect.left = rect.top = 0; 1832 rect.left = rect.top = 0;
1835 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && 1833 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
1836 m_pComboBox->IsDropListShowed()) { 1834 m_pComboBox->IsDropListShowed()) {
1837 m_pComboBox->ShowDropList(FALSE); 1835 m_pComboBox->ShowDropList(FALSE);
1838 } 1836 }
1839 } else { 1837 } else {
1840 m_bLButtonUpSelf = TRUE; 1838 m_bLButtonUpSelf = TRUE;
1841 } 1839 }
1842 } 1840 }
1843 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {} 1841 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {}
1844 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { 1842 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) {
1845 m_pComboBox->ShowDropList(FALSE); 1843 m_pComboBox->ShowDropList(FALSE);
1846 } 1844 }
1847 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1848 FX_BOOL bSet) { 1846 FX_BOOL bSet) {
1849 if (!bSet) { 1847 if (!bSet) {
1850 if (pMsg->m_pSetFocus == NULL) { 1848 if (pMsg->m_pSetFocus == NULL) {
1851 m_pComboBox->ShowDropList(FALSE); 1849 m_pComboBox->ShowDropList(FALSE);
1852 } 1850 }
1853 } 1851 }
1854 } 1852 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698