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

Unified Diff: xfa/fwl/core/cfwl_message.h

Issue 2510823003: Move the message definitions to their own files. (Closed)
Patch Set: Review feedback Created 4 years, 1 month 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
« no previous file with comments | « xfa/fwl/core/cfwl_event.h ('k') | xfa/fwl/core/cfwl_message.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/cfwl_message.h
diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h
index 56e8185c2958adcc5ed7a70dd05fc3b4cb108d68..1ad43a6d89332f0786e70192c50266fe48918516 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_
« no previous file with comments | « xfa/fwl/core/cfwl_event.h ('k') | xfa/fwl/core/cfwl_message.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698