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_SRC_FWL_CORE_FWL_NOTEIMP_H_ | |
8 #define XFA_SRC_FWL_CORE_FWL_NOTEIMP_H_ | |
9 | |
10 #include "xfa/include/fwl/core/fwl_note.h" | |
11 | |
12 class CFWL_WidgetImp; | |
13 class CFWL_ToolTipImp; | |
14 class CFWL_CoreToopTipDP; | |
15 class CFWL_NoteDriver; | |
16 class CFWL_EventTarget; | |
17 class CFWL_ToolTipContainer; | |
18 | |
19 class CFWL_NoteLoop : public IFWL_NoteLoop { | |
20 public: | |
21 CFWL_NoteLoop(CFWL_WidgetImp* pForm = NULL); | |
22 | |
23 // IFWL_NoteLoop: | |
24 ~CFWL_NoteLoop() override {} | |
25 FX_BOOL PreProcessMessage(CFWL_Message* pMessage) override; | |
26 FWL_ERR Idle(int32_t count) override; | |
27 | |
28 CFWL_WidgetImp* GetForm(); | |
29 FX_BOOL ContinueModal(); | |
30 FWL_ERR EndModalLoop(); | |
31 FX_BOOL TranslateAccelerator(CFWL_Message* pMessage); | |
32 FWL_ERR SetMainForm(CFWL_WidgetImp* pForm); | |
33 | |
34 protected: | |
35 void GenerateCommondEvent(FX_DWORD dwCommand); | |
36 | |
37 CFWL_WidgetImp* m_pForm; | |
38 FX_BOOL m_bContinueModal; | |
39 }; | |
40 class CFWL_NoteDriver : public IFWL_NoteDriver { | |
41 public: | |
42 CFWL_NoteDriver(); | |
43 ~CFWL_NoteDriver() override; | |
44 | |
45 // IFWL_NoteDriver: | |
46 FX_BOOL SendNote(CFWL_Note* pNote) override; | |
47 FX_BOOL PostMessage(CFWL_Message* pMessage) override; | |
48 FWL_ERR RegisterEventTarget(IFWL_Widget* pListener, | |
49 IFWL_Widget* pEventSource = NULL, | |
50 FX_DWORD dwFilter = FWL_EVENT_ALL_MASK) override; | |
51 FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) override; | |
52 void ClearEventTargets(FX_BOOL bRemoveAll) override; | |
53 int32_t GetQueueMaxSize() const override; | |
54 FWL_ERR SetQueueMaxSize(const int32_t size) override; | |
55 IFWL_NoteThread* GetOwnerThread() const override; | |
56 FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) override; | |
57 IFWL_NoteLoop* PopNoteLoop() override; | |
58 IFWL_Widget* GetFocus() override; | |
59 FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) override; | |
60 void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) override; | |
61 FWL_ERR Run() override; | |
62 | |
63 IFWL_Widget* GetHover(); | |
64 void SetHover(IFWL_Widget* pHover); | |
65 void NotifyTargetHide(IFWL_Widget* pNoteTarget); | |
66 void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); | |
67 void NotifyFullScreenMode(IFWL_Widget* pNoteTarget, FX_BOOL bFullScreen); | |
68 FWL_ERR RegisterForm(CFWL_WidgetImp* pForm); | |
69 FWL_ERR UnRegisterForm(CFWL_WidgetImp* pForm); | |
70 FX_BOOL QueueMessage(CFWL_Message* pMessage); | |
71 FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop); | |
72 CFWL_NoteLoop* GetTopLoop(); | |
73 int32_t CountLoop(); | |
74 void SetHook(FWLMessageHookCallback callback, void* info); | |
75 FX_BOOL ProcessMessage(CFWL_Message* pMessage); | |
76 | |
77 protected: | |
78 FX_BOOL DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); | |
79 FX_BOOL DoActivate(CFWL_MsgActivate* pMsg, IFWL_Widget* pMessageForm); | |
80 FX_BOOL DoDeactivate(CFWL_MsgDeactivate* pMsg, IFWL_Widget* pMessageForm); | |
81 FX_BOOL DoSetFocus(CFWL_MsgSetFocus* pMsg, IFWL_Widget* pMessageForm); | |
82 FX_BOOL DoKillFocus(CFWL_MsgKillFocus* pMsg, IFWL_Widget* pMessageForm); | |
83 FX_BOOL DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm); | |
84 FX_BOOL DoMouse(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); | |
85 FX_BOOL DoWheel(CFWL_MsgMouseWheel* pMsg, IFWL_Widget* pMessageForm); | |
86 FX_BOOL DoSize(CFWL_MsgSize* pMsg); | |
87 FX_BOOL DoWindowMove(CFWL_MsgWindowMove* pMsg, IFWL_Widget* pMessageForm); | |
88 FX_BOOL DoDragFiles(CFWL_MsgDropFiles* pMsg, IFWL_Widget* pMessageForm); | |
89 FX_BOOL DoMouseEx(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); | |
90 void MouseSecondary(CFWL_MsgMouse* pMsg); | |
91 FX_BOOL IsValidMessage(CFWL_Message* pMessage); | |
92 IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); | |
93 void ClearInvalidEventTargets(FX_BOOL bRemoveAll); | |
94 CFX_PtrArray m_forms; | |
95 CFX_PtrArray m_noteQueue; | |
96 CFX_PtrArray m_noteLoopQueue; | |
97 CFX_MapPtrToPtr m_eventTargets; | |
98 int32_t m_sendEventCalled; | |
99 int32_t m_maxSize; | |
100 FX_BOOL m_bFullScreen; | |
101 IFWL_Widget* m_pHover; | |
102 IFWL_Widget* m_pFocus; | |
103 IFWL_Widget* m_pGrab; | |
104 CFWL_NoteLoop* m_pNoteLoop; | |
105 FWLMessageHookCallback m_hook; | |
106 void* m_hookInfo; | |
107 }; | |
108 typedef CFX_MapPtrTemplate<void*, FX_DWORD> CFWL_EventSource; | |
109 class CFWL_EventTarget { | |
110 public: | |
111 CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener) | |
112 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} | |
113 ~CFWL_EventTarget(); | |
114 int32_t SetEventSource(IFWL_Widget* pSource, | |
115 FX_DWORD dwFilter = FWL_EVENT_ALL_MASK); | |
116 FX_BOOL ProcessEvent(CFWL_Event* pEvent); | |
117 FX_BOOL IsFilterEvent(CFWL_Event* pEvent, FX_DWORD dwFilter); | |
118 FX_BOOL IsInvalid() { return m_bInvalid; } | |
119 void FlagInvalid() { m_bInvalid = TRUE; } | |
120 | |
121 protected: | |
122 CFWL_EventSource m_eventSources; | |
123 IFWL_Widget* m_pListener; | |
124 CFWL_NoteDriver* m_pNoteDriver; | |
125 FX_BOOL m_bInvalid; | |
126 }; | |
127 class CFWL_ToolTipContainer { | |
128 public: | |
129 static CFWL_ToolTipContainer* getInstance(); | |
130 static void DeleteInstance(); | |
131 | |
132 FX_ERR AddToolTipTarget(IFWL_ToolTipTarget* pTarget); | |
133 FX_ERR RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); | |
134 IFWL_ToolTipTarget* GetCurrentToolTipTarget(); | |
135 | |
136 FX_BOOL HasToolTip(IFWL_Widget* pWidget); | |
137 | |
138 FX_BOOL ProcessEnter(CFWL_EvtMouse* pEvt, IFWL_Widget* pOwner); | |
139 FX_BOOL ProcessLeave(CFWL_EvtMouse* pEvt); | |
140 | |
141 FX_ERR SetToolTipInitialDelay(int32_t iDelayTime); | |
142 FX_ERR SetToolTipAutoPopDelay(int32_t iDelayTime); | |
143 | |
144 protected: | |
145 CFWL_ToolTipContainer(); | |
146 virtual ~CFWL_ToolTipContainer(); | |
147 | |
148 IFWL_ToolTipTarget* pCurTarget; | |
149 CFWL_ToolTipImp* m_pToolTipImp; | |
150 CFWL_CoreToopTipDP* m_ToolTipDp; | |
151 CFX_PtrArray m_arrWidget; | |
152 | |
153 private: | |
154 static CFWL_ToolTipContainer* s_pInstance; | |
155 }; | |
156 | |
157 #endif // XFA_SRC_FWL_CORE_FWL_NOTEIMP_H_ | |
OLD | NEW |