summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-17 10:32:52 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-17 10:32:52 -0800
commitb977720aa7f159ae2c1e9d9b3af1adecff730545 (patch)
treea16a1ece85b3d5276a7257016302ad27564143da
parent28f9b62c397c4f3f8dc0cba69ce1cb8c02f81e76 (diff)
downloadpdfium-b977720aa7f159ae2c1e9d9b3af1adecff730545.tar.xz
Create CFWL_EvtEditChanged
This CL creates a generic event for CFWL_EventType::EditChanged and uses it in the ComboBox and DateTimePicker. None of the params from the custom events were used so they have been removed. Review-Url: https://codereview.chromium.org/2511813002
-rw-r--r--BUILD.gn2
-rw-r--r--xfa/fwl/core/cfwl_evteditchanged.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evteditchanged.h20
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp8
-rw-r--r--xfa/fwl/core/ifwl_combobox.h6
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp5
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h4
7 files changed, 42 insertions, 18 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 5666168e12..f04ec48b2e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1188,6 +1188,8 @@ if (pdf_enable_xfa) {
"xfa/fwl/core/cfwl_evtclick.h",
"xfa/fwl/core/cfwl_evtclose.cpp",
"xfa/fwl/core/cfwl_evtclose.h",
+ "xfa/fwl/core/cfwl_evteditchanged.cpp",
+ "xfa/fwl/core/cfwl_evteditchanged.h",
"xfa/fwl/core/cfwl_evtkey.cpp",
"xfa/fwl/core/cfwl_evtkey.h",
"xfa/fwl/core/cfwl_evtkillfocus.cpp",
diff --git a/xfa/fwl/core/cfwl_evteditchanged.cpp b/xfa/fwl/core/cfwl_evteditchanged.cpp
new file mode 100644
index 0000000000..abffbe80e5
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evteditchanged.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/cfwl_evteditchanged.h"
+
+CFWL_EvtEditChanged::CFWL_EvtEditChanged() {}
+
+CFWL_EvtEditChanged::~CFWL_EvtEditChanged() {}
+
+CFWL_EventType CFWL_EvtEditChanged::GetClassID() const {
+ return CFWL_EventType::EditChanged;
+}
diff --git a/xfa/fwl/core/cfwl_evteditchanged.h b/xfa/fwl/core/cfwl_evteditchanged.h
new file mode 100644
index 0000000000..d910f7d6a6
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evteditchanged.h
@@ -0,0 +1,20 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_
+#define XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtEditChanged : public CFWL_Event {
+ public:
+ CFWL_EvtEditChanged();
+ ~CFWL_EvtEditChanged() override;
+
+ CFWL_EventType GetClassID() const override;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTEDITCHANGED_H_
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index 5a49dcc850..35ed4c3ce2 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -9,6 +9,7 @@
#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_evteditchanged.h"
#include "xfa/fwl/core/cfwl_evtpostdropdown.h"
#include "xfa/fwl/core/cfwl_evtpredropdown.h"
#include "xfa/fwl/core/cfwl_evttextchanged.h"
@@ -855,13 +856,8 @@ void IFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) {
pScrollEv.m_fPos = pScrollEvent->m_fPos;
DispatchEvent(&pScrollEv);
} else if (dwFlag == CFWL_EventType::TextChanged) {
- CFWL_EvtTextChanged* pTextChangedEvent =
- static_cast<CFWL_EvtTextChanged*>(pEvent);
- CFWL_EvtCmbEditChanged pTemp;
+ CFWL_EvtEditChanged pTemp;
pTemp.m_pSrcTarget = this;
- pTemp.wsInsert = pTextChangedEvent->wsInsert;
- pTemp.wsDelete = pTextChangedEvent->wsDelete;
- pTemp.nChangeType = pTextChangedEvent->nChangeType;
DispatchEvent(&pTemp);
}
}
diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h
index 5b6657baef..612645c10a 100644
--- a/xfa/fwl/core/ifwl_combobox.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -45,12 +45,6 @@ class IFWL_Widget;
#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
-FWL_EVENT_DEF(CFWL_EvtCmbEditChanged,
- CFWL_EventType::EditChanged,
- int32_t nChangeType;
- CFX_WideString wsInsert;
- CFX_WideString wsDelete;)
-
FWL_EVENT_DEF(CFWL_EvtCmbSelChanged,
CFWL_EventType::SelectChanged,
CFX_Int32Array iArraySels;
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 074065b1e2..1e35eee55b 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/core/ifwl_datetimepicker.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fwl/core/cfwl_evteditchanged.h"
#include "xfa/fwl/core/cfwl_msgmouse.h"
#include "xfa/fwl/core/cfwl_msgsetfocus.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
@@ -197,8 +198,8 @@ void IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
m_pEdit->SetText(wsText);
Repaint(&m_rtClient);
- CFWL_Event_DtpEditChanged ev;
- ev.m_wsText = wsText;
+
+ CFWL_EvtEditChanged ev;
DispatchEvent(&ev);
}
diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h
index 5a46bf58f5..efe7674030 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -34,10 +34,6 @@
class IFWL_DateTimeEdit;
class IFWL_FormProxy;
-FWL_EVENT_DEF(CFWL_Event_DtpEditChanged,
- CFWL_EventType::EditChanged,
- CFX_WideString m_wsText;)
-
FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged,
CFWL_EventType::SelectChanged,
int32_t iYear;