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

Side by Side Diff: xfa/fwl/core/ifwl_combobox.cpp

Issue 2433133002: Remove IFWL_*::Create methods, use new (Closed)
Patch Set: Rebase to master Created 4 years, 2 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/core/ifwl_combobox.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('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/core/ifwl_combobox.h" 7 #include "xfa/fwl/core/ifwl_combobox.h"
8 8
9 #include "xfa/fde/cfde_txtedtengine.h" 9 #include "xfa/fde/cfde_txtedtengine.h"
10 #include "xfa/fde/tto/fde_textout.h" 10 #include "xfa/fde/tto/fde_textout.h"
11 #include "xfa/fwl/core/cfwl_message.h" 11 #include "xfa/fwl/core/cfwl_message.h"
12 #include "xfa/fwl/core/cfwl_themebackground.h" 12 #include "xfa/fwl/core/cfwl_themebackground.h"
13 #include "xfa/fwl/core/cfwl_themepart.h" 13 #include "xfa/fwl/core/cfwl_themepart.h"
14 #include "xfa/fwl/core/cfwl_themetext.h" 14 #include "xfa/fwl/core/cfwl_themetext.h"
15 #include "xfa/fwl/core/cfwl_widgetmgr.h" 15 #include "xfa/fwl/core/cfwl_widgetmgr.h"
16 #include "xfa/fwl/core/fwl_noteimp.h" 16 #include "xfa/fwl/core/fwl_noteimp.h"
17 #include "xfa/fwl/core/ifwl_app.h" 17 #include "xfa/fwl/core/ifwl_app.h"
18 #include "xfa/fwl/core/ifwl_comboedit.h" 18 #include "xfa/fwl/core/ifwl_comboedit.h"
19 #include "xfa/fwl/core/ifwl_combolist.h" 19 #include "xfa/fwl/core/ifwl_combolist.h"
20 #include "xfa/fwl/core/ifwl_formproxy.h" 20 #include "xfa/fwl/core/ifwl_formproxy.h"
21 #include "xfa/fwl/core/ifwl_themeprovider.h" 21 #include "xfa/fwl/core/ifwl_themeprovider.h"
22 22
23 // static 23 IFWL_ComboBox::IFWL_ComboBox(const CFWL_WidgetImpProperties& properties)
24 IFWL_ComboBox* IFWL_ComboBox::Create( 24 : IFWL_Widget(properties, nullptr),
25 const CFWL_WidgetImpProperties& properties) {
26 return new IFWL_ComboBox(properties, nullptr);
27 }
28
29 IFWL_ComboBox::IFWL_ComboBox(const CFWL_WidgetImpProperties& properties,
30 IFWL_Widget* pOuter)
31 : IFWL_Widget(properties, pOuter),
32 m_pForm(nullptr), 25 m_pForm(nullptr),
33 m_bLButtonDown(FALSE), 26 m_bLButtonDown(FALSE),
34 m_iCurSel(-1), 27 m_iCurSel(-1),
35 m_iBtnState(CFWL_PartState_Normal), 28 m_iBtnState(CFWL_PartState_Normal),
36 m_fComboFormHandler(0), 29 m_fComboFormHandler(0),
37 m_bNeedShowList(FALSE) { 30 m_bNeedShowList(FALSE) {
38 m_rtClient.Reset(); 31 m_rtClient.Reset();
39 m_rtBtn.Reset(); 32 m_rtBtn.Reset();
40 m_rtHandler.Reset(); 33 m_rtHandler.Reset();
41 } 34 }
(...skipping 17 matching lines...) Expand all
59 return FWL_Error::Indefinite; 52 return FWL_Error::Indefinite;
60 53
61 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); 54 m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
62 CFWL_WidgetImpProperties prop; 55 CFWL_WidgetImpProperties prop;
63 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; 56 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
64 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; 57 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
65 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) 58 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText)
66 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; 59 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
67 60
68 prop.m_pDataProvider = m_pProperties->m_pDataProvider; 61 prop.m_pDataProvider = m_pProperties->m_pDataProvider;
69 m_pListBox.reset(IFWL_ComboList::Create(prop, this)); 62 m_pListBox.reset(new IFWL_ComboList(prop, this));
70 m_pListBox->Initialize(); 63 m_pListBox->Initialize();
71 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { 64 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
72 CFWL_WidgetImpProperties prop2; 65 CFWL_WidgetImpProperties prop2;
73 m_pEdit.reset(IFWL_ComboEdit::Create(prop2, this)); 66 m_pEdit.reset(new IFWL_ComboEdit(prop2, this));
74 m_pEdit->Initialize(); 67 m_pEdit->Initialize();
75 m_pEdit->SetOuter(this); 68 m_pEdit->SetOuter(this);
76 } 69 }
77 if (m_pEdit) 70 if (m_pEdit)
78 m_pEdit->SetParent(this); 71 m_pEdit->SetParent(this);
79 72
80 SetStates(m_pProperties->m_dwStates); 73 SetStates(m_pProperties->m_dwStates);
81 return FWL_Error::Succeeded; 74 return FWL_Error::Succeeded;
82 } 75 }
83 76
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 111
119 FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, 112 FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
120 uint32_t dwStylesExRemoved) { 113 uint32_t dwStylesExRemoved) {
121 if (m_pWidgetMgr->IsFormDisabled()) { 114 if (m_pWidgetMgr->IsFormDisabled()) {
122 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 115 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
123 } 116 }
124 bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown); 117 bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown);
125 bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown); 118 bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown);
126 if (bAddDropDown && !m_pEdit) { 119 if (bAddDropDown && !m_pEdit) {
127 CFWL_WidgetImpProperties prop; 120 CFWL_WidgetImpProperties prop;
128 m_pEdit.reset(IFWL_ComboEdit::Create(prop, nullptr)); 121 m_pEdit.reset(new IFWL_ComboEdit(prop, nullptr));
129 m_pEdit->Initialize(); 122 m_pEdit->Initialize();
130 m_pEdit->SetOuter(this); 123 m_pEdit->SetOuter(this);
131 m_pEdit->SetParent(this); 124 m_pEdit->SetParent(this);
132 } else if (bRemoveDropDown && m_pEdit) { 125 } else if (bRemoveDropDown && m_pEdit) {
133 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); 126 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE);
134 } 127 }
135 return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 128 return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
136 } 129 }
137 130
138 FWL_Error IFWL_ComboBox::Update() { 131 FWL_Error IFWL_ComboBox::Update() {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 void IFWL_ComboBox::InitProxyForm() { 709 void IFWL_ComboBox::InitProxyForm() {
717 if (m_pForm) 710 if (m_pForm)
718 return; 711 return;
719 if (!m_pListBox) 712 if (!m_pListBox)
720 return; 713 return;
721 714
722 CFWL_WidgetImpProperties propForm; 715 CFWL_WidgetImpProperties propForm;
723 propForm.m_pOwner = this; 716 propForm.m_pOwner = this;
724 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; 717 propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
725 propForm.m_dwStates = FWL_WGTSTATE_Invisible; 718 propForm.m_dwStates = FWL_WGTSTATE_Invisible;
726 m_pForm = IFWL_FormProxy::Create(propForm, m_pListBox.get()); 719
720 m_pForm = new IFWL_FormProxy(propForm, m_pListBox.get());
727 m_pForm->Initialize(); 721 m_pForm->Initialize();
728 m_pListBox->SetParent(m_pForm); 722 m_pListBox->SetParent(m_pForm);
729 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); 723 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
730 m_pForm->SetDelegate(m_pListProxyDelegate); 724 m_pForm->SetDelegate(m_pListProxyDelegate);
731 } 725 }
732 726
733 FWL_Error IFWL_ComboBox::DisForm_Initialize() { 727 FWL_Error IFWL_ComboBox::DisForm_Initialize() {
734 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) 728 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
735 return FWL_Error::Indefinite; 729 return FWL_Error::Indefinite;
736 730
737 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); 731 m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
738 DisForm_InitComboList(); 732 DisForm_InitComboList();
739 DisForm_InitComboEdit(); 733 DisForm_InitComboEdit();
740 return FWL_Error::Succeeded; 734 return FWL_Error::Succeeded;
741 } 735 }
742 736
743 void IFWL_ComboBox::DisForm_InitComboList() { 737 void IFWL_ComboBox::DisForm_InitComboList() {
744 if (m_pListBox) 738 if (m_pListBox)
745 return; 739 return;
746 740
747 CFWL_WidgetImpProperties prop; 741 CFWL_WidgetImpProperties prop;
748 prop.m_pParent = this; 742 prop.m_pParent = this;
749 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; 743 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
750 prop.m_dwStates = FWL_WGTSTATE_Invisible; 744 prop.m_dwStates = FWL_WGTSTATE_Invisible;
751 prop.m_pDataProvider = m_pProperties->m_pDataProvider; 745 prop.m_pDataProvider = m_pProperties->m_pDataProvider;
752 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; 746 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
753 m_pListBox.reset(IFWL_ComboList::Create(prop, this)); 747 m_pListBox.reset(new IFWL_ComboList(prop, this));
754 m_pListBox->Initialize(); 748 m_pListBox->Initialize();
755 } 749 }
756 750
757 void IFWL_ComboBox::DisForm_InitComboEdit() { 751 void IFWL_ComboBox::DisForm_InitComboEdit() {
758 if (m_pEdit) { 752 if (m_pEdit) {
759 return; 753 return;
760 } 754 }
761 CFWL_WidgetImpProperties prop; 755 CFWL_WidgetImpProperties prop;
762 prop.m_pParent = this; 756 prop.m_pParent = this;
763 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; 757 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
764 m_pEdit.reset(IFWL_ComboEdit::Create(prop, this)); 758 m_pEdit.reset(new IFWL_ComboEdit(prop, this));
765 m_pEdit->Initialize(); 759 m_pEdit->Initialize();
766 m_pEdit->SetOuter(this); 760 m_pEdit->SetOuter(this);
767 } 761 }
768 762
769 void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) { 763 void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) {
770 FX_BOOL bDropList = DisForm_IsDropListShowed(); 764 FX_BOOL bDropList = DisForm_IsDropListShowed();
771 if (bDropList == bActivate) { 765 if (bDropList == bActivate) {
772 return; 766 return;
773 } 767 }
774 if (bActivate) { 768 if (bActivate) {
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 } 1429 }
1436 1430
1437 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1431 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1438 FX_BOOL bSet) { 1432 FX_BOOL bSet) {
1439 if (!bSet) { 1433 if (!bSet) {
1440 if (!pMsg->m_pSetFocus) { 1434 if (!pMsg->m_pSetFocus) {
1441 m_pComboBox->ShowDropList(FALSE); 1435 m_pComboBox->ShowDropList(FALSE);
1442 } 1436 }
1443 } 1437 }
1444 } 1438 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_combobox.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698