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" |
11 #include "core/fxcrt/fx_string.h" | 11 #include "core/fxcrt/fx_string.h" |
12 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
13 #include "xfa/fwl/core/cfwl_msgkey.h" | 13 #include "xfa/fwl/core/cfwl_msgkey.h" |
14 #include "xfa/fwl/core/cfwl_msgmouse.h" | 14 #include "xfa/fwl/core/cfwl_msgmouse.h" |
15 #include "xfa/fwl/core/fwl_error.h" | 15 #include "xfa/fwl/core/fwl_error.h" |
16 | 16 |
17 enum class FWL_SCBCODE { | |
18 None = 1, | |
19 Min, | |
20 Max, | |
21 PageBackward, | |
22 PageForward, | |
23 StepBackward, | |
24 StepForward, | |
25 Pos, | |
26 TrackPos, | |
27 EndScroll, | |
28 }; | |
29 | |
30 enum class CFWL_EventType { | 17 enum class CFWL_EventType { |
31 None = 0, | 18 None = 0, |
32 | 19 |
33 CheckStateChanged, | 20 CheckStateChanged, |
34 CheckWord, | 21 CheckWord, |
35 Click, | 22 Click, |
36 Close, | 23 Close, |
37 CloseUp, | 24 CloseUp, |
38 DrawItem, | 25 DrawItem, |
39 DropDown, | 26 DropDown, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 public: | 62 public: |
76 CFWL_Event(); | 63 CFWL_Event(); |
77 virtual ~CFWL_Event(); | 64 virtual ~CFWL_Event(); |
78 | 65 |
79 virtual CFWL_EventType GetClassID() const; | 66 virtual CFWL_EventType GetClassID() const; |
80 | 67 |
81 IFWL_Widget* m_pSrcTarget; | 68 IFWL_Widget* m_pSrcTarget; |
82 IFWL_Widget* m_pDstTarget; | 69 IFWL_Widget* m_pDstTarget; |
83 }; | 70 }; |
84 | 71 |
85 inline CFWL_Event::CFWL_Event() | |
86 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr) {} | |
87 | |
88 inline CFWL_Event::~CFWL_Event() {} | |
89 | |
90 inline CFWL_EventType CFWL_Event::GetClassID() const { | |
91 return CFWL_EventType::None; | |
92 } | |
93 | |
94 #define FWL_EVENT_DEF(classname, eventType, ...) \ | 72 #define FWL_EVENT_DEF(classname, eventType, ...) \ |
95 class classname : public CFWL_Event { \ | 73 class classname : public CFWL_Event { \ |
96 public: \ | 74 public: \ |
97 classname(); \ | 75 classname(); \ |
98 ~classname() override; \ | 76 ~classname() override; \ |
99 CFWL_EventType GetClassID() const override; \ | 77 CFWL_EventType GetClassID() const override; \ |
100 __VA_ARGS__ \ | 78 __VA_ARGS__ \ |
101 }; \ | 79 }; \ |
102 inline classname::classname() {} \ | 80 inline classname::classname() {} \ |
103 inline classname::~classname() {} \ | 81 inline classname::~classname() {} \ |
104 inline CFWL_EventType classname::GetClassID() const { return eventType; } | 82 inline CFWL_EventType classname::GetClassID() const { return eventType; } |
105 | 83 |
106 FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse, FX_FLOAT m_fx; | |
107 FX_FLOAT m_fy; | |
108 uint32_t m_dwFlags; | |
109 FWL_MouseCommand m_dwCmd;) | |
110 | |
111 FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel, FX_FLOAT m_fx; | |
112 FX_FLOAT m_fy; | |
113 FX_FLOAT m_fDeltaX; | |
114 FX_FLOAT m_fDeltaY; | |
115 uint32_t m_dwFlags;) | |
116 | |
117 FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key, uint32_t m_dwKeyCode; | |
118 uint32_t m_dwFlags; | |
119 FWL_KeyCommand m_dwCmd;) | |
120 | |
121 FWL_EVENT_DEF(CFWL_EvtSetFocus, | |
122 CFWL_EventType::SetFocus, | |
123 IFWL_Widget* m_pSetFocus;) | |
124 | |
125 FWL_EVENT_DEF(CFWL_EvtKillFocus, | |
126 CFWL_EventType::KillFocus, | |
127 IFWL_Widget* m_pKillFocus;) | |
128 | |
129 FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click) | |
130 | |
131 FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll, FWL_SCBCODE m_iScrollCode; | |
132 FX_FLOAT m_fPos; | |
133 bool* m_pRet;) | |
134 | |
135 FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) | |
136 | |
137 FWL_EVENT_DEF(CFWL_EvtSizeChanged, | |
138 CFWL_EventType::SizeChanged, | |
139 IFWL_Widget* m_pWidget; | |
140 CFX_RectF m_rtOld; | |
141 CFX_RectF m_rtNew;) | |
142 | |
143 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ | 84 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ |
OLD | NEW |