summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffnotify.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-29 21:34:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-29 21:34:56 +0000
commit8308b8c3dfad425942d4aba19a6b85049beff6f4 (patch)
treeada0bf0c19f846b1f45ac4eba165c6dcadaa5063 /xfa/fxfa/cxfa_ffnotify.cpp
parentc30eb662f8a8ea20564e887182e422fd5c4e2099 (diff)
downloadpdfium-8308b8c3dfad425942d4aba19a6b85049beff6f4.tar.xz
Add common base class between CXFA_FFComboBox and CXFA_FFListBox
This CL adds a CXFA_FFDropDown to serve as a base class for the CXFA_FFComboBox and CXFA_FFListBox and adds a virtual InsertItem and DeleteItem methods. Change-Id: I325ffc579ed42a4755bae0c4d18667f8a9458950 Reviewed-on: https://pdfium-review.googlesource.com/24550 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffnotify.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 36f860199a..a7cb91185b 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -41,8 +41,8 @@
namespace {
-CXFA_FFListBox* ToListBox(CXFA_FFWidget* widget) {
- return static_cast<CXFA_FFListBox*>(widget);
+CXFA_FFDropDown* ToDropDown(CXFA_FFWidget* widget) {
+ return static_cast<CXFA_FFDropDown*>(widget);
}
CXFA_FFComboBox* ToComboBox(CXFA_FFWidget* widget) {
@@ -71,12 +71,8 @@ void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_Node* pSender,
CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) {
- if (pWidget->IsLoaded()) {
- if (pSender->IsListBox())
- ToListBox(pWidget)->InsertItem(pLabel, iIndex);
- else
- ToComboBox(pWidget)->InsertItem(pLabel, iIndex);
- }
+ if (pWidget->IsLoaded())
+ ToDropDown(pWidget)->InsertItem(pLabel, iIndex);
}
}
@@ -87,12 +83,8 @@ void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_Node* pSender,
CXFA_FFWidget* pWidget = m_pDoc->GetDocView()->GetWidgetForNode(pSender);
for (; pWidget; pWidget = pSender->GetNextWidget(pWidget)) {
- if (pWidget->IsLoaded()) {
- if (pSender->IsListBox())
- ToListBox(pWidget)->DeleteItem(iIndex);
- else
- ToComboBox(pWidget)->DeleteItem(iIndex);
- }
+ if (pWidget->IsLoaded())
+ ToDropDown(pWidget)->DeleteItem(iIndex);
}
}