OLD | NEW |
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 <deque> |
10 #include <memory> | 11 #include <memory> |
11 #include <unordered_map> | 12 #include <unordered_map> |
12 | 13 |
13 #include "xfa/fwl/core/cfwl_event.h" | 14 #include "xfa/fwl/core/cfwl_event.h" |
14 #include "xfa/fwl/core/cfwl_message.h" | |
15 #include "xfa/fwl/core/ifwl_tooltip.h" | 15 #include "xfa/fwl/core/ifwl_tooltip.h" |
16 #include "xfa/fwl/core/ifwl_widget.h" | 16 #include "xfa/fwl/core/ifwl_widget.h" |
17 #include "xfa/fxgraphics/cfx_graphics.h" | 17 #include "xfa/fxgraphics/cfx_graphics.h" |
18 | 18 |
19 class CFWL_EventTarget; | 19 class CFWL_EventTarget; |
20 class CFWL_TargetImp; | 20 class CFWL_TargetImp; |
21 class IFWL_ToolTip; | 21 class IFWL_ToolTip; |
22 class IFWL_Widget; | 22 class IFWL_Widget; |
23 | 23 |
24 class CFWL_NoteLoop { | 24 class CFWL_NoteLoop { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 void Run(); | 62 void Run(); |
63 | 63 |
64 void NotifyTargetHide(IFWL_Widget* pNoteTarget); | 64 void NotifyTargetHide(IFWL_Widget* pNoteTarget); |
65 void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); | 65 void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); |
66 | 66 |
67 void RegisterForm(IFWL_Widget* pForm); | 67 void RegisterForm(IFWL_Widget* pForm); |
68 void UnRegisterForm(IFWL_Widget* pForm); | 68 void UnRegisterForm(IFWL_Widget* pForm); |
69 | 69 |
70 void QueueMessage(CFWL_Message* pMessage); | 70 void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); |
71 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); | 71 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); |
72 void ProcessMessage(CFWL_Message* pMessage); | 72 void ProcessMessage(CFWL_Message* pMessage); |
73 | 73 |
74 private: | 74 private: |
75 bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); | 75 bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); |
76 bool DoSetFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 76 bool DoSetFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
77 bool DoKillFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 77 bool DoKillFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
78 bool DoKey(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 78 bool DoKey(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
79 bool DoMouse(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 79 bool DoMouse(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
80 bool DoWheel(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 80 bool DoWheel(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
81 bool DoMouseEx(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 81 bool DoMouseEx(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); |
82 void MouseSecondary(CFWL_Message* pMsg); | 82 void MouseSecondary(CFWL_Message* pMsg); |
83 bool IsValidMessage(CFWL_Message* pMessage); | 83 bool IsValidMessage(CFWL_Message* pMessage); |
84 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); | 84 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); |
85 | 85 |
86 CFX_ArrayTemplate<IFWL_Widget*> m_forms; | 86 CFX_ArrayTemplate<IFWL_Widget*> m_forms; |
87 CFX_ArrayTemplate<CFWL_Message*> m_noteQueue; | 87 std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue; |
88 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; | 88 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; |
89 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; | 89 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; |
90 IFWL_Widget* m_pHover; | 90 IFWL_Widget* m_pHover; |
91 IFWL_Widget* m_pFocus; | 91 IFWL_Widget* m_pFocus; |
92 IFWL_Widget* m_pGrab; | 92 IFWL_Widget* m_pGrab; |
93 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; | 93 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; |
94 }; | 94 }; |
95 | 95 |
96 class CFWL_EventTarget { | 96 class CFWL_EventTarget { |
97 public: | 97 public: |
98 CFWL_EventTarget(IFWL_Widget* pListener); | 98 CFWL_EventTarget(IFWL_Widget* pListener); |
99 ~CFWL_EventTarget(); | 99 ~CFWL_EventTarget(); |
100 | 100 |
101 int32_t SetEventSource(IFWL_Widget* pSource, | 101 int32_t SetEventSource(IFWL_Widget* pSource, |
102 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | 102 uint32_t dwFilter = FWL_EVENT_ALL_MASK); |
103 bool ProcessEvent(CFWL_Event* pEvent); | 103 bool ProcessEvent(CFWL_Event* pEvent); |
104 | 104 |
105 bool IsInvalid() const { return m_bInvalid; } | 105 bool IsInvalid() const { return m_bInvalid; } |
106 void FlagInvalid() { m_bInvalid = true; } | 106 void FlagInvalid() { m_bInvalid = true; } |
107 | 107 |
108 private: | 108 private: |
109 bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const; | 109 bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const; |
110 | 110 |
111 CFX_MapPtrTemplate<void*, uint32_t> m_eventSources; | 111 CFX_MapPtrTemplate<void*, uint32_t> m_eventSources; |
112 IFWL_Widget* m_pListener; | 112 IFWL_Widget* m_pListener; |
113 bool m_bInvalid; | 113 bool m_bInvalid; |
114 }; | 114 }; |
115 | 115 |
116 #endif // XFA_FWL_CORE_FWL_NOTEIMP_H_ | 116 #endif // XFA_FWL_CORE_FWL_NOTEIMP_H_ |
OLD | NEW |