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
diff --git a/BUILD.gn b/BUILD.gn
index 5666168..f04ec48 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1188,6 +1188,8 @@
"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 0000000..abffbe8
--- /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 0000000..d910f7d
--- /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 5a49dcc..35ed4c3 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 @@
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 5b6657b..612645c 100644
--- a/xfa/fwl/core/ifwl_combobox.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -45,12 +45,6 @@
#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 074065b..1e35eee 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 @@
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 5a46bf5..efe7674 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;