From b977720aa7f159ae2c1e9d9b3af1adecff730545 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 17 Nov 2016 10:32:52 -0800 Subject: 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 --- xfa/fwl/core/cfwl_evteditchanged.cpp | 15 +++++++++++++++ xfa/fwl/core/cfwl_evteditchanged.h | 20 ++++++++++++++++++++ xfa/fwl/core/ifwl_combobox.cpp | 8 ++------ xfa/fwl/core/ifwl_combobox.h | 6 ------ xfa/fwl/core/ifwl_datetimepicker.cpp | 5 +++-- xfa/fwl/core/ifwl_datetimepicker.h | 4 ---- 6 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 xfa/fwl/core/cfwl_evteditchanged.cpp create mode 100644 xfa/fwl/core/cfwl_evteditchanged.h (limited to 'xfa') 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(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; -- cgit v1.2.3