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

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

Issue 2520063002: Split fwl/core class pt II. (Closed)
Patch Set: Rebase to master Created 4 years, 1 month 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/core/cfwl_widgetproperties.cpp ('k') | 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
(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_FWL_NOTEIMP_H_
8 #define XFA_FWL_CORE_FWL_NOTEIMP_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/ifwl_tooltip.h"
16 #include "xfa/fwl/core/ifwl_widget.h"
17 #include "xfa/fxgraphics/cfx_graphics.h"
18
19 class CFWL_EventTarget;
20 class CFWL_TargetImp;
21 class IFWL_ToolTip;
22 class IFWL_Widget;
23
24 class CFWL_NoteLoop {
25 public:
26 CFWL_NoteLoop();
27 ~CFWL_NoteLoop() {}
28
29 IFWL_Widget* GetForm() const { return m_pForm; }
30 bool ContinueModal() const { return m_bContinueModal; }
31 void EndModalLoop() { m_bContinueModal = false; }
32 void SetMainForm(IFWL_Widget* pForm) { m_pForm = pForm; }
33
34 private:
35 IFWL_Widget* m_pForm;
36 bool m_bContinueModal;
37 };
38
39 class CFWL_NoteDriver {
40 public:
41 CFWL_NoteDriver();
42 ~CFWL_NoteDriver();
43
44 void SendEvent(CFWL_Event* pNote);
45
46 void RegisterEventTarget(IFWL_Widget* pListener,
47 IFWL_Widget* pEventSource = nullptr,
48 uint32_t dwFilter = FWL_EVENT_ALL_MASK);
49 void UnregisterEventTarget(IFWL_Widget* pListener);
50 void ClearEventTargets(bool bRemoveAll);
51
52 CFWL_NoteLoop* GetTopLoop() const;
53 void PushNoteLoop(CFWL_NoteLoop* pNoteLoop);
54 CFWL_NoteLoop* PopNoteLoop();
55
56 IFWL_Widget* GetFocus() const { return m_pFocus; }
57 bool SetFocus(IFWL_Widget* pFocus, bool bNotify = false);
58 void SetGrab(IFWL_Widget* pGrab, bool bSet) {
59 m_pGrab = bSet ? pGrab : nullptr;
60 }
61
62 void Run();
63
64 void NotifyTargetHide(IFWL_Widget* pNoteTarget);
65 void NotifyTargetDestroy(IFWL_Widget* pNoteTarget);
66
67 void RegisterForm(IFWL_Widget* pForm);
68 void UnRegisterForm(IFWL_Widget* pForm);
69
70 void QueueMessage(std::unique_ptr<CFWL_Message> pMessage);
71 void UnqueueMessage(CFWL_NoteLoop* pNoteLoop);
72 void ProcessMessage(CFWL_Message* pMessage);
73
74 private:
75 bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm);
76 bool DoSetFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
77 bool DoKillFocus(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
78 bool DoKey(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
79 bool DoMouse(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
80 bool DoWheel(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
81 bool DoMouseEx(CFWL_Message* pMsg, IFWL_Widget* pMessageForm);
82 void MouseSecondary(CFWL_Message* pMsg);
83 bool IsValidMessage(CFWL_Message* pMessage);
84 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
85
86 CFX_ArrayTemplate<IFWL_Widget*> m_forms;
87 std::deque<std::unique_ptr<CFWL_Message>> m_noteQueue;
88 CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue;
89 std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets;
90 IFWL_Widget* m_pHover;
91 IFWL_Widget* m_pFocus;
92 IFWL_Widget* m_pGrab;
93 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
94 };
95
96 class CFWL_EventTarget {
97 public:
98 explicit CFWL_EventTarget(IFWL_Widget* pListener);
99 ~CFWL_EventTarget();
100
101 int32_t SetEventSource(IFWL_Widget* pSource,
102 uint32_t dwFilter = FWL_EVENT_ALL_MASK);
103 bool ProcessEvent(CFWL_Event* pEvent);
104
105 bool IsInvalid() const { return m_bInvalid; }
106 void FlagInvalid() { m_bInvalid = true; }
107
108 private:
109 bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const;
110
111 CFX_MapPtrTemplate<void*, uint32_t> m_eventSources;
112 IFWL_Widget* m_pListener;
113 bool m_bInvalid;
114 };
115
116 #endif // XFA_FWL_CORE_FWL_NOTEIMP_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_widgetproperties.cpp ('k') | xfa/fwl/core/fwl_noteimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698