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

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
« no previous file with comments | « xfa/fwl/basewidget/fwl_checkboximp.cpp ('k') | xfa/fwl/basewidget/fwl_datetimepickerimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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* pApp = m_pForm->GetOwnerApp();
1807 if (!pThread) 1805 if (!pApp)
1808 return; 1806 return;
1807
1809 CFWL_NoteDriver* pDriver = 1808 CFWL_NoteDriver* pDriver =
1810 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 1809 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
1811 CFX_RectF rtWidget; 1810 CFX_RectF rtWidget;
1812 m_pForm->GetWidgetRect(rtWidget); 1811 m_pForm->GetWidgetRect(rtWidget);
1813 rtWidget.left = rtWidget.top = 0; 1812 rtWidget.left = rtWidget.top = 0;
1814 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { 1813 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) {
1815 m_bLButtonDown = TRUE; 1814 m_bLButtonDown = TRUE;
1816 pDriver->SetGrab(m_pForm, TRUE); 1815 pDriver->SetGrab(m_pForm, TRUE);
1817 } else { 1816 } else {
1818 m_bLButtonDown = FALSE; 1817 m_bLButtonDown = FALSE;
1819 pDriver->SetGrab(m_pForm, FALSE); 1818 pDriver->SetGrab(m_pForm, FALSE);
1820 m_pComboBox->ShowDropList(FALSE); 1819 m_pComboBox->ShowDropList(FALSE);
1821 } 1820 }
1822 } 1821 }
1823 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { 1822 void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
1824 m_bLButtonDown = FALSE; 1823 m_bLButtonDown = FALSE;
1825 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); 1824 IFWL_App* pApp = m_pForm->GetOwnerApp();
1826 if (!pThread) 1825 if (!pApp)
1827 return; 1826 return;
1827
1828 CFWL_NoteDriver* pDriver = 1828 CFWL_NoteDriver* pDriver =
1829 static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver()); 1829 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
1830 pDriver->SetGrab(m_pForm, FALSE); 1830 pDriver->SetGrab(m_pForm, FALSE);
1831 if (m_bLButtonUpSelf) { 1831 if (m_bLButtonUpSelf) {
1832 CFX_RectF rect; 1832 CFX_RectF rect;
1833 m_pForm->GetWidgetRect(rect); 1833 m_pForm->GetWidgetRect(rect);
1834 rect.left = rect.top = 0; 1834 rect.left = rect.top = 0;
1835 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && 1835 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
1836 m_pComboBox->IsDropListShowed()) { 1836 m_pComboBox->IsDropListShowed()) {
1837 m_pComboBox->ShowDropList(FALSE); 1837 m_pComboBox->ShowDropList(FALSE);
1838 } 1838 }
1839 } else { 1839 } else {
1840 m_bLButtonUpSelf = TRUE; 1840 m_bLButtonUpSelf = TRUE;
1841 } 1841 }
1842 } 1842 }
1843 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {} 1843 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {}
1844 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { 1844 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) {
1845 m_pComboBox->ShowDropList(FALSE); 1845 m_pComboBox->ShowDropList(FALSE);
1846 } 1846 }
1847 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1847 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1848 FX_BOOL bSet) { 1848 FX_BOOL bSet) {
1849 if (!bSet) { 1849 if (!bSet) {
1850 if (pMsg->m_pSetFocus == NULL) { 1850 if (pMsg->m_pSetFocus == NULL) {
1851 m_pComboBox->ShowDropList(FALSE); 1851 m_pComboBox->ShowDropList(FALSE);
1852 } 1852 }
1853 } 1853 }
1854 } 1854 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_checkboximp.cpp ('k') | xfa/fwl/basewidget/fwl_datetimepickerimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698