summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/cfwl_event.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-18 06:21:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-18 06:21:57 -0700
commit4ce94e118d66064715de5baebeb4b2b580dcac66 (patch)
treeba74181eb90675172d3c7f4be8e71ada3fbc9125 /xfa/fwl/core/cfwl_event.h
parent2fad11a8d9d2704cd9ee28b02373ad7ce19c65e3 (diff)
downloadpdfium-4ce94e118d66064715de5baebeb4b2b580dcac66.tar.xz
Make code compile with clang_use_chrome_plugin (part VI)
This change mainly contains files in xfa/fwl directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2070583003
Diffstat (limited to 'xfa/fwl/core/cfwl_event.h')
-rw-r--r--xfa/fwl/core/cfwl_event.h192
1 files changed, 97 insertions, 95 deletions
diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h
index d9decac334..4d208d0d46 100644
--- a/xfa/fwl/core/cfwl_event.h
+++ b/xfa/fwl/core/cfwl_event.h
@@ -66,22 +66,13 @@ class IFWL_Widget;
class CFWL_Event {
public:
- CFWL_Event()
- : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {}
- virtual ~CFWL_Event() {}
-
- virtual FWL_Error GetClassName(CFX_WideString& wsClass) const {
- return FWL_Error::Succeeded;
- }
- virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; }
-
- uint32_t Release() {
- m_dwRefCount--;
- uint32_t dwRefCount = m_dwRefCount;
- if (!m_dwRefCount)
- delete this;
- return dwRefCount;
- }
+ CFWL_Event();
+ virtual ~CFWL_Event();
+
+ virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
+ virtual CFWL_EventType GetClassID() const;
+
+ uint32_t Release();
IFWL_Widget* m_pSrcTarget;
IFWL_Widget* m_pDstTarget;
@@ -90,84 +81,95 @@ class CFWL_Event {
uint32_t m_dwRefCount;
};
-#define BEGIN_FWL_EVENT_DEF(classname, eventType) \
- class classname : public CFWL_Event { \
- public: \
- classname() : CFWL_Event() {} \
- virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { \
- wsClass = L## #classname; \
- return FWL_Error::Succeeded; \
- } \
- virtual CFWL_EventType GetClassID() const { return eventType; }
-
-#define END_FWL_EVENT_DEF \
- } \
- ; // NOLINT
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse)
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-uint32_t m_dwFlags;
-FWL_MouseCommand m_dwCmd;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel)
-FX_FLOAT m_fx;
-FX_FLOAT m_fy;
-FX_FLOAT m_fDeltaX;
-FX_FLOAT m_fDeltaY;
-uint32_t m_dwFlags;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key)
-uint32_t m_dwKeyCode;
-uint32_t m_dwFlags;
-FWL_KeyCommand m_dwCmd;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, CFWL_EventType::SetFocus)
-IFWL_Widget* m_pSetFocus;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, CFWL_EventType::KillFocus)
-IFWL_Widget* m_pKillFocus;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw)
-CFX_Graphics* m_pGraphics;
-IFWL_Widget* m_pWidget;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click)
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll)
-uint32_t m_iScrollCode;
-FX_FLOAT m_fPos;
-FX_BOOL* m_pRet;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close)
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, CFWL_EventType::ContextMenu)
-FX_FLOAT m_fPosX;
-FX_FLOAT m_fPosY;
-IFWL_Widget* m_pOwner;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, CFWL_EventType::MenuCommand)
-int32_t m_iCommand;
-void* m_pData;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, CFWL_EventType::SizeChanged)
-IFWL_Widget* m_pWidget;
-CFX_RectF m_rtOld;
-CFX_RectF m_rtNew;
-END_FWL_EVENT_DEF
-
-BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle)
-END_FWL_EVENT_DEF
+inline CFWL_Event::CFWL_Event()
+ : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {}
+
+inline CFWL_Event::~CFWL_Event() {}
+
+inline FWL_Error CFWL_Event::GetClassName(CFX_WideString& wsClass) const {
+ return FWL_Error::Succeeded;
+}
+
+inline CFWL_EventType CFWL_Event::GetClassID() const {
+ return CFWL_EventType::None;
+}
+
+inline uint32_t CFWL_Event::Release() {
+ m_dwRefCount--;
+ uint32_t dwRefCount = m_dwRefCount;
+ if (!m_dwRefCount)
+ delete this;
+ return dwRefCount;
+}
+
+#define FWL_EVENT_DEF(classname, eventType, ...) \
+ class classname : public CFWL_Event { \
+ public: \
+ classname(); \
+ ~classname() override; \
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override; \
+ CFWL_EventType GetClassID() const override; \
+ __VA_ARGS__ \
+ }; \
+ inline classname::classname() {} \
+ inline classname::~classname() {} \
+ inline FWL_Error classname::GetClassName(CFX_WideString& wsClass) const { \
+ wsClass = L## #classname; \
+ return FWL_Error::Succeeded; \
+ } \
+ inline CFWL_EventType classname::GetClassID() const { return eventType; }
+
+FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx;
+ FX_FLOAT m_fy;
+ uint32_t m_dwFlags;
+ FWL_MouseCommand m_dwCmd;)
+
+FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx;
+ FX_FLOAT m_fy;
+ FX_FLOAT m_fDeltaX;
+ FX_FLOAT m_fDeltaY;
+ uint32_t m_dwFlags;)
+
+FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key, uint32_t m_dwKeyCode;
+ uint32_t m_dwFlags;
+ FWL_KeyCommand m_dwCmd;)
+
+FWL_EVENT_DEF(CFWL_EvtSetFocus,
+ CFWL_EventType::SetFocus,
+ IFWL_Widget* m_pSetFocus;)
+
+FWL_EVENT_DEF(CFWL_EvtKillFocus,
+ CFWL_EventType::KillFocus,
+ IFWL_Widget* m_pKillFocus;)
+
+FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw, CFX_Graphics* m_pGraphics;
+ IFWL_Widget * m_pWidget;)
+
+FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click)
+
+FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll, uint32_t m_iScrollCode;
+ FX_FLOAT m_fPos;
+ FX_BOOL * m_pRet;)
+
+FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close)
+
+FWL_EVENT_DEF(CFWL_EvtContextMenu,
+ CFWL_EventType::ContextMenu,
+ FX_FLOAT m_fPosX;
+ FX_FLOAT m_fPosY;
+ IFWL_Widget * m_pOwner;)
+
+FWL_EVENT_DEF(CFWL_EvtMenuCommand,
+ CFWL_EventType::MenuCommand,
+ int32_t m_iCommand;
+ void* m_pData;)
+
+FWL_EVENT_DEF(CFWL_EvtSizeChanged,
+ CFWL_EventType::SizeChanged,
+ IFWL_Widget* m_pWidget;
+ CFX_RectF m_rtOld;
+ CFX_RectF m_rtNew;)
+
+FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle)
#endif // XFA_FWL_CORE_CFWL_EVENT_H_