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

Side by Side Diff: xfa/fwl/core/cfwl_event.h

Issue 2070583003: Make code compile with clang_use_chrome_plugin (part VI) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: better macros Created 4 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « xfa/fwl/basewidget/ifwl_tooltip.h ('k') | xfa/fwl/core/cfwl_message.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/fx_coordinates.h" 10 #include "core/fxcrt/include/fx_coordinates.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 FWL_EVENT_IDLE_MASK = 1 << 7, 59 FWL_EVENT_IDLE_MASK = 1 << 7,
60 FWL_EVENT_CONTROL_MASK = 1 << 8, 60 FWL_EVENT_CONTROL_MASK = 1 << 8,
61 FWL_EVENT_ALL_MASK = 0xFF 61 FWL_EVENT_ALL_MASK = 0xFF
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 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} 70 virtual ~CFWL_Event();
71 virtual ~CFWL_Event() {}
72 71
73 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { 72 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
74 return FWL_Error::Succeeded; 73 virtual CFWL_EventType GetClassID() const;
75 }
76 virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; }
77 74
78 uint32_t Release() { 75 uint32_t Release();
79 m_dwRefCount--;
80 uint32_t dwRefCount = m_dwRefCount;
81 if (!m_dwRefCount)
82 delete this;
83 return dwRefCount;
84 }
85 76
86 IFWL_Widget* m_pSrcTarget; 77 IFWL_Widget* m_pSrcTarget;
87 IFWL_Widget* m_pDstTarget; 78 IFWL_Widget* m_pDstTarget;
88 79
89 private: 80 private:
90 uint32_t m_dwRefCount; 81 uint32_t m_dwRefCount;
91 }; 82 };
92 83
93 #define BEGIN_FWL_EVENT_DEF(classname, eventType) \ 84 inline CFWL_Event::CFWL_Event()
94 class classname : public CFWL_Event { \ 85 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {}
95 public: \
96 classname() : CFWL_Event() {} \
97 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { \
98 wsClass = L## #classname; \
99 return FWL_Error::Succeeded; \
100 } \
101 virtual CFWL_EventType GetClassID() const { return eventType; }
102 86
103 #define END_FWL_EVENT_DEF \ 87 inline CFWL_Event::~CFWL_Event() {}
104 } \
105 ; // NOLINT
106 88
107 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse) 89 inline FWL_Error CFWL_Event::GetClassName(CFX_WideString& wsClass) const {
108 FX_FLOAT m_fx; 90 return FWL_Error::Succeeded;
109 FX_FLOAT m_fy; 91 }
110 uint32_t m_dwFlags;
111 FWL_MouseCommand m_dwCmd;
112 END_FWL_EVENT_DEF
113 92
114 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel) 93 inline CFWL_EventType CFWL_Event::GetClassID() const {
115 FX_FLOAT m_fx; 94 return CFWL_EventType::None;
116 FX_FLOAT m_fy; 95 }
117 FX_FLOAT m_fDeltaX;
118 FX_FLOAT m_fDeltaY;
119 uint32_t m_dwFlags;
120 END_FWL_EVENT_DEF
121 96
122 BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key) 97 inline uint32_t CFWL_Event::Release() {
123 uint32_t m_dwKeyCode; 98 m_dwRefCount--;
124 uint32_t m_dwFlags; 99 uint32_t dwRefCount = m_dwRefCount;
125 FWL_KeyCommand m_dwCmd; 100 if (!m_dwRefCount)
126 END_FWL_EVENT_DEF 101 delete this;
102 return dwRefCount;
103 }
127 104
128 BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, CFWL_EventType::SetFocus) 105 #define FWL_EVENT_DEF(classname, eventType, ...) \
129 IFWL_Widget* m_pSetFocus; 106 class classname : public CFWL_Event { \
130 END_FWL_EVENT_DEF 107 public: \
108 classname(); \
109 ~classname() override; \
110 FWL_Error GetClassName(CFX_WideString& wsClass) const override; \
111 CFWL_EventType GetClassID() const override; \
112 __VA_ARGS__ \
113 }; \
114 inline classname::classname() {} \
115 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; }
131 121
132 BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, CFWL_EventType::KillFocus) 122 FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx;
133 IFWL_Widget* m_pKillFocus; 123 FX_FLOAT m_fy;
134 END_FWL_EVENT_DEF 124 uint32_t m_dwFlags;
125 FWL_MouseCommand m_dwCmd;)
135 126
136 BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw) 127 FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx;
137 CFX_Graphics* m_pGraphics; 128 FX_FLOAT m_fy;
138 IFWL_Widget* m_pWidget; 129 FX_FLOAT m_fDeltaX;
139 END_FWL_EVENT_DEF 130 FX_FLOAT m_fDeltaY;
131 uint32_t m_dwFlags;)
140 132
141 BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click) 133 FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key, uint32_t m_dwKeyCode;
142 END_FWL_EVENT_DEF 134 uint32_t m_dwFlags;
135 FWL_KeyCommand m_dwCmd;)
143 136
144 BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll) 137 FWL_EVENT_DEF(CFWL_EvtSetFocus,
145 uint32_t m_iScrollCode; 138 CFWL_EventType::SetFocus,
146 FX_FLOAT m_fPos; 139 IFWL_Widget* m_pSetFocus;)
147 FX_BOOL* m_pRet;
148 END_FWL_EVENT_DEF
149 140
150 BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) 141 FWL_EVENT_DEF(CFWL_EvtKillFocus,
151 END_FWL_EVENT_DEF 142 CFWL_EventType::KillFocus,
143 IFWL_Widget* m_pKillFocus;)
152 144
153 BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, CFWL_EventType::ContextMenu) 145 FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw, CFX_Graphics* m_pGraphics;
154 FX_FLOAT m_fPosX; 146 IFWL_Widget * m_pWidget;)
155 FX_FLOAT m_fPosY;
156 IFWL_Widget* m_pOwner;
157 END_FWL_EVENT_DEF
158 147
159 BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, CFWL_EventType::MenuCommand) 148 FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click)
160 int32_t m_iCommand;
161 void* m_pData;
162 END_FWL_EVENT_DEF
163 149
164 BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, CFWL_EventType::SizeChanged) 150 FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll, uint32_t m_iScrollCode;
165 IFWL_Widget* m_pWidget; 151 FX_FLOAT m_fPos;
166 CFX_RectF m_rtOld; 152 FX_BOOL * m_pRet;)
167 CFX_RectF m_rtNew;
168 END_FWL_EVENT_DEF
169 153
170 BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle) 154 FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close)
171 END_FWL_EVENT_DEF 155
156 FWL_EVENT_DEF(CFWL_EvtContextMenu,
157 CFWL_EventType::ContextMenu,
158 FX_FLOAT m_fPosX;
159 FX_FLOAT m_fPosY;
160 IFWL_Widget * m_pOwner;)
161
162 FWL_EVENT_DEF(CFWL_EvtMenuCommand,
163 CFWL_EventType::MenuCommand,
164 int32_t m_iCommand;
165 void* m_pData;)
166
167 FWL_EVENT_DEF(CFWL_EvtSizeChanged,
168 CFWL_EventType::SizeChanged,
169 IFWL_Widget* m_pWidget;
170 CFX_RectF m_rtOld;
171 CFX_RectF m_rtNew;)
172
173 FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle)
172 174
173 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ 175 #endif // XFA_FWL_CORE_CFWL_EVENT_H_
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/ifwl_tooltip.h ('k') | xfa/fwl/core/cfwl_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698