| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ | |
| 8 #define XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ | |
| 9 | |
| 10 #include <deque> | |
| 11 #include <memory> | |
| 12 #include <unordered_map> | |
| 13 | |
| 14 #include "xfa/fwl/core/cfwl_event.h" | |
| 15 #include "xfa/fwl/core/cfwl_widget.h" | |
| 16 #include "xfa/fxgraphics/cfx_graphics.h" | |
| 17 | |
| 18 class CFWL_EventTarget; | |
| 19 class CFWL_NoteLoop; | |
| 20 class CFWL_TargetImp; | |
| 21 class CFWL_Widget; | |
| 22 | |
| 23 class CFWL_NoteDriver { | |
| 24 public: | |
| 25 CFWL_NoteDriver(); | |
| 26 ~CFWL_NoteDriver(); | |
| 27 | |
| 28 void SendEvent(CFWL_Event* pNote); | |
| 29 | |
| 30 void RegisterEventTarget(CFWL_Widget* pListener, CFWL_Widget* pEventSource); | |
| 31 void UnregisterEventTarget(CFWL_Widget* pListener); | |
| 32 void ClearEventTargets(bool bRemoveAll); | |
| 33 | |
| 34 CFWL_NoteLoop* GetTopLoop() const; | |
| 35 void PushNoteLoop(CFWL_NoteLoop* pNoteLoop); | |
| 36 CFWL_NoteLoop* PopNoteLoop(); | |
| 37 | |
| 38 CFWL_Widget* GetFocus() const { return m_pFocus; } | |
| 39 bool SetFocus(CFWL_Widget* pFocus); | |
| 40 void SetGrab(CFWL_Widget* pGrab, bool bSet) { | |
| 41 m_pGrab = bSet ? pGrab : nullptr; | |
| 42 } | |
| 43 | |
| 44 void Run(); | |
| 45 | |
| 46 void NotifyTargetHide(CFWL_Widget* pNoteTarget); | |
| 47 void NotifyTargetDestroy(CFWL_Widget* pNoteTarget); | |
| 48 | |
| 49 void RegisterForm(CFWL_Widget* pForm); | |
| 50 void UnRegisterForm(CFWL_Widget* pForm); | |
| 51 | |
| 52 void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); | |
| 53 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop); | |
| 54 void ProcessMessage(CFWL_Message* pMessage); | |
| 55 | |
| 56 private: | |
| 57 bool DispatchMessage(CFWL_Message* pMessage, CFWL_Widget* pMessageForm); | |
| 58 bool DoSetFocus(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 59 bool DoKillFocus(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 60 bool DoKey(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 61 bool DoMouse(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 62 bool DoWheel(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 63 bool DoMouseEx(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); | |
| 64 void MouseSecondary(CFWL_Message* pMsg); | |
| 65 bool IsValidMessage(CFWL_Message* pMessage); | |
| 66 CFWL_Widget* GetMessageForm(CFWL_Widget* pDstTarget); | |
| 67 | |
| 68 CFX_ArrayTemplate<CFWL_Widget*> m_forms; | |
| 69 std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue; | |
| 70 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue; | |
| 71 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets; | |
| 72 CFWL_Widget* m_pHover; | |
| 73 CFWL_Widget* m_pFocus; | |
| 74 CFWL_Widget* m_pGrab; | |
| 75 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; | |
| 76 }; | |
| 77 | |
| 78 #endif // XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ | |
| OLD | NEW |