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/core/ifwl_combobox.h" | 7 #include "xfa/fwl/core/ifwl_combobox.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 m_rtClient.Reset(); | 43 m_rtClient.Reset(); |
44 m_rtBtn.Reset(); | 44 m_rtBtn.Reset(); |
45 m_rtHandler.Reset(); | 45 m_rtHandler.Reset(); |
46 | 46 |
47 if (m_pWidgetMgr->IsFormDisabled()) { | 47 if (m_pWidgetMgr->IsFormDisabled()) { |
48 DisForm_InitComboList(); | 48 DisForm_InitComboList(); |
49 DisForm_InitComboEdit(); | 49 DisForm_InitComboEdit(); |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 auto prop = | 53 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); |
54 pdfium::MakeUnique<CFWL_WidgetProperties>(m_pProperties->m_pDataProvider); | |
55 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; | 54 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; |
56 prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; | 55 prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; |
57 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) | 56 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) |
58 prop->m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; | 57 prop->m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; |
| 58 m_pListBox = |
| 59 pdfium::MakeUnique<IFWL_ComboList>(m_pOwnerApp, std::move(prop), this); |
59 | 60 |
60 m_pListBox.reset(new IFWL_ComboList(m_pOwnerApp, std::move(prop), this)); | |
61 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { | 61 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { |
62 m_pEdit.reset(new IFWL_ComboEdit( | 62 m_pEdit.reset(new IFWL_ComboEdit( |
63 m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this)); | 63 m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this)); |
64 m_pEdit->SetOuter(this); | 64 m_pEdit->SetOuter(this); |
65 } | 65 } |
66 if (m_pEdit) | 66 if (m_pEdit) |
67 m_pEdit->SetParent(this); | 67 m_pEdit->SetParent(this); |
68 | 68 |
69 SetStates(m_pProperties->m_dwStates); | 69 SetStates(m_pProperties->m_dwStates); |
70 } | 70 } |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // if the SetParent call is going to transfer ownership. | 583 // if the SetParent call is going to transfer ownership. |
584 m_pComboBoxProxy = new IFWL_ComboBoxProxy(this, m_pOwnerApp, std::move(prop), | 584 m_pComboBoxProxy = new IFWL_ComboBoxProxy(this, m_pOwnerApp, std::move(prop), |
585 m_pListBox.get()); | 585 m_pListBox.get()); |
586 m_pListBox->SetParent(m_pComboBoxProxy); | 586 m_pListBox->SetParent(m_pComboBoxProxy); |
587 } | 587 } |
588 | 588 |
589 void IFWL_ComboBox::DisForm_InitComboList() { | 589 void IFWL_ComboBox::DisForm_InitComboList() { |
590 if (m_pListBox) | 590 if (m_pListBox) |
591 return; | 591 return; |
592 | 592 |
593 auto prop = | 593 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); |
594 pdfium::MakeUnique<CFWL_WidgetProperties>(m_pProperties->m_pDataProvider); | |
595 prop->m_pParent = this; | 594 prop->m_pParent = this; |
596 prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; | 595 prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; |
597 prop->m_dwStates = FWL_WGTSTATE_Invisible; | 596 prop->m_dwStates = FWL_WGTSTATE_Invisible; |
598 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; | 597 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; |
599 | |
600 m_pListBox = | 598 m_pListBox = |
601 pdfium::MakeUnique<IFWL_ComboList>(m_pOwnerApp, std::move(prop), this); | 599 pdfium::MakeUnique<IFWL_ComboList>(m_pOwnerApp, std::move(prop), this); |
602 } | 600 } |
603 | 601 |
604 void IFWL_ComboBox::DisForm_InitComboEdit() { | 602 void IFWL_ComboBox::DisForm_InitComboEdit() { |
605 if (m_pEdit) | 603 if (m_pEdit) |
606 return; | 604 return; |
607 | 605 |
608 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); | 606 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); |
609 prop->m_pParent = this; | 607 prop->m_pParent = this; |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 else | 1121 else |
1124 iCurSel++; | 1122 iCurSel++; |
1125 } | 1123 } |
1126 m_iCurSel = iCurSel; | 1124 m_iCurSel = iCurSel; |
1127 SyncEditText(m_iCurSel); | 1125 SyncEditText(m_iCurSel); |
1128 return; | 1126 return; |
1129 } | 1127 } |
1130 if (m_pEdit) | 1128 if (m_pEdit) |
1131 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1129 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
1132 } | 1130 } |
OLD | NEW |