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

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

Issue 1770953004: Remove xfa/src/fwl/src and move code up a level. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/src/fwl/src/basewidget/fwl_comboboximp.h" 7 #include "xfa/src/fwl/basewidget/fwl_comboboximp.h"
8 8
9 #include "xfa/include/fwl/core/fwl_theme.h" 9 #include "xfa/include/fwl/core/fwl_theme.h"
10 #include "xfa/src/fdp/include/fde_tto.h" 10 #include "xfa/src/fdp/include/fde_tto.h"
11 #include "xfa/src/fwl/src/basewidget/fwl_editimp.h" 11 #include "xfa/src/fwl/basewidget/fwl_editimp.h"
12 #include "xfa/src/fwl/src/basewidget/fwl_formproxyimp.h" 12 #include "xfa/src/fwl/basewidget/fwl_formproxyimp.h"
13 #include "xfa/src/fwl/src/basewidget/fwl_listboximp.h" 13 #include "xfa/src/fwl/basewidget/fwl_listboximp.h"
14 #include "xfa/src/fwl/src/basewidget/fwl_scrollbarimp.h" 14 #include "xfa/src/fwl/basewidget/fwl_scrollbarimp.h"
15 #include "xfa/src/fwl/src/core/fwl_appimp.h" 15 #include "xfa/src/fwl/core/fwl_appimp.h"
16 #include "xfa/src/fwl/src/core/fwl_formimp.h" 16 #include "xfa/src/fwl/core/fwl_formimp.h"
17 #include "xfa/src/fwl/src/core/fwl_noteimp.h" 17 #include "xfa/src/fwl/core/fwl_noteimp.h"
18 #include "xfa/src/fwl/src/core/fwl_panelimp.h" 18 #include "xfa/src/fwl/core/fwl_panelimp.h"
19 #include "xfa/src/fwl/src/core/fwl_targetimp.h" 19 #include "xfa/src/fwl/core/fwl_targetimp.h"
20 #include "xfa/src/fwl/src/core/fwl_threadimp.h" 20 #include "xfa/src/fwl/core/fwl_threadimp.h"
21 #include "xfa/src/fwl/src/core/fwl_widgetimp.h" 21 #include "xfa/src/fwl/core/fwl_widgetimp.h"
22 #include "xfa/src/fwl/src/core/fwl_widgetmgrimp.h" 22 #include "xfa/src/fwl/core/fwl_widgetmgrimp.h"
23 23
24 // static 24 // static
25 IFWL_ComboBox* IFWL_ComboBox::Create( 25 IFWL_ComboBox* IFWL_ComboBox::Create(
26 const CFWL_WidgetImpProperties& properties) { 26 const CFWL_WidgetImpProperties& properties) {
27 IFWL_ComboBox* pComboBox = new IFWL_ComboBox; 27 IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
28 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr); 28 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
29 pComboBox->SetImpl(pComboBoxImpl); 29 pComboBox->SetImpl(pComboBoxImpl);
30 pComboBoxImpl->SetInterface(pComboBox); 30 pComboBoxImpl->SetInterface(pComboBox);
31 return pComboBox; 31 return pComboBox;
32 } 32 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 129 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
130 } 130 }
131 131
132 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, 132 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
133 IFWL_Widget* pOuter) 133 IFWL_Widget* pOuter)
134 : CFWL_EditImp(properties, pOuter) { 134 : CFWL_EditImp(properties, pOuter) {
135 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); 135 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl());
136 } 136 }
137 137
138 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) 138 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner)
139 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) { 139 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
140 }
141 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 140 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
142 if (!pMessage) 141 if (!pMessage)
143 return 0; 142 return 0;
144 FX_DWORD dwMsgCode = pMessage->GetClassID(); 143 FX_DWORD dwMsgCode = pMessage->GetClassID();
145 FX_BOOL backDefault = TRUE; 144 FX_BOOL backDefault = TRUE;
146 switch (dwMsgCode) { 145 switch (dwMsgCode) {
147 case FWL_MSGHASH_SetFocus: 146 case FWL_MSGHASH_SetFocus:
148 case FWL_MSGHASH_KillFocus: { 147 case FWL_MSGHASH_KillFocus: {
149 if (dwMsgCode == FWL_MSGHASH_SetFocus) { 148 if (dwMsgCode == FWL_MSGHASH_SetFocus) {
150 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 149 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; 271 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top;
273 IFWL_Widget* pOwner = GetOwner(); 272 IFWL_Widget* pOwner = GetOwner();
274 if (!pOwner) 273 if (!pOwner)
275 return; 274 return;
276 pOwner->TransformTo(m_pOuter, fx, fy); 275 pOwner->TransformTo(m_pOuter, fx, fy);
277 } 276 }
278 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { 277 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) {
279 CFWL_WidgetImp::SetFocus(bSet); 278 CFWL_WidgetImp::SetFocus(bSet);
280 } 279 }
281 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) 280 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner)
282 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) { 281 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {}
283 }
284 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 282 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
285 if (!pMessage) 283 if (!pMessage)
286 return 0; 284 return 0;
287 FX_DWORD dwHashCode = pMessage->GetClassID(); 285 FX_DWORD dwHashCode = pMessage->GetClassID();
288 FX_BOOL backDefault = TRUE; 286 FX_BOOL backDefault = TRUE;
289 if (dwHashCode == FWL_MSGHASH_SetFocus || 287 if (dwHashCode == FWL_MSGHASH_SetFocus ||
290 dwHashCode == FWL_MSGHASH_KillFocus) { 288 dwHashCode == FWL_MSGHASH_KillFocus) {
291 OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus); 289 OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus);
292 } else if (dwHashCode == FWL_MSGHASH_Mouse) { 290 } else if (dwHashCode == FWL_MSGHASH_Mouse) {
293 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 291 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 m_pForm(NULL), 468 m_pForm(NULL),
471 m_bLButtonDown(FALSE), 469 m_bLButtonDown(FALSE),
472 m_iCurSel(-1), 470 m_iCurSel(-1),
473 m_iBtnState(FWL_PARTSTATE_CMB_Normal), 471 m_iBtnState(FWL_PARTSTATE_CMB_Normal),
474 m_fComboFormHandler(0), 472 m_fComboFormHandler(0),
475 m_bNeedShowList(FALSE) { 473 m_bNeedShowList(FALSE) {
476 m_rtClient.Reset(); 474 m_rtClient.Reset();
477 m_rtBtn.Reset(); 475 m_rtBtn.Reset();
478 m_rtHandler.Reset(); 476 m_rtHandler.Reset();
479 } 477 }
480 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() { 478 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {}
481 }
482 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { 479 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const {
483 wsClass = FWL_CLASS_ComboBox; 480 wsClass = FWL_CLASS_ComboBox;
484 return FWL_ERR_Succeeded; 481 return FWL_ERR_Succeeded;
485 } 482 }
486 FX_DWORD CFWL_ComboBoxImp::GetClassID() const { 483 FX_DWORD CFWL_ComboBoxImp::GetClassID() const {
487 return FWL_CLASSHASH_ComboBox; 484 return FWL_CLASSHASH_ComboBox;
488 } 485 }
489 FWL_ERR CFWL_ComboBoxImp::Initialize() { 486 FWL_ERR CFWL_ComboBoxImp::Initialize() {
490 if (m_pWidgetMgr->IsFormDisabled()) { 487 if (m_pWidgetMgr->IsFormDisabled()) {
491 return DisForm_Initialize(); 488 return DisForm_Initialize();
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 return; 1523 return;
1527 } 1524 }
1528 if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) 1525 if (pMsg->m_pDstTarget == m_pOwner->m_pInterface)
1529 DoSubCtrlKey(pMsg); 1526 DoSubCtrlKey(pMsg);
1530 } 1527 }
1531 void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { 1528 void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
1532 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; 1529 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode;
1533 const bool bUp = dwKeyCode == FWL_VKEY_Up; 1530 const bool bUp = dwKeyCode == FWL_VKEY_Up;
1534 const bool bDown = dwKeyCode == FWL_VKEY_Down; 1531 const bool bDown = dwKeyCode == FWL_VKEY_Down;
1535 if (bUp || bDown) { 1532 if (bUp || bDown) {
1536 int32_t iCount = static_cast<CFWL_ComboListImp*>( 1533 int32_t iCount =
1537 m_pOwner->m_pListBox->GetImpl())->CountItems(); 1534 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
1535 ->CountItems();
1538 if (iCount < 1) { 1536 if (iCount < 1) {
1539 return; 1537 return;
1540 } 1538 }
1541 FX_BOOL bMatchEqual = FALSE; 1539 FX_BOOL bMatchEqual = FALSE;
1542 int32_t iCurSel = m_pOwner->m_iCurSel; 1540 int32_t iCurSel = m_pOwner->m_iCurSel;
1543 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); 1541 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
1544 if (bDropDown && m_pOwner->m_pEdit) { 1542 if (bDropDown && m_pOwner->m_pEdit) {
1545 CFX_WideString wsText; 1543 CFX_WideString wsText;
1546 m_pOwner->m_pEdit->GetText(wsText); 1544 m_pOwner->m_pEdit->GetText(wsText);
1547 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) 1545 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 pDelegate->OnProcessMessage(pMsg); 1722 pDelegate->OnProcessMessage(pMsg);
1725 } 1723 }
1726 } 1724 }
1727 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( 1725 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(
1728 IFWL_Form* pForm, 1726 IFWL_Form* pForm,
1729 CFWL_ComboBoxImp* pComboBox) 1727 CFWL_ComboBoxImp* pComboBox)
1730 : m_bLButtonDown(FALSE), 1728 : m_bLButtonDown(FALSE),
1731 m_bLButtonUpSelf(FALSE), 1729 m_bLButtonUpSelf(FALSE),
1732 m_fStartPos(0), 1730 m_fStartPos(0),
1733 m_pForm(pForm), 1731 m_pForm(pForm),
1734 m_pComboBox(pComboBox) { 1732 m_pComboBox(pComboBox) {}
1735 }
1736 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 1733 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
1737 if (!pMessage) 1734 if (!pMessage)
1738 return 0; 1735 return 0;
1739 FX_DWORD dwMsgCode = pMessage->GetClassID(); 1736 FX_DWORD dwMsgCode = pMessage->GetClassID();
1740 if (dwMsgCode == FWL_MSGHASH_Mouse) { 1737 if (dwMsgCode == FWL_MSGHASH_Mouse) {
1741 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1738 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1742 FX_DWORD dwCmd = pMsg->m_dwCmd; 1739 FX_DWORD dwCmd = pMsg->m_dwCmd;
1743 switch (dwCmd) { 1740 switch (dwCmd) {
1744 case FWL_MSGMOUSECMD_LButtonDown: { 1741 case FWL_MSGMOUSECMD_LButtonDown: {
1745 OnLButtonDown(pMsg); 1742 OnLButtonDown(pMsg);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 m_pForm->GetWidgetRect(rect); 1798 m_pForm->GetWidgetRect(rect);
1802 rect.left = rect.top = 0; 1799 rect.left = rect.top = 0;
1803 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && 1800 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
1804 m_pComboBox->IsDropListShowed()) { 1801 m_pComboBox->IsDropListShowed()) {
1805 m_pComboBox->ShowDropList(FALSE); 1802 m_pComboBox->ShowDropList(FALSE);
1806 } 1803 }
1807 } else { 1804 } else {
1808 m_bLButtonUpSelf = TRUE; 1805 m_bLButtonUpSelf = TRUE;
1809 } 1806 }
1810 } 1807 }
1811 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { 1808 void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {}
1812 }
1813 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) { 1809 void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) {
1814 m_pComboBox->ShowDropList(FALSE); 1810 m_pComboBox->ShowDropList(FALSE);
1815 } 1811 }
1816 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1812 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1817 FX_BOOL bSet) { 1813 FX_BOOL bSet) {
1818 if (!bSet) { 1814 if (!bSet) {
1819 if (pMsg->m_pSetFocus == NULL) { 1815 if (pMsg->m_pSetFocus == NULL) {
1820 m_pComboBox->ShowDropList(FALSE); 1816 m_pComboBox->ShowDropList(FALSE);
1821 } 1817 }
1822 } 1818 }
1823 } 1819 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698