Fixed a few more headers dependency issues.
[wine] / dlls / shdocvw / events.c
1 /*
2  * Implementation of event-related interfaces for IE Web Browser control:
3  *
4  *  - IConnectionPointContainer
5  *  - IConnectionPoint
6  *
7  * Copyright 2001 John R. Sheets (for CodeWeavers)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include <string.h>
25 #include "wine/debug.h"
26 #include "shdocvw.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
29
30
31 static const GUID IID_INotifyDBEvents =
32     { 0xdb526cc0, 0xd188, 0x11cd, { 0xad, 0x48, 0x00, 0xaa, 0x00, 0x3c, 0x9c, 0xb6 } };
33
34 /**********************************************************************
35  * Implement the IConnectionPointContainer interface
36  */
37
38 static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
39                                            REFIID riid, LPVOID *ppobj)
40 {
41     ICOM_THIS(IConnectionPointContainerImpl, iface);
42
43     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
44     return E_NOINTERFACE;
45 }
46
47 static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
48 {
49     ICOM_THIS(IConnectionPointContainerImpl, iface);
50
51     TRACE("\n");
52     return ++(This->ref);
53 }
54
55 static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
56 {
57     ICOM_THIS(IConnectionPointContainerImpl, iface);
58
59     /* static class, won't be freed */
60     TRACE("\n");
61     return --(This->ref);
62 }
63
64 /* Get a list of connection points inside this container. */
65 static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
66                                                  LPENUMCONNECTIONPOINTS *ppEnum)
67 {
68     FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
69     return S_OK;
70 }
71
72 /* Retrieve the connection point in this container associated with the
73  * riid interface.  When events occur in the control, the control can
74  * call backwards into its embedding site, through these interfaces.
75  */
76 static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
77                                                 REFIID riid, LPCONNECTIONPOINT *ppCP)
78 {
79     TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
80
81     /* For now, return the same IConnectionPoint object for both
82      * event interface requests.
83      */
84     if (IsEqualGUID (&IID_INotifyDBEvents, riid))
85     {
86         TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
87               &SHDOCVW_ConnectionPoint);
88         *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
89         return S_OK;
90     }
91     else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
92     {
93         TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
94               &SHDOCVW_ConnectionPoint);
95         *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
96         return S_OK;
97     }
98
99     return E_FAIL;
100 }
101
102 /**********************************************************************
103  * IConnectionPointContainer virtual function table for IE Web Browser component
104  */
105
106 static ICOM_VTABLE(IConnectionPointContainer) WBCPC_Vtbl =
107 {
108     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
109     WBCPC_QueryInterface,
110     WBCPC_AddRef,
111     WBCPC_Release,
112     WBCPC_EnumConnectionPoints,
113     WBCPC_FindConnectionPoint
114 };
115
116 IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 };
117
118
119 /**********************************************************************
120  * Implement the IConnectionPoint interface
121  */
122
123 static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
124                                           REFIID riid, LPVOID *ppobj)
125 {
126     ICOM_THIS(IConnectionPointImpl, iface);
127
128     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
129     return E_NOINTERFACE;
130 }
131
132 static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
133 {
134     ICOM_THIS(IConnectionPointImpl, iface);
135
136     TRACE("\n");
137     return ++(This->ref);
138 }
139
140 static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
141 {
142     ICOM_THIS(IConnectionPointImpl, iface);
143
144     /* static class, won't be freed */
145     TRACE("\n");
146     return --(This->ref);
147 }
148
149 static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
150 {
151     FIXME("stub: %s\n", debugstr_guid(pIId));
152     return S_OK;
153 }
154
155 /* Get this connection point's owning container */
156 static HRESULT WINAPI
157 WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
158                                  LPCONNECTIONPOINTCONTAINER *ppCPC)
159 {
160     FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
161     return S_OK;
162 }
163
164 /* Connect the pUnkSink event-handling implementation (in the control site)
165  * to this connection point.  Return a handle to this connection in
166  * pdwCookie (for later use in Unadvise()).
167  */
168 static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
169                                   LPUNKNOWN pUnkSink, DWORD *pdwCookie)
170 {
171     static int new_cookie;
172
173     FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
174
175     *pdwCookie = ++new_cookie;
176     TRACE ("Returning cookie = %ld\n", *pdwCookie);
177
178     return S_OK;
179 }
180
181 /* Disconnect this implementation from the connection point. */
182 static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
183                                     DWORD dwCookie)
184 {
185     FIXME("stub: cookie to disconnect = %lx\n", dwCookie);
186     return S_OK;
187 }
188
189 /* Get a list of connections in this connection point. */
190 static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
191                                            LPENUMCONNECTIONS *ppEnum)
192 {
193     FIXME("stub: IEnumConnections = %p\n", *ppEnum);
194     return S_OK;
195 }
196
197 /**********************************************************************
198  * IConnectionPoint virtual function table for IE Web Browser component
199  */
200
201 static ICOM_VTABLE(IConnectionPoint) WBCP_Vtbl =
202 {
203     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
204     WBCP_QueryInterface,
205     WBCP_AddRef,
206     WBCP_Release,
207     WBCP_GetConnectionInterface,
208     WBCP_GetConnectionPointContainer,
209     WBCP_Advise,
210     WBCP_Unadvise,
211     WBCP_EnumConnections
212 };
213
214 IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 };