summaryrefslogtreecommitdiff
path: root/xfa/fwl/core
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-17 13:15:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-17 13:15:16 -0800
commit3855f7ff0d4c5c8653fc17219bf65c4a0a95e8bb (patch)
tree17cd22db0b4cd1ea3c337d99ee760b3a86181eaf /xfa/fwl/core
parent935c6310adacf2f4a4265e831e6cb60dc7a35803 (diff)
downloadpdfium-3855f7ff0d4c5c8653fc17219bf65c4a0a95e8bb.tar.xz
Unify the three CFWL_EventType::SelectChange classes.
This CL removes the ListBox SelectChange class as it is never processed. The other two have been unified into a single classs. Review-Url: https://codereview.chromium.org/2509283003
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r--xfa/fwl/core/cfwl_evtselectchanged.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evtselectchanged.h28
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp4
-rw-r--r--xfa/fwl/core/ifwl_combobox.h5
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp3
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h6
-rw-r--r--xfa/fwl/core/ifwl_listbox.cpp24
-rw-r--r--xfa/fwl/core/ifwl_listbox.h7
8 files changed, 48 insertions, 44 deletions
diff --git a/xfa/fwl/core/cfwl_evtselectchanged.cpp b/xfa/fwl/core/cfwl_evtselectchanged.cpp
new file mode 100644
index 0000000000..3eead94d6e
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtselectchanged.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_evtselectchanged.h"
+
+CFWL_EvtSelectChanged::CFWL_EvtSelectChanged() {}
+
+CFWL_EvtSelectChanged::~CFWL_EvtSelectChanged() {}
+
+CFWL_EventType CFWL_EvtSelectChanged::GetClassID() const {
+ return CFWL_EventType::SelectChanged;
+}
diff --git a/xfa/fwl/core/cfwl_evtselectchanged.h b/xfa/fwl/core/cfwl_evtselectchanged.h
new file mode 100644
index 0000000000..f01b2aac6a
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtselectchanged.h
@@ -0,0 +1,28 @@
+// 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_EVTSELECTCHANGED_H_
+#define XFA_FWL_CORE_CFWL_EVTSELECTCHANGED_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtSelectChanged : public CFWL_Event {
+ public:
+ CFWL_EvtSelectChanged();
+ ~CFWL_EvtSelectChanged() override;
+
+ CFWL_EventType GetClassID() const override;
+
+ // Used by ComboBox.
+ bool bLButtonUp;
+
+ // Used by DateTimePIcker
+ int32_t iYear;
+ int32_t iMonth;
+ int32_t iDay;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTSELECTCHANGED_H_
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index 35ed4c3ce2..e186d4fa39 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -12,6 +12,7 @@
#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_evtselectchanged.h"
#include "xfa/fwl/core/cfwl_evttextchanged.h"
#include "xfa/fwl/core/cfwl_msgkey.h"
#include "xfa/fwl/core/cfwl_msgkillfocus.h"
@@ -562,10 +563,9 @@ void IFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) {
m_pEdit->SetSelected();
}
- CFWL_EvtCmbSelChanged ev;
+ CFWL_EvtSelectChanged ev;
ev.bLButtonUp = bLButtonUp;
ev.m_pSrcTarget = this;
- ev.iArraySels.Add(m_iCurSel);
DispatchEvent(&ev);
}
diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h
index 612645c10a..8e23d24de0 100644
--- a/xfa/fwl/core/ifwl_combobox.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -45,11 +45,6 @@ class IFWL_Widget;
#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
-FWL_EVENT_DEF(CFWL_EvtCmbSelChanged,
- CFWL_EventType::SelectChanged,
- CFX_Int32Array iArraySels;
- bool bLButtonUp;)
-
class IFWL_ComboBoxDP : public IFWL_ListBoxDP {
public:
virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0;
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 1e35eee55b..8d5d6cf442 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -8,6 +8,7 @@
#include "third_party/base/ptr_util.h"
#include "xfa/fwl/core/cfwl_evteditchanged.h"
+#include "xfa/fwl/core/cfwl_evtselectchanged.h"
#include "xfa/fwl/core/cfwl_msgmouse.h"
#include "xfa/fwl/core/cfwl_msgsetfocus.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
@@ -356,7 +357,7 @@ void IFWL_DateTimePicker::ProcessSelChanged(int32_t iYear,
m_pEdit->Update();
Repaint(&m_rtClient);
- CFWL_Event_DtpSelectChanged ev;
+ CFWL_EvtSelectChanged ev;
ev.m_pSrcTarget = this;
ev.iYear = m_iYear;
ev.iMonth = m_iMonth;
diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h
index efe7674030..e9aeb08be2 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -34,12 +34,6 @@
class IFWL_DateTimeEdit;
class IFWL_FormProxy;
-FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged,
- CFWL_EventType::SelectChanged,
- int32_t iYear;
- int32_t iMonth;
- int32_t iDay;)
-
class IFWL_DateTimePickerDP : public IFWL_DataProvider {
public:
virtual void GetToday(IFWL_Widget* pWidget,
diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp
index 4a8f9395b6..f1ee2f5245 100644
--- a/xfa/fwl/core/ifwl_listbox.cpp
+++ b/xfa/fwl/core/ifwl_listbox.cpp
@@ -843,20 +843,6 @@ bool IFWL_ListBox::IsShowScrollBar(bool bVert) {
(m_pProperties->m_dwStates & FWL_WGTSTATE_Focused);
}
-void IFWL_ListBox::ProcessSelChanged() {
- CFWL_EvtLtbSelChanged selEvent;
- selEvent.m_pSrcTarget = this;
- CFX_Int32Array arrSels;
- int32_t iCount = CountSelItems();
- for (int32_t i = 0; i < iCount; i++) {
- CFWL_ListItem* item = GetSelItem(i);
- if (!item)
- continue;
- selEvent.iarraySels.Add(i);
- }
- DispatchEvent(&selEvent);
-}
-
void IFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) {
if (!pMessage)
return;
@@ -974,7 +960,6 @@ void IFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) {
SetFocusItem(pItem);
ScrollToVisible(pItem);
SetGrab(true);
- ProcessSelChanged();
Repaint(&m_rtClient);
}
@@ -984,7 +969,6 @@ void IFWL_ListBox::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonDown = false;
SetGrab(false);
- DispatchSelChangedEv();
}
void IFWL_ListBox::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) {
@@ -1005,8 +989,6 @@ void IFWL_ListBox::OnKeyDown(CFWL_MsgKey* pMsg) {
bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift);
bool bCtrl = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl);
OnVK(pItem, bShift, bCtrl);
- DispatchSelChangedEv();
- ProcessSelChanged();
break;
}
default:
@@ -1097,9 +1079,3 @@ bool IFWL_ListBox::OnScroll(IFWL_ScrollBar* pScrollBar,
}
return true;
}
-
-void IFWL_ListBox::DispatchSelChangedEv() {
- CFWL_EvtLtbSelChanged ev;
- ev.m_pSrcTarget = this;
- DispatchEvent(&ev);
-}
diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h
index 48d4522009..5912656ac5 100644
--- a/xfa/fwl/core/ifwl_listbox.h
+++ b/xfa/fwl/core/ifwl_listbox.h
@@ -38,10 +38,6 @@ class CFWL_MsgMouse;
class CFWL_MsgMouseWheel;
class CFX_DIBitmap;
-FWL_EVENT_DEF(CFWL_EvtLtbSelChanged,
- CFWL_EventType::SelectChanged,
- CFX_Int32Array iarraySels;)
-
class IFWL_ListBoxDP : public IFWL_DataProvider {
public:
virtual int32_t CountItems(const IFWL_Widget* pWidget) const = 0;
@@ -148,7 +144,7 @@ class IFWL_ListBox : public IFWL_Widget {
bool bAutoSize = false);
FX_FLOAT GetMaxTextWidth();
FX_FLOAT GetScrollWidth();
- void ProcessSelChanged();
+
void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
void OnLButtonDown(CFWL_MsgMouse* pMsg);
void OnLButtonUp(CFWL_MsgMouse* pMsg);
@@ -156,7 +152,6 @@ class IFWL_ListBox : public IFWL_Widget {
void OnKeyDown(CFWL_MsgKey* pMsg);
void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl);
bool OnScroll(IFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos);
- void DispatchSelChangedEv();
CFX_RectF m_rtClient;
CFX_RectF m_rtStatic;