summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_message.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-16 14:25:01 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-16 14:25:01 -0800
commit242b95e2a9df3b57dd9aa28adea58ad51f84a221 (patch)
tree001948a117ff48e77af6351c505a9e41951d7a4e /xfa/fwl/core/cfwl_message.h
parent058d2d6b7851b77a371bb4d37d5da1148794397a (diff)
downloadpdfium-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/fwl/core/cfwl_message.h')
-rw-r--r--xfa/fwl/core/cfwl_message.h90
1 files changed, 3 insertions, 87 deletions
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_