summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_combolist.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_combolist.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_combolist.cpp')
-rw-r--r--xfa/fwl/core/ifwl_combolist.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp
index 23392a5c70..0fdc5ac6d9 100644
--- a/xfa/fwl/core/ifwl_combolist.cpp
+++ b/xfa/fwl/core/ifwl_combolist.cpp
@@ -6,6 +6,7 @@
#include "xfa/fwl/core/ifwl_combolist.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fwl/core/ifwl_comboedit.h"
@@ -14,20 +15,7 @@ IFWL_ComboList::IFWL_ComboList(const IFWL_App* app,
IFWL_Widget* pOuter)
: IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(TRUE) {
ASSERT(pOuter);
-}
-
-void IFWL_ComboList::Initialize() {
- IFWL_ListBox::Initialize();
-
- // Delete the delegate that was created by IFWL_ListBox::Initialize ...
- delete m_pDelegate;
- m_pDelegate = new CFWL_ComboListImpDelegate(this);
-}
-
-void IFWL_ComboList::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- IFWL_ListBox::Finalize();
+ SetDelegate(pdfium::MakeUnique<CFWL_ComboListImpDelegate>(this));
}
int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
@@ -195,7 +183,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
} else if (m_pOwner->m_bNotifyOwner) {
m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ pOuter->GetDelegate()->OnProcessMessage(pMsg);
}
return 1;
}
@@ -213,7 +201,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
if (m_pOwner->m_bNotifyOwner) {
m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ pOuter->GetDelegate()->OnProcessMessage(pMsg);
} else {
if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
CFX_RectF rect;
@@ -255,7 +243,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
}
if (bPropagate) {
pKey->m_pDstTarget = m_pOwner->m_pOuter;
- pOuter->m_pDelegate->OnProcessMessage(pKey);
+ pOuter->GetDelegate()->OnProcessMessage(pKey);
return 1;
}
return 0;