summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_message.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-18 06:21:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-18 06:21:57 -0700
commit4ce94e118d66064715de5baebeb4b2b580dcac66 (patch)
treeba74181eb90675172d3c7f4be8e71ada3fbc9125 /xfa/fwl/core/cfwl_message.h
parent2fad11a8d9d2704cd9ee28b02373ad7ce19c65e3 (diff)
downloadpdfium-4ce94e118d66064715de5baebeb4b2b580dcac66.tar.xz
Make code compile with clang_use_chrome_plugin (part VI)
This change mainly contains files in xfa/fwl directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2070583003
Diffstat (limited to 'xfa/fwl/core/cfwl_message.h')
-rw-r--r--xfa/fwl/core/cfwl_message.h231
1 files changed, 124 insertions, 107 deletions
diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h
index 74401c3e34..db434fc1fb 100644
--- a/xfa/fwl/core/cfwl_message.h
+++ b/xfa/fwl/core/cfwl_message.h
@@ -53,31 +53,15 @@ class IFWL_Widget;
class CFWL_Message {
public:
- CFWL_Message()
- : m_pSrcTarget(nullptr),
- m_pDstTarget(nullptr),
- m_dwExtend(0),
- m_dwRefCount(1) {}
- virtual ~CFWL_Message() {}
-
- virtual CFWL_Message* Clone() { return nullptr; }
- virtual FWL_Error GetClassName(CFX_WideString& wsClass) const {
- return FWL_Error::Succeeded;
- }
- virtual CFWL_MessageType GetClassID() const { return CFWL_MessageType::None; }
-
- uint32_t Release() {
- m_dwRefCount--;
- uint32_t dwRefCount = m_dwRefCount;
- if (!m_dwRefCount)
- delete this;
- return dwRefCount;
- }
-
- CFWL_Message* Retain() {
- m_dwRefCount++;
- return this;
- }
+ CFWL_Message();
+ virtual ~CFWL_Message();
+
+ virtual CFWL_Message* Clone();
+ virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
+ virtual CFWL_MessageType GetClassID() const;
+
+ uint32_t Release();
+ CFWL_Message* Retain();
IFWL_Widget* m_pSrcTarget;
IFWL_Widget* m_pDstTarget;
@@ -87,91 +71,124 @@ class CFWL_Message {
uint32_t m_dwRefCount;
};
-#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \
- class classname : public CFWL_Message { \
- public: \
- classname() : CFWL_Message() {} \
- CFWL_Message* Clone() override { return new classname(*this); } \
- FWL_Error GetClassName(CFX_WideString& wsClass) const override { \
- wsClass = L## #classname; \
- return FWL_Error::Succeeded; \
- } \
- CFWL_MessageType GetClassID() const override { return msgType; }
-
-#define END_FWL_MESSAGE_DEF \
- } \
- ; // NOLINT
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgActivate, CFWL_MessageType::Activate)
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgDeactivate, CFWL_MessageType::Deactivate)
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgMouse, CFWL_MessageType::Mouse)
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-uint32_t m_dwFlags;
-FWL_MouseCommand m_dwCmd;
-END_FWL_MESSAGE_DEF
-
-BEGIN_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;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgSetFocus, CFWL_MessageType::SetFocus)
-IFWL_Widget* m_pKillFocus;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgKillFocus, CFWL_MessageType::KillFocus)
-IFWL_Widget* m_pSetFocus;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgKey, CFWL_MessageType::Key)
-uint32_t m_dwKeyCode;
-uint32_t m_dwFlags;
-FWL_KeyCommand m_dwCmd;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgCursor, CFWL_MessageType::Cursor)
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgSize, CFWL_MessageType::Size)
-int32_t m_iWidth;
-int32_t m_iHeight;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgWindowMove, CFWL_MessageType::WindowMove)
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-END_FWL_MESSAGE_DEF
-
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgDropFiles, CFWL_MessageType::DropFiles)
-CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy) {
- m_pDstTarget = copy.m_pDstTarget;
- m_pSrcTarget = copy.m_pSrcTarget;
- m_fx = copy.m_fx;
- m_fy = copy.m_fy;
- m_files.Append(copy.m_files);
+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 FWL_Error CFWL_Message::GetClassName(CFX_WideString& wsClass) const {
+ return FWL_Error::Succeeded;
}
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-CFX_WideStringArray m_files;
-END_FWL_MESSAGE_DEF
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgTaskClicked, CFWL_MessageType::TaskClicked)
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-END_FWL_MESSAGE_DEF
+inline CFWL_MessageType CFWL_Message::GetClassID() const {
+ return CFWL_MessageType::None;
+}
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgClose, CFWL_MessageType::Close)
-END_FWL_MESSAGE_DEF
+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;
+}
-BEGIN_FWL_MESSAGE_DEF(CFWL_MsgWindowWillMove, CFWL_MessageType::WindowWillMove)
-END_FWL_MESSAGE_DEF
+#define FWL_MESSAGE_CLASS_DEF(classname, msgType, ...) \
+ class classname : public CFWL_Message { \
+ public: \
+ classname(); \
+ ~classname() override; \
+ CFWL_Message* Clone() override; \
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override; \
+ CFWL_MessageType GetClassID() const override; \
+ __VA_ARGS__ \
+ };
+
+#define FWL_MESSAGE_FUNCTION_DEF(classname, msgType, ...) \
+ inline classname::classname() {} \
+ inline classname::~classname() {} \
+ inline CFWL_Message* classname::Clone() { return new classname(*this); } \
+ inline FWL_Error classname::GetClassName(CFX_WideString& wsClass) const { \
+ wsClass = L## #classname; \
+ return FWL_Error::Succeeded; \
+ } \
+ inline CFWL_MessageType classname::GetClassID() const { return msgType; } \
+ __VA_ARGS__
+
+#define FWL_MESSAGE_DEF(classname, msgType, ...) \
+ FWL_MESSAGE_CLASS_DEF(classname, msgType, __VA_ARGS__) \
+ FWL_MESSAGE_FUNCTION_DEF(classname, msgType)
+
+FWL_MESSAGE_DEF(CFWL_MsgActivate, CFWL_MessageType::Activate)
+
+FWL_MESSAGE_DEF(CFWL_MsgDeactivate, CFWL_MessageType::Deactivate)
+
+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;)
+
+FWL_MESSAGE_DEF(CFWL_MsgCursor, CFWL_MessageType::Cursor)
+
+FWL_MESSAGE_DEF(CFWL_MsgSize, CFWL_MessageType::Size, int32_t m_iWidth;
+ int32_t m_iHeight;)
+
+FWL_MESSAGE_DEF(CFWL_MsgWindowMove, CFWL_MessageType::WindowMove, FX_FLOAT m_fx;
+ FX_FLOAT m_fy;)
+
+FWL_MESSAGE_CLASS_DEF(CFWL_MsgDropFiles,
+ CFWL_MessageType::DropFiles,
+ CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy);
+ FX_FLOAT m_fx;
+ FX_FLOAT m_fy;
+ CFX_WideStringArray m_files;)
+FWL_MESSAGE_FUNCTION_DEF(
+ CFWL_MsgDropFiles,
+ CFWL_MessageType::DropFiles,
+ inline CFWL_MsgDropFiles::CFWL_MsgDropFiles(const CFWL_MsgDropFiles& copy) {
+ m_pDstTarget = copy.m_pDstTarget;
+ m_pSrcTarget = copy.m_pSrcTarget;
+ m_fx = copy.m_fx;
+ m_fy = copy.m_fy;
+ m_files.Append(copy.m_files);
+ })
+
+FWL_MESSAGE_DEF(CFWL_MsgTaskClicked,
+ CFWL_MessageType::TaskClicked,
+ FX_FLOAT m_fx;
+ FX_FLOAT m_fy;)
+
+FWL_MESSAGE_DEF(CFWL_MsgClose, CFWL_MessageType::Close)
+
+FWL_MESSAGE_DEF(CFWL_MsgWindowWillMove, CFWL_MessageType::WindowWillMove)
#endif // XFA_FWL_CORE_CFWL_MESSAGE_H_