| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FWL_CORE_CFWL_EVENT_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_EVENT_H_ |
| 8 #define XFA_FWL_CORE_CFWL_EVENT_H_ | 8 #define XFA_FWL_CORE_CFWL_EVENT_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_coordinates.h" | 10 #include "core/fxcrt/fx_coordinates.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class CFX_Graphics; | 64 class CFX_Graphics; |
| 65 class IFWL_Widget; | 65 class IFWL_Widget; |
| 66 | 66 |
| 67 class CFWL_Event { | 67 class CFWL_Event { |
| 68 public: | 68 public: |
| 69 CFWL_Event(); | 69 CFWL_Event(); |
| 70 virtual ~CFWL_Event(); | 70 virtual ~CFWL_Event(); |
| 71 | 71 |
| 72 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | |
| 73 virtual CFWL_EventType GetClassID() const; | 72 virtual CFWL_EventType GetClassID() const; |
| 74 | 73 |
| 75 uint32_t Release(); | 74 uint32_t Release(); |
| 76 | 75 |
| 77 IFWL_Widget* m_pSrcTarget; | 76 IFWL_Widget* m_pSrcTarget; |
| 78 IFWL_Widget* m_pDstTarget; | 77 IFWL_Widget* m_pDstTarget; |
| 79 | 78 |
| 80 private: | 79 private: |
| 81 uint32_t m_dwRefCount; | 80 uint32_t m_dwRefCount; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 inline CFWL_Event::CFWL_Event() | 83 inline CFWL_Event::CFWL_Event() |
| 85 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} | 84 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} |
| 86 | 85 |
| 87 inline CFWL_Event::~CFWL_Event() {} | 86 inline CFWL_Event::~CFWL_Event() {} |
| 88 | 87 |
| 89 inline FWL_Error CFWL_Event::GetClassName(CFX_WideString& wsClass) const { | |
| 90 return FWL_Error::Succeeded; | |
| 91 } | |
| 92 | |
| 93 inline CFWL_EventType CFWL_Event::GetClassID() const { | 88 inline CFWL_EventType CFWL_Event::GetClassID() const { |
| 94 return CFWL_EventType::None; | 89 return CFWL_EventType::None; |
| 95 } | 90 } |
| 96 | 91 |
| 97 inline uint32_t CFWL_Event::Release() { | 92 inline uint32_t CFWL_Event::Release() { |
| 98 m_dwRefCount--; | 93 m_dwRefCount--; |
| 99 uint32_t dwRefCount = m_dwRefCount; | 94 uint32_t dwRefCount = m_dwRefCount; |
| 100 if (!m_dwRefCount) | 95 if (!m_dwRefCount) |
| 101 delete this; | 96 delete this; |
| 102 return dwRefCount; | 97 return dwRefCount; |
| 103 } | 98 } |
| 104 | 99 |
| 105 #define FWL_EVENT_DEF(classname, eventType, ...) \ | 100 #define FWL_EVENT_DEF(classname, eventType, ...) \ |
| 106 class classname : public CFWL_Event { \ | 101 class classname : public CFWL_Event { \ |
| 107 public: \ | 102 public: \ |
| 108 classname(); \ | 103 classname(); \ |
| 109 ~classname() override; \ | 104 ~classname() override; \ |
| 110 FWL_Error GetClassName(CFX_WideString& wsClass) const override; \ | |
| 111 CFWL_EventType GetClassID() const override; \ | 105 CFWL_EventType GetClassID() const override; \ |
| 112 __VA_ARGS__ \ | 106 __VA_ARGS__ \ |
| 113 }; \ | 107 }; \ |
| 114 inline classname::classname() {} \ | 108 inline classname::classname() {} \ |
| 115 inline classname::~classname() {} \ | 109 inline classname::~classname() {} \ |
| 116 inline FWL_Error classname::GetClassName(CFX_WideString& wsClass) const { \ | |
| 117 wsClass = L## #classname; \ | |
| 118 return FWL_Error::Succeeded; \ | |
| 119 } \ | |
| 120 inline CFWL_EventType classname::GetClassID() const { return eventType; } | 110 inline CFWL_EventType classname::GetClassID() const { return eventType; } |
| 121 | 111 |
| 122 FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx; | 112 FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx; |
| 123 FX_FLOAT m_fy; | 113 FX_FLOAT m_fy; |
| 124 uint32_t m_dwFlags; | 114 uint32_t m_dwFlags; |
| 125 FWL_MouseCommand m_dwCmd;) | 115 FWL_MouseCommand m_dwCmd;) |
| 126 | 116 |
| 127 FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx; | 117 FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx; |
| 128 FX_FLOAT m_fy; | 118 FX_FLOAT m_fy; |
| 129 FX_FLOAT m_fDeltaX; | 119 FX_FLOAT m_fDeltaX; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 156 |
| 167 FWL_EVENT_DEF(CFWL_EvtSizeChanged, | 157 FWL_EVENT_DEF(CFWL_EvtSizeChanged, |
| 168 CFWL_EventType::SizeChanged, | 158 CFWL_EventType::SizeChanged, |
| 169 IFWL_Widget* m_pWidget; | 159 IFWL_Widget* m_pWidget; |
| 170 CFX_RectF m_rtOld; | 160 CFX_RectF m_rtOld; |
| 171 CFX_RectF m_rtNew;) | 161 CFX_RectF m_rtNew;) |
| 172 | 162 |
| 173 FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle) | 163 FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle) |
| 174 | 164 |
| 175 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ | 165 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ |
| OLD | NEW |