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

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

Issue 1940033002: Use STL map for m_eventTargets. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, manual merge required. Created 4 years, 7 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 | « no previous file | xfa/fwl/core/fwl_noteimp.cpp » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_FWL_NOTEIMP_H_ 7 #ifndef XFA_FWL_CORE_FWL_NOTEIMP_H_
8 #define XFA_FWL_CORE_FWL_NOTEIMP_H_ 8 #define XFA_FWL_CORE_FWL_NOTEIMP_H_
9 9
10 #include <unordered_map>
11
10 #include "xfa/fwl/core/cfwl_event.h" 12 #include "xfa/fwl/core/cfwl_event.h"
11 #include "xfa/fwl/core/cfwl_message.h" 13 #include "xfa/fwl/core/cfwl_message.h"
12 #include "xfa/fwl/core/fwl_error.h" 14 #include "xfa/fwl/core/fwl_error.h"
13 #include "xfa/fwl/core/ifwl_widget.h" 15 #include "xfa/fwl/core/ifwl_widget.h"
14 #include "xfa/fxgraphics/include/cfx_graphics.h" 16 #include "xfa/fxgraphics/include/cfx_graphics.h"
15 17
16 enum FWL_KeyFlag { 18 enum FWL_KeyFlag {
17 FWL_KEYFLAG_Ctrl = 1 << 0, 19 FWL_KEYFLAG_Ctrl = 1 << 0,
18 FWL_KEYFLAG_Alt = 1 << 1, 20 FWL_KEYFLAG_Alt = 1 << 1,
19 FWL_KEYFLAG_Shift = 1 << 2, 21 FWL_KEYFLAG_Shift = 1 << 2,
20 FWL_KEYFLAG_Command = 1 << 3, 22 FWL_KEYFLAG_Command = 1 << 3,
21 FWL_KEYFLAG_LButton = 1 << 4, 23 FWL_KEYFLAG_LButton = 1 << 4,
22 FWL_KEYFLAG_RButton = 1 << 5, 24 FWL_KEYFLAG_RButton = 1 << 5,
23 FWL_KEYFLAG_MButton = 1 << 6 25 FWL_KEYFLAG_MButton = 1 << 6
24 }; 26 };
25 27
26 class CFWL_CoreToolTipDP; 28 class CFWL_CoreToolTipDP;
29 class CFWL_EventTarget;
27 class CFWL_MsgActivate; 30 class CFWL_MsgActivate;
28 class CFWL_MsgDeactivate; 31 class CFWL_MsgDeactivate;
29 class CFWL_MsgDropFiles; 32 class CFWL_MsgDropFiles;
30 class CFWL_MsgKey; 33 class CFWL_MsgKey;
31 class CFWL_MsgKillFocus; 34 class CFWL_MsgKillFocus;
32 class CFWL_MsgMouse; 35 class CFWL_MsgMouse;
33 class CFWL_MsgMouseWheel; 36 class CFWL_MsgMouseWheel;
34 class CFWL_MsgSetFocus; 37 class CFWL_MsgSetFocus;
35 class CFWL_MsgSize; 38 class CFWL_MsgSize;
36 class CFWL_MsgWindowMove; 39 class CFWL_MsgWindowMove;
(...skipping 18 matching lines...) Expand all
55 58
56 CFWL_WidgetImp* m_pForm; 59 CFWL_WidgetImp* m_pForm;
57 FX_BOOL m_bContinueModal; 60 FX_BOOL m_bContinueModal;
58 }; 61 };
59 62
60 class CFWL_NoteDriver { 63 class CFWL_NoteDriver {
61 public: 64 public:
62 CFWL_NoteDriver(); 65 CFWL_NoteDriver();
63 ~CFWL_NoteDriver(); 66 ~CFWL_NoteDriver();
64 67
65 FX_BOOL SendEvent(CFWL_Event* pNote); 68 void SendEvent(CFWL_Event* pNote);
66 FWL_Error RegisterEventTarget(IFWL_Widget* pListener, 69 FWL_Error RegisterEventTarget(IFWL_Widget* pListener,
67 IFWL_Widget* pEventSource = nullptr, 70 IFWL_Widget* pEventSource = nullptr,
68 uint32_t dwFilter = FWL_EVENT_ALL_MASK); 71 uint32_t dwFilter = FWL_EVENT_ALL_MASK);
69 FWL_Error UnregisterEventTarget(IFWL_Widget* pListener); 72 FWL_Error UnregisterEventTarget(IFWL_Widget* pListener);
70 void ClearEventTargets(FX_BOOL bRemoveAll); 73 void ClearEventTargets(FX_BOOL bRemoveAll);
71 IFWL_App* GetOwnerApp() const; 74 IFWL_App* GetOwnerApp() const;
72 FWL_Error PushNoteLoop(CFWL_NoteLoop* pNoteLoop); 75 FWL_Error PushNoteLoop(CFWL_NoteLoop* pNoteLoop);
73 CFWL_NoteLoop* PopNoteLoop(); 76 CFWL_NoteLoop* PopNoteLoop();
74 IFWL_Widget* GetFocus(); 77 IFWL_Widget* GetFocus();
75 FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE); 78 FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE);
(...skipping 26 matching lines...) Expand all
102 FX_BOOL DoDragFiles(CFWL_MsgDropFiles* pMsg, IFWL_Widget* pMessageForm); 105 FX_BOOL DoDragFiles(CFWL_MsgDropFiles* pMsg, IFWL_Widget* pMessageForm);
103 FX_BOOL DoMouseEx(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); 106 FX_BOOL DoMouseEx(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm);
104 void MouseSecondary(CFWL_MsgMouse* pMsg); 107 void MouseSecondary(CFWL_MsgMouse* pMsg);
105 FX_BOOL IsValidMessage(CFWL_Message* pMessage); 108 FX_BOOL IsValidMessage(CFWL_Message* pMessage);
106 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); 109 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
107 void ClearInvalidEventTargets(FX_BOOL bRemoveAll); 110 void ClearInvalidEventTargets(FX_BOOL bRemoveAll);
108 111
109 CFX_ArrayTemplate<CFWL_WidgetImp*> m_forms; 112 CFX_ArrayTemplate<CFWL_WidgetImp*> m_forms;
110 CFX_ArrayTemplate<CFWL_Message*> m_noteQueue; 113 CFX_ArrayTemplate<CFWL_Message*> m_noteQueue;
111 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; 114 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue;
112 CFX_MapPtrToPtr m_eventTargets; 115 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets;
113 int32_t m_sendEventCalled;
114 IFWL_Widget* m_pHover; 116 IFWL_Widget* m_pHover;
115 IFWL_Widget* m_pFocus; 117 IFWL_Widget* m_pFocus;
116 IFWL_Widget* m_pGrab; 118 IFWL_Widget* m_pGrab;
117 CFWL_NoteLoop* m_pNoteLoop; 119 CFWL_NoteLoop* m_pNoteLoop;
118 }; 120 };
119 121
120 class CFWL_EventTarget { 122 class CFWL_EventTarget {
121 public: 123 public:
122 CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener) 124 CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener)
123 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} 125 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 IFWL_ToolTipTarget* pCurTarget; 159 IFWL_ToolTipTarget* pCurTarget;
158 CFWL_ToolTipImp* m_pToolTipImp; 160 CFWL_ToolTipImp* m_pToolTipImp;
159 CFWL_CoreToolTipDP* m_ToolTipDp; 161 CFWL_CoreToolTipDP* m_ToolTipDp;
160 CFX_ArrayTemplate<IFWL_ToolTipTarget*> m_arrWidget; 162 CFX_ArrayTemplate<IFWL_ToolTipTarget*> m_arrWidget;
161 163
162 private: 164 private:
163 static CFWL_ToolTipContainer* s_pInstance; 165 static CFWL_ToolTipContainer* s_pInstance;
164 }; 166 };
165 167
166 #endif // XFA_FWL_CORE_FWL_NOTEIMP_H_ 168 #endif // XFA_FWL_CORE_FWL_NOTEIMP_H_
OLDNEW
« no previous file with comments | « no previous file | xfa/fwl/core/fwl_noteimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698