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_CFWL_NOTEDRIVER_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ |
8 #define XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ | 8 #define XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
11 #include <memory> | 11 #include <memory> |
12 #include <unordered_map> | 12 #include <unordered_map> |
13 | 13 |
14 #include "xfa/fwl/core/cfwl_event.h" | 14 #include "xfa/fwl/core/cfwl_event.h" |
15 #include "xfa/fwl/core/ifwl_widget.h" | 15 #include "xfa/fwl/core/cfwl_widget.h" |
16 #include "xfa/fxgraphics/cfx_graphics.h" | 16 #include "xfa/fxgraphics/cfx_graphics.h" |
17 | 17 |
18 class CFWL_EventTarget; | 18 class CFWL_EventTarget; |
19 class CFWL_NoteLoop; | 19 class CFWL_NoteLoop; |
20 class CFWL_TargetImp; | 20 class CFWL_TargetImp; |
21 class IFWL_Widget; | 21 class CFWL_Widget; |
22 | 22 |
23 class CFWL_NoteDriver { | 23 class CFWL_NoteDriver { |
24 public: | 24 public: |
25 CFWL_NoteDriver(); | 25 CFWL_NoteDriver(); |
26 ~CFWL_NoteDriver(); | 26 ~CFWL_NoteDriver(); |
27 | 27 |
28 void SendEvent(CFWL_Event* pNote); | 28 void SendEvent(CFWL_Event* pNote); |
29 | 29 |
30 void RegisterEventTarget(IFWL_Widget* pListener, IFWL_Widget* pEventSource); | 30 void RegisterEventTarget(CFWL_Widget* pListener, CFWL_Widget* pEventSource); |
31 void UnregisterEventTarget(IFWL_Widget* pListener); | 31 void UnregisterEventTarget(CFWL_Widget* pListener); |
32 void ClearEventTargets(bool bRemoveAll); | 32 void ClearEventTargets(bool bRemoveAll); |
33 | 33 |
34 CFWL_NoteLoop* GetTopLoop() const; | 34 CFWL_NoteLoop* GetTopLoop() const; |
35 void PushNoteLoop(CFWL_NoteLoop* pNoteLoop); | 35 void PushNoteLoop(CFWL_NoteLoop* pNoteLoop); |
36 CFWL_NoteLoop* PopNoteLoop(); | 36 CFWL_NoteLoop* PopNoteLoop(); |
37 | 37 |
38 IFWL_Widget* GetFocus() const { return m_pFocus; } | 38 CFWL_Widget* GetFocus() const { return m_pFocus; } |
39 bool SetFocus(IFWL_Widget* pFocus, bool bNotify = false); | 39 bool SetFocus(CFWL_Widget* pFocus, bool bNotify = false); |
40 void SetGrab(IFWL_Widget* pGrab, bool bSet) { | 40 void SetGrab(CFWL_Widget* pGrab, bool bSet) { |
41 m_pGrab = bSet ? pGrab : nullptr; | 41 m_pGrab = bSet ? pGrab : nullptr; |
42 } | 42 } |
43 | 43 |
44 void Run(); | 44 void Run(); |
45 | 45 |
46 void NotifyTargetHide(IFWL_Widget* pNoteTarget); | 46 void NotifyTargetHide(CFWL_Widget* pNoteTarget); |
47 void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); | 47 void NotifyTargetDestroy(CFWL_Widget* pNoteTarget); |
48 | 48 |
49 void RegisterForm(IFWL_Widget* pForm); | 49 void RegisterForm(CFWL_Widget* pForm); |
50 void UnRegisterForm(IFWL_Widget* pForm); | 50 void UnRegisterForm(CFWL_Widget* pForm); |
51 | 51 |
52 void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); | 52 void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); |
53 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); | 53 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); |
54 void ProcessMessage(CFWL_Message* pMessage); | 54 void ProcessMessage(CFWL_Message* pMessage); |
55 | 55 |
56 private: | 56 private: |
57 bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); | 57 bool DispatchMessage(CFWL_Message* pMessage, CFWL_Widget* pMessageForm); |
58 bool DoSetFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 58 bool DoSetFocus(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
59 bool DoKillFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 59 bool DoKillFocus(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
60 bool DoKey(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 60 bool DoKey(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
61 bool DoMouse(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 61 bool DoMouse(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
62 bool DoWheel(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 62 bool DoWheel(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
63 bool DoMouseEx(CFWL_Message* pMsg, IFWL_Widget* pMessageForm); | 63 bool DoMouseEx(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); |
64 void MouseSecondary(CFWL_Message* pMsg); | 64 void MouseSecondary(CFWL_Message* pMsg); |
65 bool IsValidMessage(CFWL_Message* pMessage); | 65 bool IsValidMessage(CFWL_Message* pMessage); |
66 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); | 66 CFWL_Widget* GetMessageForm(CFWL_Widget* pDstTarget); |
67 | 67 |
68 CFX_ArrayTemplate<IFWL_Widget*> m_forms; | 68 CFX_ArrayTemplate<CFWL_Widget*> m_forms; |
69 std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue; | 69 std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue; |
70 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; | 70 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; |
71 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; | 71 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; |
72 IFWL_Widget* m_pHover; | 72 CFWL_Widget* m_pHover; |
73 IFWL_Widget* m_pFocus; | 73 CFWL_Widget* m_pFocus; |
74 IFWL_Widget* m_pGrab; | 74 CFWL_Widget* m_pGrab; |
75 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; | 75 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; |
76 }; | 76 }; |
77 | 77 |
78 #endif // XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ | 78 #endif // XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ |
OLD | NEW |