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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 class CFX_Graphics; | 71 class CFX_Graphics; |
72 class IFWL_Widget; | 72 class IFWL_Widget; |
73 | 73 |
74 class CFWL_Event { | 74 class CFWL_Event { |
75 public: | 75 public: |
76 CFWL_Event(); | 76 CFWL_Event(); |
77 virtual ~CFWL_Event(); | 77 virtual ~CFWL_Event(); |
78 | 78 |
79 virtual CFWL_EventType GetClassID() const; | 79 virtual CFWL_EventType GetClassID() const; |
80 | 80 |
81 uint32_t Release(); | |
82 | |
83 IFWL_Widget* m_pSrcTarget; | 81 IFWL_Widget* m_pSrcTarget; |
84 IFWL_Widget* m_pDstTarget; | 82 IFWL_Widget* m_pDstTarget; |
85 | |
86 private: | |
87 uint32_t m_dwRefCount; | |
88 }; | 83 }; |
89 | 84 |
90 inline CFWL_Event::CFWL_Event() | 85 inline CFWL_Event::CFWL_Event() |
91 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} | 86 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr) {} |
92 | 87 |
93 inline CFWL_Event::~CFWL_Event() {} | 88 inline CFWL_Event::~CFWL_Event() {} |
94 | 89 |
95 inline CFWL_EventType CFWL_Event::GetClassID() const { | 90 inline CFWL_EventType CFWL_Event::GetClassID() const { |
96 return CFWL_EventType::None; | 91 return CFWL_EventType::None; |
97 } | 92 } |
98 | 93 |
99 inline uint32_t CFWL_Event::Release() { | |
100 m_dwRefCount--; | |
101 uint32_t dwRefCount = m_dwRefCount; | |
102 if (!m_dwRefCount) | |
103 delete this; | |
104 return dwRefCount; | |
105 } | |
106 | |
107 #define FWL_EVENT_DEF(classname, eventType, ...) \ | 94 #define FWL_EVENT_DEF(classname, eventType, ...) \ |
108 class classname : public CFWL_Event { \ | 95 class classname : public CFWL_Event { \ |
109 public: \ | 96 public: \ |
110 classname(); \ | 97 classname(); \ |
111 ~classname() override; \ | 98 ~classname() override; \ |
112 CFWL_EventType GetClassID() const override; \ | 99 CFWL_EventType GetClassID() const override; \ |
113 __VA_ARGS__ \ | 100 __VA_ARGS__ \ |
114 }; \ | 101 }; \ |
115 inline classname::classname() {} \ | 102 inline classname::classname() {} \ |
116 inline classname::~classname() {} \ | 103 inline classname::~classname() {} \ |
(...skipping 30 matching lines...) Expand all Loading... |
147 | 134 |
148 FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) | 135 FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) |
149 | 136 |
150 FWL_EVENT_DEF(CFWL_EvtSizeChanged, | 137 FWL_EVENT_DEF(CFWL_EvtSizeChanged, |
151 CFWL_EventType::SizeChanged, | 138 CFWL_EventType::SizeChanged, |
152 IFWL_Widget* m_pWidget; | 139 IFWL_Widget* m_pWidget; |
153 CFX_RectF m_rtOld; | 140 CFX_RectF m_rtOld; |
154 CFX_RectF m_rtNew;) | 141 CFX_RectF m_rtNew;) |
155 | 142 |
156 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ | 143 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ |
OLD | NEW |