summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_combobox.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 08:33:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 08:33:02 -0700
commit9ec22175f945d227e71c459e7e0b7c464159c18b (patch)
tree1c4836aa35a9e8a1da1761562088b1f9df6aa94f /xfa/fwl/core/ifwl_combobox.cpp
parent5a22582ca1dbe1d66b18d5253bfa1d202fcc3b4a (diff)
downloadpdfium-9ec22175f945d227e71c459e7e0b7c464159c18b.tar.xz
Rename IFWL_Widget::SetDelegate
The ::SetDelegate method was misleading. The primary use was SetDelegate(nullptr) which returned the current delegate and didn't actually set anything. When a value was passed it would set the |m_pCurDelegate| not the |m_pDelegate|. This Cl breaks ::SetDelegate into ::GetCurrentDelegate and ::SetCurrentDelegate to make it clear what is happening and that this does not effect the |m_pDelegate| variable. Review-Url: https://codereview.chromium.org/2459423003
Diffstat (limited to 'xfa/fwl/core/ifwl_combobox.cpp')
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index dcd2cf850e..123dc9bea9 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -718,7 +718,7 @@ void IFWL_ComboBox::InitProxyForm() {
m_pForm->Initialize();
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
- m_pForm->SetDelegate(m_pListProxyDelegate);
+ m_pForm->SetCurrentDelegate(m_pListProxyDelegate);
}
void IFWL_ComboBox::DisForm_InitComboList() {
@@ -1158,10 +1158,8 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
return;
}
FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
- if (bDropDown) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- }
+ if (bDropDown)
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
@@ -1210,9 +1208,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
pKey->m_dwKeyCode == FWL_VKEY_Return ||
pKey->m_dwKeyCode == FWL_VKEY_Escape;
if (bListKey) {
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pListBox->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
+ m_pOwner->m_pListBox->GetCurrentDelegate()->OnProcessMessage(
+ pMessage);
break;
}
}
@@ -1252,8 +1249,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
CFWL_MsgSetFocus msg;
msg.m_pDstTarget = m_pOwner->m_pEdit.get();
msg.m_pSrcTarget = nullptr;
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(&msg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(&msg);
}
} else {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
@@ -1261,8 +1257,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
CFWL_MsgKillFocus msg;
msg.m_pDstTarget = nullptr;
msg.m_pSrcTarget = m_pOwner->m_pEdit.get();
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(&msg);
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(&msg);
}
}
@@ -1305,10 +1300,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
m_pOwner->SynchrEditText(m_pOwner->m_iCurSel);
return;
}
- if (m_pOwner->m_pEdit) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- }
+ if (m_pOwner->m_pEdit)
+ m_pOwner->m_pEdit->GetCurrentDelegate()->OnProcessMessage(pMsg);
}
CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(IFWL_Form* pForm,