diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-16 14:25:01 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-16 14:25:01 -0800 |
commit | 242b95e2a9df3b57dd9aa28adea58ad51f84a221 (patch) | |
tree | 001948a117ff48e77af6351c505a9e41951d7a4e /xfa | |
parent | 058d2d6b7851b77a371bb4d37d5da1148794397a (diff) | |
download | pdfium-242b95e2a9df3b57dd9aa28adea58ad51f84a221.tar.xz |
Move the message definitions to their own files.chromium/2923
Currently the CFWL messages are created by a macro in the CFWL_Message header
file. This Cl splits out the class to their own files and writes them directly
instead of using the macro.
Review-Url: https://codereview.chromium.org/2510823003
Diffstat (limited to 'xfa')
39 files changed, 353 insertions, 148 deletions
diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 4b74c02930..e7bc15ad58 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -10,7 +10,8 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/fwl_error.h" enum class FWL_SCBCODE { diff --git a/xfa/fwl/core/cfwl_message.cpp b/xfa/fwl/core/cfwl_message.cpp new file mode 100644 index 0000000000..e233900d6e --- /dev/null +++ b/xfa/fwl/core/cfwl_message.cpp @@ -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 + +#include "xfa/fwl/core/cfwl_message.h" + +CFWL_Message::CFWL_Message() + : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwExtend(0) {} + +CFWL_Message::~CFWL_Message() {} + +std::unique_ptr<CFWL_Message> CFWL_Message::Clone() { + return nullptr; +} + +CFWL_MessageType CFWL_Message::GetClassID() const { + return CFWL_MessageType::None; +} diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 56e8185c29..1ad43a6d89 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_CORE_CFWL_MESSAGE_H_ #define XFA_FWL_CORE_CFWL_MESSAGE_H_ +#include <memory> + #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" @@ -21,21 +23,6 @@ enum class CFWL_MessageType { SetFocus }; -enum class FWL_MouseCommand { - LeftButtonDown, - LeftButtonUp, - LeftButtonDblClk, - RightButtonDown, - RightButtonUp, - RightButtonDblClk, - Move, - Enter, - Leave, - Hover -}; - -enum class FWL_KeyCommand { KeyDown, KeyUp, Char }; - class IFWL_Widget; class CFWL_Message { @@ -43,84 +30,13 @@ class CFWL_Message { CFWL_Message(); virtual ~CFWL_Message(); - virtual CFWL_Message* Clone(); + virtual std::unique_ptr<CFWL_Message> Clone(); virtual CFWL_MessageType GetClassID() const; - uint32_t Release(); - CFWL_Message* Retain(); - IFWL_Widget* m_pSrcTarget; IFWL_Widget* m_pDstTarget; uint32_t m_dwExtend; - - private: - uint32_t m_dwRefCount; }; -inline CFWL_Message::CFWL_Message() - : m_pSrcTarget(nullptr), - m_pDstTarget(nullptr), - m_dwExtend(0), - m_dwRefCount(1) {} - -inline CFWL_Message::~CFWL_Message() {} - -inline CFWL_Message* CFWL_Message::Clone() { - return nullptr; -} - -inline CFWL_MessageType CFWL_Message::GetClassID() const { - return CFWL_MessageType::None; -} - -inline uint32_t CFWL_Message::Release() { - m_dwRefCount--; - uint32_t dwRefCount = m_dwRefCount; - if (!m_dwRefCount) - delete this; - return dwRefCount; -} - -inline CFWL_Message* CFWL_Message::Retain() { - m_dwRefCount++; - return this; -} - -#define FWL_MESSAGE_DEF(classname, msgType, ...) \ - class classname : public CFWL_Message { \ - public: \ - classname(); \ - ~classname() override; \ - CFWL_Message* Clone() override; \ - CFWL_MessageType GetClassID() const override; \ - __VA_ARGS__ \ - }; \ - inline classname::classname() {} \ - inline classname::~classname() {} \ - inline CFWL_Message* classname::Clone() { return new classname(*this); } \ - inline CFWL_MessageType classname::GetClassID() const { return msgType; } - -FWL_MESSAGE_DEF(CFWL_MsgMouse, CFWL_MessageType::Mouse, FX_FLOAT m_fx; - FX_FLOAT m_fy; - uint32_t m_dwFlags; - FWL_MouseCommand m_dwCmd;) - -FWL_MESSAGE_DEF(CFWL_MsgMouseWheel, CFWL_MessageType::MouseWheel, FX_FLOAT m_fx; - FX_FLOAT m_fy; - FX_FLOAT m_fDeltaX; - FX_FLOAT m_fDeltaY; - uint32_t m_dwFlags;) - -FWL_MESSAGE_DEF(CFWL_MsgSetFocus, - CFWL_MessageType::SetFocus, - IFWL_Widget* m_pKillFocus;) - -FWL_MESSAGE_DEF(CFWL_MsgKillFocus, - CFWL_MessageType::KillFocus, - IFWL_Widget* m_pSetFocus;) - -FWL_MESSAGE_DEF(CFWL_MsgKey, CFWL_MessageType::Key, uint32_t m_dwKeyCode; - uint32_t m_dwFlags; - FWL_KeyCommand m_dwCmd;) #endif // XFA_FWL_CORE_CFWL_MESSAGE_H_ diff --git a/xfa/fwl/core/cfwl_msgkey.cpp b/xfa/fwl/core/cfwl_msgkey.cpp new file mode 100644 index 0000000000..0163da9e8d --- /dev/null +++ b/xfa/fwl/core/cfwl_msgkey.cpp @@ -0,0 +1,21 @@ +// 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_msgkey.h" + +#include "third_party/base/ptr_util.h" + +CFWL_MsgKey::CFWL_MsgKey() {} + +CFWL_MsgKey::~CFWL_MsgKey() {} + +std::unique_ptr<CFWL_Message> CFWL_MsgKey::Clone() { + return pdfium::MakeUnique<CFWL_MsgKey>(*this); +} + +CFWL_MessageType CFWL_MsgKey::GetClassID() const { + return CFWL_MessageType::Key; +} diff --git a/xfa/fwl/core/cfwl_msgkey.h b/xfa/fwl/core/cfwl_msgkey.h new file mode 100644 index 0000000000..492e53fdfb --- /dev/null +++ b/xfa/fwl/core/cfwl_msgkey.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_MSGKEY_H_ +#define XFA_FWL_CORE_CFWL_MSGKEY_H_ + +#include "xfa/fwl/core/cfwl_message.h" + +enum class FWL_KeyCommand { KeyDown, KeyUp, Char }; + +class CFWL_MsgKey : public CFWL_Message { + public: + CFWL_MsgKey(); + ~CFWL_MsgKey() override; + + // CFWL_Message + std::unique_ptr<CFWL_Message> Clone() override; + CFWL_MessageType GetClassID() const override; + + uint32_t m_dwKeyCode; + uint32_t m_dwFlags; + FWL_KeyCommand m_dwCmd; +}; + +#endif // XFA_FWL_CORE_CFWL_MSGKEY_H_ diff --git a/xfa/fwl/core/cfwl_msgkillfocus.cpp b/xfa/fwl/core/cfwl_msgkillfocus.cpp new file mode 100644 index 0000000000..c2407edfef --- /dev/null +++ b/xfa/fwl/core/cfwl_msgkillfocus.cpp @@ -0,0 +1,21 @@ +// 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_msgkillfocus.h" + +#include "third_party/base/ptr_util.h" + +CFWL_MsgKillFocus::CFWL_MsgKillFocus() {} + +CFWL_MsgKillFocus::~CFWL_MsgKillFocus() {} + +std::unique_ptr<CFWL_Message> CFWL_MsgKillFocus::Clone() { + return pdfium::MakeUnique<CFWL_MsgKillFocus>(*this); +} + +CFWL_MessageType CFWL_MsgKillFocus::GetClassID() const { + return CFWL_MessageType::KillFocus; +} diff --git a/xfa/fwl/core/cfwl_msgkillfocus.h b/xfa/fwl/core/cfwl_msgkillfocus.h new file mode 100644 index 0000000000..d2a1f20db4 --- /dev/null +++ b/xfa/fwl/core/cfwl_msgkillfocus.h @@ -0,0 +1,24 @@ +// 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_MSGKILLFOCUS_H_ +#define XFA_FWL_CORE_CFWL_MSGKILLFOCUS_H_ + +#include "xfa/fwl/core/cfwl_message.h" + +class CFWL_MsgKillFocus : public CFWL_Message { + public: + CFWL_MsgKillFocus(); + ~CFWL_MsgKillFocus() override; + + // CFWL_Message + std::unique_ptr<CFWL_Message> Clone() override; + CFWL_MessageType GetClassID() const override; + + IFWL_Widget* m_pSetFocus; +}; + +#endif // XFA_FWL_CORE_CFWL_MSGKILLFOCUS_H_ diff --git a/xfa/fwl/core/cfwl_msgmouse.cpp b/xfa/fwl/core/cfwl_msgmouse.cpp new file mode 100644 index 0000000000..ff28cdc9c8 --- /dev/null +++ b/xfa/fwl/core/cfwl_msgmouse.cpp @@ -0,0 +1,21 @@ +// 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_msgmouse.h" + +#include "third_party/base/ptr_util.h" + +CFWL_MsgMouse::CFWL_MsgMouse() {} + +CFWL_MsgMouse::~CFWL_MsgMouse() {} + +std::unique_ptr<CFWL_Message> CFWL_MsgMouse::Clone() { + return pdfium::MakeUnique<CFWL_MsgMouse>(*this); +} + +CFWL_MessageType CFWL_MsgMouse::GetClassID() const { + return CFWL_MessageType::Mouse; +} diff --git a/xfa/fwl/core/cfwl_msgmouse.h b/xfa/fwl/core/cfwl_msgmouse.h new file mode 100644 index 0000000000..c617ac1d42 --- /dev/null +++ b/xfa/fwl/core/cfwl_msgmouse.h @@ -0,0 +1,40 @@ +// 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_MSGMOUSE_H_ +#define XFA_FWL_CORE_CFWL_MSGMOUSE_H_ + +#include "xfa/fwl/core/cfwl_message.h" + +enum class FWL_MouseCommand { + LeftButtonDown, + LeftButtonUp, + LeftButtonDblClk, + RightButtonDown, + RightButtonUp, + RightButtonDblClk, + Move, + Enter, + Leave, + Hover +}; + +class CFWL_MsgMouse : public CFWL_Message { + public: + CFWL_MsgMouse(); + ~CFWL_MsgMouse() override; + + // CFWL_Message + std::unique_ptr<CFWL_Message> Clone() override; + CFWL_MessageType GetClassID() const override; + + FX_FLOAT m_fx; + FX_FLOAT m_fy; + uint32_t m_dwFlags; + FWL_MouseCommand m_dwCmd; +}; + +#endif // XFA_FWL_CORE_CFWL_MSGMOUSE_H_ diff --git a/xfa/fwl/core/cfwl_msgmousewheel.cpp b/xfa/fwl/core/cfwl_msgmousewheel.cpp new file mode 100644 index 0000000000..b5cbd14da0 --- /dev/null +++ b/xfa/fwl/core/cfwl_msgmousewheel.cpp @@ -0,0 +1,21 @@ +// 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_msgmousewheel.h" + +#include "third_party/base/ptr_util.h" + +CFWL_MsgMouseWheel::CFWL_MsgMouseWheel() {} + +CFWL_MsgMouseWheel::~CFWL_MsgMouseWheel() {} + +std::unique_ptr<CFWL_Message> CFWL_MsgMouseWheel::Clone() { + return pdfium::MakeUnique<CFWL_MsgMouseWheel>(*this); +} + +CFWL_MessageType CFWL_MsgMouseWheel::GetClassID() const { + return CFWL_MessageType::MouseWheel; +} diff --git a/xfa/fwl/core/cfwl_msgmousewheel.h b/xfa/fwl/core/cfwl_msgmousewheel.h new file mode 100644 index 0000000000..c913eae42c --- /dev/null +++ b/xfa/fwl/core/cfwl_msgmousewheel.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_MSGMOUSEWHEEL_H_ +#define XFA_FWL_CORE_CFWL_MSGMOUSEWHEEL_H_ + +#include "xfa/fwl/core/cfwl_message.h" + +class CFWL_MsgMouseWheel : public CFWL_Message { + public: + CFWL_MsgMouseWheel(); + ~CFWL_MsgMouseWheel() override; + + // CFWL_Message + std::unique_ptr<CFWL_Message> Clone() override; + CFWL_MessageType GetClassID() const override; + + FX_FLOAT m_fx; + FX_FLOAT m_fy; + FX_FLOAT m_fDeltaX; + FX_FLOAT m_fDeltaY; + uint32_t m_dwFlags; +}; + +#endif // XFA_FWL_CORE_CFWL_MSGMOUSEWHEEL_H_ diff --git a/xfa/fwl/core/cfwl_msgsetfocus.cpp b/xfa/fwl/core/cfwl_msgsetfocus.cpp new file mode 100644 index 0000000000..7fe3501a6a --- /dev/null +++ b/xfa/fwl/core/cfwl_msgsetfocus.cpp @@ -0,0 +1,21 @@ +// 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_msgsetfocus.h" + +#include "third_party/base/ptr_util.h" + +CFWL_MsgSetFocus::CFWL_MsgSetFocus() {} + +CFWL_MsgSetFocus::~CFWL_MsgSetFocus() {} + +std::unique_ptr<CFWL_Message> CFWL_MsgSetFocus::Clone() { + return pdfium::MakeUnique<CFWL_MsgSetFocus>(*this); +} + +CFWL_MessageType CFWL_MsgSetFocus::GetClassID() const { + return CFWL_MessageType::SetFocus; +} diff --git a/xfa/fwl/core/cfwl_msgsetfocus.h b/xfa/fwl/core/cfwl_msgsetfocus.h new file mode 100644 index 0000000000..ffcf5b3539 --- /dev/null +++ b/xfa/fwl/core/cfwl_msgsetfocus.h @@ -0,0 +1,24 @@ +// 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_MSGSETFOCUS_H_ +#define XFA_FWL_CORE_CFWL_MSGSETFOCUS_H_ + +#include "xfa/fwl/core/cfwl_message.h" + +class CFWL_MsgSetFocus : public CFWL_Message { + public: + CFWL_MsgSetFocus(); + ~CFWL_MsgSetFocus() override; + + // CFWL_Message + std::unique_ptr<CFWL_Message> Clone() override; + CFWL_MessageType GetClassID() const override; + + IFWL_Widget* m_pKillFocus; +}; + +#endif // XFA_FWL_CORE_CFWL_MSGSETFOCUS_H_ diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index 5ef17907aa..9172d7918a 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -6,7 +6,6 @@ #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_form.h" @@ -474,23 +473,17 @@ void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) { if (!pNoteDriver) return; - if (IsThreadEnabled()) - pMessage = static_cast<CFWL_Message*>(pMessage->Clone()); + std::unique_ptr<CFWL_Message> pClonedMessage = pMessage->Clone(); if (IsFormDisabled()) - pNoteDriver->ProcessMessage(pMessage); + pNoteDriver->ProcessMessage(pClonedMessage.get()); else - pNoteDriver->QueueMessage(pMessage); + pNoteDriver->QueueMessage(std::move(pClonedMessage)); #if (_FX_OS_ == _FX_MACOSX_) CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); if (pTopLoop) pNoteDriver->UnqueueMessage(pTopLoop); #endif - - if (IsThreadEnabled()) - pMessage->Release(); - - return; } void CFWL_WidgetMgr::OnDrawWidget(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_widgetmgr.h b/xfa/fwl/core/cfwl_widgetmgr.h index 10176c2598..cdfa24a91d 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.h +++ b/xfa/fwl/core/cfwl_widgetmgr.h @@ -14,7 +14,6 @@ #include "xfa/fwl/core/fwl_error.h" #include "xfa/fxgraphics/cfx_graphics.h" -#define FWL_WGTMGR_DisableThread 0x00000001 #define FWL_WGTMGR_DisableForm 0x00000002 class CFWL_Message; @@ -45,8 +44,7 @@ class CFWL_WidgetMgrItem { class IFWL_WidgetMgrDelegate { public: - virtual void OnSetCapability( - uint32_t dwCapability = FWL_WGTMGR_DisableThread) = 0; + virtual void OnSetCapability(uint32_t dwCapability) = 0; virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; virtual void OnDrawWidget(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, @@ -59,8 +57,7 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { ~CFWL_WidgetMgr(); // IFWL_WidgetMgrDelegate - void OnSetCapability( - uint32_t dwCapability = FWL_WGTMGR_DisableThread) override; + void OnSetCapability(uint32_t dwCapability) override; void OnProcessMessageToForm(CFWL_Message* pMessage) override; void OnDrawWidget(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, @@ -117,10 +114,6 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { void ResetRedrawCounts(IFWL_Widget* pWidget); - bool IsThreadEnabled() const { - return !(m_dwCapability & FWL_WGTMGR_DisableThread); - } - void DrawChild(IFWL_Widget* pParent, const CFX_RectF& rtClip, CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 1e2b7bf479..857fdfbac6 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -9,7 +9,11 @@ #include "core/fxcrt/fx_ext.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgmousewheel.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_tooltip.h" @@ -182,23 +186,21 @@ void CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { m_forms.RemoveAt(nIndex); } -void CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { - pMessage->Retain(); - m_noteQueue.Add(pMessage); +void CFWL_NoteDriver::QueueMessage(std::unique_ptr<CFWL_Message> pMessage) { + m_noteQueue.push_back(std::move(pMessage)); } void CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { - if (m_noteQueue.GetSize() < 1) + if (m_noteQueue.empty()) return; - CFWL_Message* pMessage = m_noteQueue[0]; - m_noteQueue.RemoveAt(0); - if (!IsValidMessage(pMessage)) { - pMessage->Release(); + std::unique_ptr<CFWL_Message> pMessage = std::move(m_noteQueue[0]); + m_noteQueue.pop_front(); + + if (!IsValidMessage(pMessage.get())) return; - } - ProcessMessage(pMessage); - pMessage->Release(); + + ProcessMessage(pMessage.get()); } CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const { diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 9eaaed596f..ec7855dec6 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -7,11 +7,11 @@ #ifndef XFA_FWL_CORE_FWL_NOTEIMP_H_ #define XFA_FWL_CORE_FWL_NOTEIMP_H_ +#include <deque> #include <memory> #include <unordered_map> #include "xfa/fwl/core/cfwl_event.h" -#include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/ifwl_tooltip.h" #include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxgraphics/cfx_graphics.h" @@ -67,7 +67,7 @@ class CFWL_NoteDriver { void RegisterForm(IFWL_Widget* pForm); void UnRegisterForm(IFWL_Widget* pForm); - void QueueMessage(CFWL_Message* pMessage); + void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); void ProcessMessage(CFWL_Message* pMessage); @@ -84,7 +84,7 @@ class CFWL_NoteDriver { IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); CFX_ArrayTemplate<IFWL_Widget*> m_forms; - CFX_ArrayTemplate<CFWL_Message*> m_noteQueue; + std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue; CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; IFWL_Widget* m_pHover; diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index 6c548014f5..62bf636796 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -10,7 +10,8 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index c26a9fc9f1..f47e4a1a5e 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -9,7 +9,10 @@ #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_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" diff --git a/xfa/fwl/core/ifwl_comboboxproxy.cpp b/xfa/fwl/core/ifwl_comboboxproxy.cpp index 4bc1e294d4..03bfca2727 100644 --- a/xfa/fwl/core/ifwl_comboboxproxy.cpp +++ b/xfa/fwl/core/ifwl_comboboxproxy.cpp @@ -6,6 +6,8 @@ #include "xfa/fwl/core/ifwl_comboboxproxy.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_combobox.h" @@ -42,10 +44,10 @@ void IFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) { break; } case CFWL_MessageType::KillFocus: - OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), false); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::SetFocus: - OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), true); + OnFocusChanged(pMessage, true); break; default: break; @@ -58,7 +60,7 @@ void IFWL_ComboBoxProxy::OnDrawWidget(CFX_Graphics* pGraphics, m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); } -void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) { +void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) { const IFWL_App* pApp = GetOwnerApp(); if (!pApp) return; @@ -68,6 +70,8 @@ void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) { CFX_RectF rtWidget; GetWidgetRect(rtWidget); rtWidget.left = rtWidget.top = 0; + + CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { m_bLButtonDown = true; pDriver->SetGrab(this, true); @@ -78,7 +82,7 @@ void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) { } } -void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) { +void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) { m_bLButtonDown = false; const IFWL_App* pApp = GetOwnerApp(); if (!pApp) @@ -92,6 +96,7 @@ void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) { return; } + CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); CFX_RectF rect; GetWidgetRect(rect); rect.left = rect.top = 0; @@ -101,9 +106,11 @@ void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) { } } -void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_MsgKillFocus* pMsg, bool bSet) { +void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_Message* pMessage, bool bSet) { if (bSet) return; + + CFWL_MsgKillFocus* pMsg = static_cast<CFWL_MsgKillFocus*>(pMessage); if (!pMsg->m_pSetFocus) m_pComboBox->ShowDropList(false); } diff --git a/xfa/fwl/core/ifwl_comboboxproxy.h b/xfa/fwl/core/ifwl_comboboxproxy.h index 243937726f..7ff56232f8 100644 --- a/xfa/fwl/core/ifwl_comboboxproxy.h +++ b/xfa/fwl/core/ifwl_comboboxproxy.h @@ -27,9 +27,9 @@ class IFWL_ComboBoxProxy : public IFWL_FormProxy { void Reset() { m_bLButtonUpSelf = false; } private: - void OnLButtonDown(CFWL_MsgMouse* pMsg); - void OnLButtonUp(CFWL_MsgMouse* pMsg); - void OnFocusChanged(CFWL_MsgKillFocus* pMsg, bool bSet); + void OnLButtonDown(CFWL_Message* pMsg); + void OnLButtonUp(CFWL_Message* pMsg); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); bool m_bLButtonDown; bool m_bLButtonUpSelf; diff --git a/xfa/fwl/core/ifwl_comboedit.cpp b/xfa/fwl/core/ifwl_comboedit.cpp index 73ca14627f..965ba009f2 100644 --- a/xfa/fwl/core/ifwl_comboedit.cpp +++ b/xfa/fwl/core/ifwl_comboedit.cpp @@ -7,6 +7,7 @@ #include "xfa/fwl/core/ifwl_comboedit.h" #include "xfa/fde/cfde_txtedtengine.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/ifwl_combobox.h" IFWL_ComboEdit::IFWL_ComboEdit( diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp index 13847ee093..be167be177 100644 --- a/xfa/fwl/core/ifwl_combolist.cpp +++ b/xfa/fwl/core/ifwl_combolist.cpp @@ -7,6 +7,9 @@ #include "xfa/fwl/core/ifwl_combolist.h" #include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_comboedit.h" diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp index f612f504cd..636209754c 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.cpp +++ b/xfa/fwl/core/ifwl_datetimeedit.cpp @@ -7,6 +7,7 @@ #include "xfa/fwl/core/ifwl_datetimeedit.h" #include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/ifwl_datetimepicker.h" diff --git a/xfa/fwl/core/ifwl_datetimeedit.h b/xfa/fwl/core/ifwl_datetimeedit.h index 1649d39539..71745500b0 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.h +++ b/xfa/fwl/core/ifwl_datetimeedit.h @@ -7,7 +7,6 @@ #ifndef XFA_FWL_CORE_IFWL_DATETIMEEDIT_H_ #define XFA_FWL_CORE_IFWL_DATETIMEEDIT_H_ -#include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" #include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_edit.h" diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index 71ff7efbc9..1cd96c6925 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -7,7 +7,8 @@ #include "xfa/fwl/core/ifwl_datetimepicker.h" #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index 65a54dc57a..b3b2e1ca8a 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -17,7 +17,8 @@ #include "xfa/fde/fde_render.h" #include "xfa/fde/ifde_txtedtpage.h" #include "xfa/fgas/font/fgas_gefont.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index 989da199e1..616ec770a2 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -8,7 +8,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index 6696d4ce9e..1f5a50c4c8 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -8,7 +8,9 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgmousewheel.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index c5c7780b57..8be738399c 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -10,7 +10,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index 387a01af1f..414c144c42 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -8,7 +8,8 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index db2164be23..78360d005d 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -7,7 +7,8 @@ #include "xfa/fwl/core/ifwl_scrollbar.h" #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgmousewheel.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index 6ae2f6aa65..f3b8e486a8 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -7,7 +7,8 @@ #include "xfa/fwl/core/ifwl_spinbutton.h" #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index b885210015..f8288eb0e4 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -9,7 +9,11 @@ #include <algorithm> #include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgmousewheel.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index b38e59090e..d65a611eb9 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -134,8 +134,7 @@ CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr( IFWL_WidgetMgrDelegate* pDelegate) { if (!m_pAdapterWidgetMgr) { m_pAdapterWidgetMgr.reset(new CXFA_FWLAdapterWidgetMgr); - pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | - FWL_WGTMGR_DisableForm); + pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm); m_pWidgetMgrDelegate = pDelegate; } return m_pAdapterWidgetMgr.get(); diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 391d76ca49..39bfe50e2f 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fwl/core/cfwl_checkbox.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fxfa/app/xfa_ffexclgroup.h" diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 073e99786a..83a4c62a16 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -7,7 +7,11 @@ #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fwl/core/cfwl_edit.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkey.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgmousewheel.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_picturebox.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/ifwl_edit.h" diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 216cf5b9bf..1cbb9bc5c7 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/app/xfa_ffimageedit.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_picturebox.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index e851cb29c2..1c6c28352b 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -10,7 +10,9 @@ #include "xfa/fwl/core/cfwl_datetimepicker.h" #include "xfa/fwl/core/cfwl_edit.h" -#include "xfa/fwl/core/cfwl_message.h" +#include "xfa/fwl/core/cfwl_msgkillfocus.h" +#include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_edit.h" #include "xfa/fxfa/app/xfa_fffield.h" |