From a43715b4cefc982baadd45510db8c4e428c2c8cd Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 17 Nov 2016 09:26:13 -0800 Subject: Convert single use EventTypes to class files. This moves the remaining EventType class definitions to there own files where the EventType only has a single implementation. Review-Url: https://codereview.chromium.org/2508203002 --- xfa/fwl/core/cfwl_evtcheckstatechanged.cpp | 15 +++++++++++++++ xfa/fwl/core/cfwl_evtcheckstatechanged.h | 20 ++++++++++++++++++++ xfa/fwl/core/cfwl_evtpostdropdown.cpp | 15 +++++++++++++++ xfa/fwl/core/cfwl_evtpostdropdown.h | 20 ++++++++++++++++++++ xfa/fwl/core/cfwl_evtpredropdown.cpp | 15 +++++++++++++++ xfa/fwl/core/cfwl_evtpredropdown.h | 20 ++++++++++++++++++++ xfa/fwl/core/ifwl_checkbox.cpp | 12 +++++++----- xfa/fwl/core/ifwl_checkbox.h | 2 -- xfa/fwl/core/ifwl_combobox.cpp | 8 +++++--- xfa/fwl/core/ifwl_combobox.h | 4 ---- 10 files changed, 117 insertions(+), 14 deletions(-) create mode 100644 xfa/fwl/core/cfwl_evtcheckstatechanged.cpp create mode 100644 xfa/fwl/core/cfwl_evtcheckstatechanged.h create mode 100644 xfa/fwl/core/cfwl_evtpostdropdown.cpp create mode 100644 xfa/fwl/core/cfwl_evtpostdropdown.h create mode 100644 xfa/fwl/core/cfwl_evtpredropdown.cpp create mode 100644 xfa/fwl/core/cfwl_evtpredropdown.h (limited to 'xfa/fwl/core') diff --git a/xfa/fwl/core/cfwl_evtcheckstatechanged.cpp b/xfa/fwl/core/cfwl_evtcheckstatechanged.cpp new file mode 100644 index 0000000000..53f7848fae --- /dev/null +++ b/xfa/fwl/core/cfwl_evtcheckstatechanged.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_evtcheckstatechanged.h" + +CFWL_EvtCheckStateChanged::CFWL_EvtCheckStateChanged() {} + +CFWL_EvtCheckStateChanged::~CFWL_EvtCheckStateChanged() {} + +CFWL_EventType CFWL_EvtCheckStateChanged::GetClassID() const { + return CFWL_EventType::CheckStateChanged; +} diff --git a/xfa/fwl/core/cfwl_evtcheckstatechanged.h b/xfa/fwl/core/cfwl_evtcheckstatechanged.h new file mode 100644 index 0000000000..544fbad896 --- /dev/null +++ b/xfa/fwl/core/cfwl_evtcheckstatechanged.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_EVTCHECKSTATECHANGED_H_ +#define XFA_FWL_CORE_CFWL_EVTCHECKSTATECHANGED_H_ + +#include "xfa/fwl/core/cfwl_event.h" + +class CFWL_EvtCheckStateChanged : public CFWL_Event { + public: + CFWL_EvtCheckStateChanged(); + ~CFWL_EvtCheckStateChanged() override; + + CFWL_EventType GetClassID() const override; +}; + +#endif // XFA_FWL_CORE_CFWL_EVTCHECKSTATECHANGED_H_ diff --git a/xfa/fwl/core/cfwl_evtpostdropdown.cpp b/xfa/fwl/core/cfwl_evtpostdropdown.cpp new file mode 100644 index 0000000000..52ba803197 --- /dev/null +++ b/xfa/fwl/core/cfwl_evtpostdropdown.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_evtpostdropdown.h" + +CFWL_EvtPostDropDown::CFWL_EvtPostDropDown() {} + +CFWL_EvtPostDropDown::~CFWL_EvtPostDropDown() {} + +CFWL_EventType CFWL_EvtPostDropDown::GetClassID() const { + return CFWL_EventType::PostDropDown; +} diff --git a/xfa/fwl/core/cfwl_evtpostdropdown.h b/xfa/fwl/core/cfwl_evtpostdropdown.h new file mode 100644 index 0000000000..b4d8516593 --- /dev/null +++ b/xfa/fwl/core/cfwl_evtpostdropdown.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_EVTPOSTDROPDOWN_H_ +#define XFA_FWL_CORE_CFWL_EVTPOSTDROPDOWN_H_ + +#include "xfa/fwl/core/cfwl_event.h" + +class CFWL_EvtPostDropDown : public CFWL_Event { + public: + CFWL_EvtPostDropDown(); + ~CFWL_EvtPostDropDown() override; + + CFWL_EventType GetClassID() const override; +}; + +#endif // XFA_FWL_CORE_CFWL_EVTPOSTDROPDOWN_H_ diff --git a/xfa/fwl/core/cfwl_evtpredropdown.cpp b/xfa/fwl/core/cfwl_evtpredropdown.cpp new file mode 100644 index 0000000000..12fe9fc727 --- /dev/null +++ b/xfa/fwl/core/cfwl_evtpredropdown.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_evtpredropdown.h" + +CFWL_EvtPreDropDown::CFWL_EvtPreDropDown() {} + +CFWL_EvtPreDropDown::~CFWL_EvtPreDropDown() {} + +CFWL_EventType CFWL_EvtPreDropDown::GetClassID() const { + return CFWL_EventType::PreDropDown; +} diff --git a/xfa/fwl/core/cfwl_evtpredropdown.h b/xfa/fwl/core/cfwl_evtpredropdown.h new file mode 100644 index 0000000000..df4d29abe4 --- /dev/null +++ b/xfa/fwl/core/cfwl_evtpredropdown.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_EVTPREDROPDOWN_H_ +#define XFA_FWL_CORE_CFWL_EVTPREDROPDOWN_H_ + +#include "xfa/fwl/core/cfwl_event.h" + +class CFWL_EvtPreDropDown : public CFWL_Event { + public: + CFWL_EvtPreDropDown(); + ~CFWL_EvtPreDropDown() override; + + CFWL_EventType GetClassID() const override; +}; + +#endif // XFA_FWL_CORE_CFWL_EVTPREDROPDOWN_H_ diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index 62bf636796..1f053dbe20 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -10,6 +10,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" +#include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" @@ -360,11 +361,12 @@ void IFWL_CheckBox::NextStates() { } Repaint(&m_rtClient); - if (dwFirststate != m_pProperties->m_dwStates) { - CFWL_EvtCkbCheckStateChanged wmCheckBoxState; - wmCheckBoxState.m_pSrcTarget = this; - DispatchEvent(&wmCheckBoxState); - } + if (dwFirststate == m_pProperties->m_dwStates) + return; + + CFWL_EvtCheckStateChanged wmCheckBoxState; + wmCheckBoxState.m_pSrcTarget = this; + DispatchEvent(&wmCheckBoxState); } void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 0b38e777b8..65a36a39ab 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -47,8 +47,6 @@ class CFWL_MsgMouse; class CFWL_WidgetProperties; class IFWL_Widget; -FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, CFWL_EventType::CheckStateChanged) - class IFWL_CheckBoxDP : public IFWL_DataProvider { public: virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0; diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index c2f1c873ae..68d8cc97f8 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -9,6 +9,8 @@ #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_evtpostdropdown.h" +#include "xfa/fwl/core/cfwl_evtpredropdown.h" #include "xfa/fwl/core/cfwl_evttextchanged.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgkillfocus.h" @@ -393,7 +395,7 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) { m_pListBox->SetWidgetRect(m_rtList); m_pListBox->Update(); - CFWL_EvtCmbPreDropDown ev; + CFWL_EvtPreDropDown ev; ev.m_pSrcTarget = this; DispatchEvent(&ev); @@ -617,7 +619,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { return; if (bActivate) { - CFWL_EvtCmbPreDropDown preEvent; + CFWL_EvtPreDropDown preEvent; preEvent.m_pSrcTarget = this; DispatchEvent(&preEvent); @@ -651,7 +653,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { - CFWL_EvtCmbPostDropDown postEvent; + CFWL_EvtPostDropDown postEvent; postEvent.m_pSrcTarget = this; DispatchEvent(&postEvent); } diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index 488e02addc..8b045a8780 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -45,10 +45,6 @@ class IFWL_Widget; #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) -FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown) - -FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown) - FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, CFWL_EventType::EditChanged, int32_t nChangeType; -- cgit v1.2.3