summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_combobox.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 18:48:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 18:48:20 -0700
commit6fe8795d9022105a0061a0a81be9a49d49fda345 (patch)
treeb1fc8d51560fbf0a9e4a163f887e763f565d5234 /xfa/fwl/core/ifwl_combobox.cpp
parent919e48d877e503f1ca250bc37324c9f7dc96d7a9 (diff)
downloadpdfium-6fe8795d9022105a0061a0a81be9a49d49fda345.tar.xz
Fold IFWL*::{Initialize|Finalize} into constructor/destructor
This Cl moves the ::Initialize method into the constructors and the ::Finalize method into the destructors. The |m_pDelegate| is made private and a unique_ptr. A |SetDelegate| and |GetDelegate| method are added. Review-Url: https://codereview.chromium.org/2464703006
Diffstat (limited to 'xfa/fwl/core/ifwl_combobox.cpp')
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index 123dc9bea9..28a5977425 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -6,6 +6,7 @@
#include "xfa/fwl/core/ifwl_combobox.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/core/cfwl_message.h"
@@ -32,13 +33,8 @@ IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app,
m_rtClient.Reset();
m_rtBtn.Reset();
m_rtHandler.Reset();
-}
-
-IFWL_ComboBox::~IFWL_ComboBox() {}
-void IFWL_ComboBox::Initialize() {
- IFWL_Widget::Initialize();
- m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
+ SetDelegate(pdfium::MakeUnique<CFWL_ComboBoxImpDelegate>(this));
if (m_pWidgetMgr->IsFormDisabled()) {
DisForm_InitComboList();
@@ -54,11 +50,9 @@ void IFWL_ComboBox::Initialize() {
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
m_pListBox.reset(new IFWL_ComboList(m_pOwnerApp, prop, this));
- m_pListBox->Initialize();
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
CFWL_WidgetImpProperties prop2;
m_pEdit.reset(new IFWL_ComboEdit(m_pOwnerApp, prop2, this));
- m_pEdit->Initialize();
m_pEdit->SetOuter(this);
}
if (m_pEdit)
@@ -67,15 +61,7 @@ void IFWL_ComboBox::Initialize() {
SetStates(m_pProperties->m_dwStates);
}
-void IFWL_ComboBox::Finalize() {
- if (m_pEdit)
- m_pEdit->Finalize();
-
- m_pListBox->Finalize();
- delete m_pDelegate;
- m_pDelegate = nullptr;
- IFWL_Widget::Finalize();
-}
+IFWL_ComboBox::~IFWL_ComboBox() {}
FWL_Type IFWL_ComboBox::GetClassID() const {
return FWL_Type::ComboBox;
@@ -116,7 +102,6 @@ FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
if (bAddDropDown && !m_pEdit) {
CFWL_WidgetImpProperties prop;
m_pEdit.reset(new IFWL_ComboEdit(m_pOwnerApp, prop, nullptr));
- m_pEdit->Initialize();
m_pEdit->SetOuter(this);
m_pEdit->SetParent(this);
} else if (bRemoveDropDown && m_pEdit) {
@@ -715,7 +700,6 @@ void IFWL_ComboBox::InitProxyForm() {
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
m_pForm = new IFWL_FormProxy(m_pOwnerApp, propForm, m_pListBox.get());
- m_pForm->Initialize();
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
m_pForm->SetCurrentDelegate(m_pListProxyDelegate);
@@ -732,7 +716,6 @@ void IFWL_ComboBox::DisForm_InitComboList() {
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
m_pListBox.reset(new IFWL_ComboList(m_pOwnerApp, prop, this));
- m_pListBox->Initialize();
}
void IFWL_ComboBox::DisForm_InitComboEdit() {
@@ -743,7 +726,6 @@ void IFWL_ComboBox::DisForm_InitComboEdit() {
prop.m_pParent = this;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
m_pEdit.reset(new IFWL_ComboEdit(m_pOwnerApp, prop, this));
- m_pEdit->Initialize();
m_pEdit->SetOuter(this);
}