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

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

Issue 1901183002: Remove CFWL_Note. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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_spinbutton.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"
11 #include "core/fxcrt/include/fx_string.h" 11 #include "core/fxcrt/include/fx_string.h"
12 #include "core/fxcrt/include/fx_system.h" 12 #include "core/fxcrt/include/fx_system.h"
13 #include "xfa/fwl/core/cfwl_note.h"
14 #include "xfa/fwl/core/fwl_error.h" 13 #include "xfa/fwl/core/fwl_error.h"
15 14
16 // TODO(dsinclair): Event hash is hash of string, cleanup. pdfium:474 15 enum class CFWL_EventType {
17 #define FWL_EVTHASH_Mouse 1765258002 16 None = 0,
18 #define FWL_EVTHASH_MouseWheel 3907114407 17
19 #define FWL_EVTHASH_Key 2408354450 18 CheckStateChanged,
20 #define FWL_EVTHASH_SetFocus 3909721269 19 CheckWord,
21 #define FWL_EVTHASH_KillFocus 1779363253 20 Click,
22 #define FWL_EVTHASH_Draw 2430713303 21 Close,
23 #define FWL_EVTHASH_Click 4026328783 22 CloseUp,
24 #define FWL_EVTHASH_Scroll 2965158968 23 ContextMenu,
25 #define FWL_EVTHASH_Close 4036693599 24 DataSelected,
26 #define FWL_EVTHASH_ContextMenu 2717307715 25 DateChanged,
27 #define FWL_EVTHASH_MenuCommand 497763741 26 Draw,
28 #define FWL_EVTHASH_SizeChanged 3083958510 27 DrawItem,
29 #define FWL_EVTHASH_Idle 839546759 28 DropDown,
29 EditChanged,
30 GetSuggestedWords,
31 HoverChanged,
32 Idle,
33 Key,
34 KillFocus,
35 MenuCommand,
36 Mouse,
37 MouseWheel,
38 PostDropDown,
39 PreDropDown,
40 PreSelfAdaption,
41 Scroll,
42 SelectChanged,
43 SetFocus,
44 SizeChanged,
45 TextChanged,
46 TextFull,
47 Validate
48 };
30 49
31 typedef enum { 50 typedef enum {
32 FWL_EVENT_MOUSE_MASK = 1 << 0, 51 FWL_EVENT_MOUSE_MASK = 1 << 0,
33 FWL_EVENT_MOUSEWHEEL_MASK = 1 << 1, 52 FWL_EVENT_MOUSEWHEEL_MASK = 1 << 1,
34 FWL_EVENT_KEY_MASK = 1 << 2, 53 FWL_EVENT_KEY_MASK = 1 << 2,
35 FWL_EVENT_FOCUSCHANGED_MASK = 1 << 3, 54 FWL_EVENT_FOCUSCHANGED_MASK = 1 << 3,
36 FWL_EVENT_DRAW_MASK = 1 << 4, 55 FWL_EVENT_DRAW_MASK = 1 << 4,
37 FWL_EVENT_CLOSE_MASK = 1 << 5, 56 FWL_EVENT_CLOSE_MASK = 1 << 5,
38 FWL_EVENT_SIZECHANGED_MASK = 1 << 6, 57 FWL_EVENT_SIZECHANGED_MASK = 1 << 6,
39 FWL_EVENT_IDLE_MASK = 1 << 7, 58 FWL_EVENT_IDLE_MASK = 1 << 7,
40 FWL_EVENT_CONTROL_MASK = 1 << 8, 59 FWL_EVENT_CONTROL_MASK = 1 << 8,
41 FWL_EVENT_ALL_MASK = 0xFF 60 FWL_EVENT_ALL_MASK = 0xFF
42 } FWLEventMask; 61 } FWLEventMask;
43 62
44 class CFX_Graphics; 63 class CFX_Graphics;
45 class IFWL_Widget; 64 class IFWL_Widget;
46 65
47 class CFWL_Event : public CFWL_Note { 66 class CFWL_Event {
48 public: 67 public:
49 CFWL_Event() : CFWL_Note(TRUE) {} 68 CFWL_Event()
69 : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {}
50 virtual ~CFWL_Event() {} 70 virtual ~CFWL_Event() {}
71
72 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const {
73 return FWL_ERR_Succeeded;
74 }
75 virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; }
76
77 uint32_t Release() {
78 m_dwRefCount--;
79 uint32_t dwRefCount = m_dwRefCount;
80 if (!m_dwRefCount)
81 delete this;
82 return dwRefCount;
83 }
84
85 IFWL_Widget* m_pSrcTarget;
86 IFWL_Widget* m_pDstTarget;
87
88 private:
89 uint32_t m_dwRefCount;
51 }; 90 };
52 91
53 #define BEGIN_FWL_EVENT_DEF(classname, eventhashcode) \ 92 #define BEGIN_FWL_EVENT_DEF(classname, eventType) \
54 class classname : public CFWL_Event { \ 93 class classname : public CFWL_Event { \
55 public: \ 94 public: \
56 classname() : CFWL_Event() {} \ 95 classname() : CFWL_Event() {} \
57 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { \ 96 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { \
58 wsClass = L## #classname; \ 97 wsClass = L## #classname; \
59 return FWL_ERR_Succeeded; \ 98 return FWL_ERR_Succeeded; \
60 } \ 99 } \
61 virtual uint32_t GetClassID() const { return eventhashcode; } 100 virtual CFWL_EventType GetClassID() const { return eventType; }
62 101
63 #define END_FWL_EVENT_DEF \ 102 #define END_FWL_EVENT_DEF \
64 } \ 103 } \
65 ; // NOLINT 104 ; // NOLINT
66 105
67 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, FWL_EVTHASH_Mouse) 106 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouse, CFWL_EventType::Mouse)
68 FX_FLOAT m_fx; 107 FX_FLOAT m_fx;
69 FX_FLOAT m_fy; 108 FX_FLOAT m_fy;
70 uint32_t m_dwFlags; 109 uint32_t m_dwFlags;
71 uint32_t m_dwCmd; 110 uint32_t m_dwCmd;
72 END_FWL_EVENT_DEF 111 END_FWL_EVENT_DEF
73 112
74 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, FWL_EVTHASH_MouseWheel) 113 BEGIN_FWL_EVENT_DEF(CFWL_EvtMouseWheel, CFWL_EventType::MouseWheel)
75 FX_FLOAT m_fx; 114 FX_FLOAT m_fx;
76 FX_FLOAT m_fy; 115 FX_FLOAT m_fy;
77 FX_FLOAT m_fDeltaX; 116 FX_FLOAT m_fDeltaX;
78 FX_FLOAT m_fDeltaY; 117 FX_FLOAT m_fDeltaY;
79 uint32_t m_dwFlags; 118 uint32_t m_dwFlags;
80 END_FWL_EVENT_DEF 119 END_FWL_EVENT_DEF
81 120
82 BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, FWL_EVTHASH_Key) 121 BEGIN_FWL_EVENT_DEF(CFWL_EvtKey, CFWL_EventType::Key)
83 uint32_t m_dwKeyCode; 122 uint32_t m_dwKeyCode;
84 uint32_t m_dwFlags; 123 uint32_t m_dwFlags;
85 uint32_t m_dwCmd; 124 uint32_t m_dwCmd;
86 END_FWL_EVENT_DEF 125 END_FWL_EVENT_DEF
87 126
88 BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, FWL_EVTHASH_SetFocus) 127 BEGIN_FWL_EVENT_DEF(CFWL_EvtSetFocus, CFWL_EventType::SetFocus)
89 IFWL_Widget* m_pSetFocus; 128 IFWL_Widget* m_pSetFocus;
90 END_FWL_EVENT_DEF 129 END_FWL_EVENT_DEF
91 130
92 BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, FWL_EVTHASH_KillFocus) 131 BEGIN_FWL_EVENT_DEF(CFWL_EvtKillFocus, CFWL_EventType::KillFocus)
93 IFWL_Widget* m_pKillFocus; 132 IFWL_Widget* m_pKillFocus;
94 END_FWL_EVENT_DEF 133 END_FWL_EVENT_DEF
95 134
96 BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, FWL_EVTHASH_Draw) 135 BEGIN_FWL_EVENT_DEF(CFWL_EvtDraw, CFWL_EventType::Draw)
97 CFX_Graphics* m_pGraphics; 136 CFX_Graphics* m_pGraphics;
98 IFWL_Widget* m_pWidget; 137 IFWL_Widget* m_pWidget;
99 END_FWL_EVENT_DEF 138 END_FWL_EVENT_DEF
100 139
101 BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, FWL_EVTHASH_Click) 140 BEGIN_FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click)
102 END_FWL_EVENT_DEF 141 END_FWL_EVENT_DEF
103 142
104 BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, FWL_EVTHASH_Scroll) 143 BEGIN_FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll)
105 uint32_t m_iScrollCode; 144 uint32_t m_iScrollCode;
106 FX_FLOAT m_fPos; 145 FX_FLOAT m_fPos;
107 FX_BOOL* m_pRet; 146 FX_BOOL* m_pRet;
108 END_FWL_EVENT_DEF 147 END_FWL_EVENT_DEF
109 148
110 BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, FWL_EVTHASH_Close) 149 BEGIN_FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close)
111 END_FWL_EVENT_DEF 150 END_FWL_EVENT_DEF
112 151
113 BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, FWL_EVTHASH_ContextMenu) 152 BEGIN_FWL_EVENT_DEF(CFWL_EvtContextMenu, CFWL_EventType::ContextMenu)
114 FX_FLOAT m_fPosX; 153 FX_FLOAT m_fPosX;
115 FX_FLOAT m_fPosY; 154 FX_FLOAT m_fPosY;
116 IFWL_Widget* m_pOwner; 155 IFWL_Widget* m_pOwner;
117 END_FWL_EVENT_DEF 156 END_FWL_EVENT_DEF
118 157
119 BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, FWL_EVTHASH_MenuCommand) 158 BEGIN_FWL_EVENT_DEF(CFWL_EvtMenuCommand, CFWL_EventType::MenuCommand)
120 int32_t m_iCommand; 159 int32_t m_iCommand;
121 void* m_pData; 160 void* m_pData;
122 END_FWL_EVENT_DEF 161 END_FWL_EVENT_DEF
123 162
124 BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, FWL_EVTHASH_SizeChanged) 163 BEGIN_FWL_EVENT_DEF(CFWL_EvtSizeChanged, CFWL_EventType::SizeChanged)
125 IFWL_Widget* m_pWidget; 164 IFWL_Widget* m_pWidget;
126 CFX_RectF m_rtOld; 165 CFX_RectF m_rtOld;
127 CFX_RectF m_rtNew; 166 CFX_RectF m_rtNew;
128 END_FWL_EVENT_DEF 167 END_FWL_EVENT_DEF
129 168
130 BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, FWL_EVTHASH_Idle) 169 BEGIN_FWL_EVENT_DEF(CFWL_EvtIdle, CFWL_EventType::Idle)
131 END_FWL_EVENT_DEF 170 END_FWL_EVENT_DEF
132 171
133 #endif // XFA_FWL_CORE_CFWL_EVENT_H_ 172 #endif // XFA_FWL_CORE_CFWL_EVENT_H_
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/ifwl_spinbutton.h ('k') | xfa/fwl/core/cfwl_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698