Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fwl / src / core / include / fwl_noteimp.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_NOTE_IMP_H\r
8 #define _FWL_NOTE_IMP_H\r
9 class CFWL_Target;\r
10 class CFWL_WidgetImp;\r
11 class CFWL_NoteThread;\r
12 class CFWL_ToolTipImp;\r
13 class IFWL_ToolTipTarget;\r
14 class CFWL_CoreToopTipDP;\r
15 class CFWL_NoteLoop;\r
16 class CFWL_NoteDriver;\r
17 class CFWL_EventTarget;\r
18 class CFWL_ToolTipContainer;\r
19 class CFWL_NoteLoop : public CFX_Object\r
20 {\r
21 public:\r
22     CFWL_NoteLoop(CFWL_WidgetImp *pForm = NULL);\r
23     virtual FX_BOOL PreProcessMessage(CFWL_Message *pMessage);\r
24     virtual FWL_ERR     Idle(FX_INT32 count);\r
25     CFWL_WidgetImp*     GetForm();\r
26     FX_BOOL     ContinueModal();\r
27     FWL_ERR     EndModalLoop();\r
28     FX_BOOL TranslateAccelerator(CFWL_Message *pMessage);\r
29     FWL_ERR     SetMainForm(CFWL_WidgetImp *pForm);\r
30 protected:\r
31     void GenerateCommondEvent(FX_DWORD dwCommand);\r
32 \r
33     CFWL_WidgetImp      *m_pForm;\r
34     FX_BOOL                     m_bContinueModal;\r
35 };\r
36 class CFWL_NoteDriver : public CFX_Object\r
37 {\r
38 public:\r
39     CFWL_NoteDriver();\r
40     ~CFWL_NoteDriver();\r
41     virtual FX_BOOL             SendNote(CFWL_Note *pNote);\r
42     virtual FX_BOOL             PostMessage(CFWL_Message *pMessage);\r
43     virtual FWL_ERR             RegisterEventTarget(IFWL_Widget *pListener, IFWL_Widget *pEventSource = NULL, FX_DWORD dwFilter = FWL_EVENT_ALL_MASK);\r
44     virtual FWL_ERR             UnregisterEventTarget(IFWL_Widget *pListener);\r
45     virtual     void            ClearEventTargets(FX_BOOL bRemoveAll);\r
46     virtual FX_INT32    GetQueueMaxSize() const;\r
47     virtual FWL_ERR             SetQueueMaxSize(const FX_INT32 size);\r
48     virtual IFWL_NoteThread* GetOwnerThread() const;\r
49     virtual FWL_ERR             PushNoteLoop(IFWL_NoteLoop *pNoteLoop);\r
50     virtual IFWL_NoteLoop* PopNoteLoop();\r
51     virtual FX_BOOL             SetFocus(IFWL_Widget *pFocus, FX_BOOL bNotify = FALSE);\r
52     virtual     FWL_ERR         Run();\r
53     IFWL_Widget*                GetFocus();\r
54     IFWL_Widget*                GetHover();\r
55     void                                SetHover(IFWL_Widget *pHover);\r
56     void                                SetGrab(IFWL_Widget *pGrab, FX_BOOL bSet);\r
57     void                                NotifyTargetHide(IFWL_Widget *pNoteTarget);\r
58     void                                NotifyTargetDestroy(IFWL_Widget *pNoteTarget);\r
59     void                                NotifyFullScreenMode(IFWL_Widget *pNoteTarget, FX_BOOL bFullScreen);\r
60     FWL_ERR                             RegisterForm(CFWL_WidgetImp *pForm);\r
61     FWL_ERR                             UnRegisterForm(CFWL_WidgetImp *pForm);\r
62     FX_BOOL                             QueueMessage(CFWL_Message *pMessage);\r
63     FX_BOOL                             UnqueueMessage(CFWL_NoteLoop *pNoteLoop);\r
64     CFWL_NoteLoop*              GetTopLoop();\r
65     FX_INT32            CountLoop();\r
66     void                SetHook(FWLMessageHookCallback callback, FX_LPVOID info);\r
67     FX_BOOL                             ProcessMessage(CFWL_Message *pMessage);\r
68 protected:\r
69     FX_BOOL                             DispatchMessage(CFWL_Message *pMessage, IFWL_Widget *pMessageForm);\r
70     FX_BOOL                             DoActivate(CFWL_MsgActivate *pMsg, IFWL_Widget *pMessageForm);\r
71     FX_BOOL                             DoDeactivate(CFWL_MsgDeactivate *pMsg, IFWL_Widget *pMessageForm);\r
72     FX_BOOL                             DoSetFocus(CFWL_MsgSetFocus *pMsg, IFWL_Widget *pMessageForm);\r
73     FX_BOOL                             DoKillFocus(CFWL_MsgKillFocus *pMsg, IFWL_Widget *pMessageForm);\r
74     FX_BOOL                             DoKey(CFWL_MsgKey *pMsg, IFWL_Widget *pMessageForm);\r
75     FX_BOOL                             DoMouse(CFWL_MsgMouse *pMsg, IFWL_Widget *pMessageForm);\r
76     FX_BOOL                             DoWheel(CFWL_MsgMouseWheel *pMsg, IFWL_Widget *pMessageForm);\r
77     FX_BOOL                             DoSize(CFWL_MsgSize *pMsg);\r
78     FX_BOOL                             DoWindowMove(CFWL_MsgWindowMove *pMsg, IFWL_Widget *pMessageForm);\r
79     FX_BOOL                             DoDragFiles(CFWL_MsgDropFiles *pMsg, IFWL_Widget *pMessageForm);\r
80     FX_BOOL                             DoMouseEx(CFWL_MsgMouse *pMsg, IFWL_Widget *pMessageForm);\r
81     void                                MouseSecondary(CFWL_MsgMouse *pMsg);\r
82     FX_BOOL                             IsValidMessage(CFWL_Message *pMessage);\r
83     IFWL_Widget*                GetMessageForm(IFWL_Widget *pDstTarget);\r
84     void                                ClearInvalidEventTargets(FX_BOOL bRemoveAll);\r
85     CFX_PtrArray                m_forms;\r
86     CFX_PtrArray                m_noteQueue;\r
87     CFX_PtrArray                m_noteLoopQueue;\r
88     CFX_MapPtrToPtr             m_eventTargets;\r
89     FX_INT32                    m_sendEventCalled;\r
90     FX_INT32                    m_maxSize;\r
91     FX_BOOL                             m_bFullScreen;\r
92     IFWL_Widget                 *m_pHover;\r
93     IFWL_Widget                 *m_pFocus;\r
94     IFWL_Widget                 *m_pGrab;\r
95     CFWL_NoteLoop               *m_pNoteLoop;\r
96     FWLMessageHookCallback m_hook;\r
97     FX_LPVOID              m_hookInfo;\r
98 };\r
99 typedef CFX_MapPtrTemplate<FX_LPVOID, FX_DWORD> CFWL_EventSource;\r
100 class CFWL_EventTarget : public CFX_Object\r
101 {\r
102 public:\r
103     CFWL_EventTarget(CFWL_NoteDriver *pNoteDriver, IFWL_Widget *pListener)\r
104         : m_pNoteDriver(pNoteDriver)\r
105         , m_pListener(pListener)\r
106         , m_bInvalid(FALSE)\r
107     {\r
108     }\r
109     ~CFWL_EventTarget();\r
110     FX_INT32 SetEventSource(IFWL_Widget *pSource, FX_DWORD dwFilter = FWL_EVENT_ALL_MASK);\r
111     FX_BOOL  ProcessEvent(CFWL_Event *pEvent);\r
112     FX_BOOL  IsFilterEvent(CFWL_Event *pEvent, FX_DWORD dwFilter);\r
113     FX_BOOL      IsInvalid()\r
114     {\r
115         return m_bInvalid;\r
116     }\r
117     void         FlagInvalid()\r
118     {\r
119         m_bInvalid = TRUE;\r
120     }\r
121 protected:\r
122     CFWL_EventSource m_eventSources;\r
123     IFWL_Widget *m_pListener;\r
124     CFWL_NoteDriver *m_pNoteDriver;\r
125     FX_BOOL     m_bInvalid;\r
126 };\r
127 class CFWL_ToolTipContainer: public CFX_Object\r
128 {\r
129 public:\r
130     virtual ~CFWL_ToolTipContainer();\r
131     static CFWL_ToolTipContainer* getInstance();\r
132 \r
133     FX_ERR              AddToolTipTarget(IFWL_ToolTipTarget *pTarget);\r
134     FX_ERR              RemoveToolTipTarget(IFWL_ToolTipTarget *pTarget);\r
135     IFWL_ToolTipTarget* GetCurrentToolTipTarget();\r
136 \r
137     FX_BOOL HasToolTip(IFWL_Widget *pWidget);\r
138 \r
139     FX_BOOL ProcessEnter(CFWL_EvtMouse *pEvt, IFWL_Widget *pOwner);\r
140     FX_BOOL ProcessLeave(CFWL_EvtMouse *pEvt);\r
141 \r
142     FX_ERR  SetToolTipInitialDelay(FX_INT32 iDelayTime);\r
143     FX_ERR      SetToolTipAutoPopDelay(FX_INT32 iDelayTime);\r
144 protected:\r
145     CFWL_ToolTipContainer();\r
146 \r
147     IFWL_ToolTipTarget          *pCurTarget;\r
148     CFWL_ToolTipImp                     *m_pToolTipImp;\r
149     CFWL_CoreToopTipDP          *m_ToolTipDp;\r
150     CFX_PtrArray                        m_arrWidget;\r
151 };\r
152 #endif\r