Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: xfa/fwl/core/cfwl_widget.cpp

Issue 2530993002: Cleanup FWL Event and Message code. (Closed)
Patch Set: Cleanup Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« xfa/fwl/core/cfwl_message.h ('K') | « xfa/fwl/core/cfwl_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/cfwl_widget.cpp
diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp
index e2de86681722a224404afd542b6c33f4fe7ac826..2a703ffadecb24bb7616c1eb07e62607dc069327 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -12,12 +12,8 @@
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fwl/core/cfwl_app.h"
#include "xfa/fwl/core/cfwl_combobox.h"
-#include "xfa/fwl/core/cfwl_evtkey.h"
-#include "xfa/fwl/core/cfwl_evtkillfocus.h"
+#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_evtmouse.h"
-#include "xfa/fwl/core/cfwl_evtmousewheel.h"
-#include "xfa/fwl/core/cfwl_evtsetfocus.h"
-#include "xfa/fwl/core/cfwl_evtsizechanged.h"
#include "xfa/fwl/core/cfwl_form.h"
#include "xfa/fwl/core/cfwl_msgkey.h"
#include "xfa/fwl/core/cfwl_msgkillfocus.h"
@@ -86,21 +82,10 @@ void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
}
void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
- CFX_RectF rtOld = m_pProperties->m_rtWidget;
m_pProperties->m_rtWidget = rect;
- if (IsChild()) {
- if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f ||
- FXSYS_fabs(rtOld.height - rect.height) > 0.5f) {
- CFWL_EvtSizeChanged ev;
- ev.m_pSrcTarget = this;
- ev.m_rtOld = rtOld;
- ev.m_rtNew = rect;
-
- if (IFWL_WidgetDelegate* pDelegate = GetDelegate())
- pDelegate->OnProcessEvent(&ev);
- }
+ if (IsChild())
return;
- }
+
m_pWidgetMgr->SetWidgetRect_Native(this, rect);
}
@@ -598,18 +583,6 @@ void CFWL_Widget::UnregisterEventTarget() {
pNoteDriver->UnregisterEventTarget(this);
}
-void CFWL_Widget::DispatchKeyEvent(CFWL_MsgKey* pNote) {
- if (!pNote)
- return;
-
- auto pEvent = pdfium::MakeUnique<CFWL_EvtKey>();
- pEvent->m_pSrcTarget = this;
- pEvent->m_dwCmd = pNote->m_dwCmd;
- pEvent->m_dwKeyCode = pNote->m_dwKeyCode;
- pEvent->m_dwFlags = pNote->m_dwFlags;
- DispatchEvent(pEvent.get());
-}
-
void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
if (m_pOuter) {
m_pOuter->GetDelegate()->OnProcessEvent(pEvent);
@@ -741,53 +714,6 @@ void CFWL_Widget::OnProcessMessage(CFWL_Message* pMessage) {
evt.m_pSrcTarget = pWidget;
evt.m_pDstTarget = pWidget;
evt.m_dwCmd = pMsgMouse->m_dwCmd;
- evt.m_dwFlags = pMsgMouse->m_dwFlags;
- evt.m_fx = pMsgMouse->m_fx;
- evt.m_fy = pMsgMouse->m_fy;
- pWidget->DispatchEvent(&evt);
- break;
- }
- case CFWL_MessageType::MouseWheel: {
- CFWL_MsgMouseWheel* pMsgMouseWheel =
- static_cast<CFWL_MsgMouseWheel*>(pMessage);
- CFWL_EvtMouseWheel evt;
- evt.m_pSrcTarget = pWidget;
- evt.m_pDstTarget = pWidget;
- evt.m_dwFlags = pMsgMouseWheel->m_dwFlags;
- evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX;
- evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY;
- evt.m_fx = pMsgMouseWheel->m_fx;
- evt.m_fy = pMsgMouseWheel->m_fy;
- pWidget->DispatchEvent(&evt);
- break;
- }
- case CFWL_MessageType::Key: {
- CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
- CFWL_EvtKey evt;
- evt.m_pSrcTarget = pWidget;
- evt.m_pDstTarget = pWidget;
- evt.m_dwKeyCode = pMsgKey->m_dwKeyCode;
- evt.m_dwFlags = pMsgKey->m_dwFlags;
- evt.m_dwCmd = pMsgKey->m_dwCmd;
- pWidget->DispatchEvent(&evt);
- break;
- }
- case CFWL_MessageType::SetFocus: {
- CFWL_MsgSetFocus* pMsgSetFocus = static_cast<CFWL_MsgSetFocus*>(pMessage);
- CFWL_EvtSetFocus evt;
- evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget;
- evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget;
- evt.m_pSetFocus = pWidget;
- pWidget->DispatchEvent(&evt);
- break;
- }
- case CFWL_MessageType::KillFocus: {
- CFWL_MsgKillFocus* pMsgKillFocus =
- static_cast<CFWL_MsgKillFocus*>(pMessage);
- CFWL_EvtKillFocus evt;
- evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget;
- evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget;
- evt.m_pKillFocus = pWidget;
pWidget->DispatchEvent(&evt);
break;
}
« xfa/fwl/core/cfwl_message.h ('K') | « xfa/fwl/core/cfwl_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698