Do not clear FD_WINE_CONNECTED on shutdown(). FD_WINE_CONNECTED
[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 /**********************************************************************
32  * Implement the IConnectionPointContainer interface
33  */
34
35 static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
36                                            REFIID riid, LPVOID *ppobj)
37 {
38     ICOM_THIS(IConnectionPointContainerImpl, iface);
39
40     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
41     return E_NOINTERFACE;
42 }
43
44 static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
45 {
46     ICOM_THIS(IConnectionPointContainerImpl, iface);
47
48     TRACE("\n");
49     return ++(This->ref);
50 }
51
52 static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
53 {
54     ICOM_THIS(IConnectionPointContainerImpl, iface);
55
56     /* static class, won't be freed */
57     TRACE("\n");
58     return --(This->ref);
59 }
60
61 /* Get a list of connection points inside this container. */
62 static HRESULT WINAPI WBCPC_EnumConnectionPoints(LPCONNECTIONPOINTCONTAINER iface,
63                                                  LPENUMCONNECTIONPOINTS *ppEnum)
64 {
65     FIXME("stub: IEnumConnectionPoints = %p\n", *ppEnum);
66     return S_OK;
67 }
68
69 /* Retrieve the connection point in this container associated with the
70  * riid interface.  When events occur in the control, the control can
71  * call backwards into its embedding site, through these interfaces.
72  */
73 static HRESULT WINAPI WBCPC_FindConnectionPoint(LPCONNECTIONPOINTCONTAINER iface,
74                                                 REFIID riid, LPCONNECTIONPOINT *ppCP)
75 {
76     TRACE(": IID = %s, IConnectionPoint = %p\n", debugstr_guid(riid), *ppCP);
77
78     /* For now, return the same IConnectionPoint object for both
79      * event interface requests.
80      */
81     if (IsEqualGUID (&IID_INotifyDBEvents, riid))
82     {
83         TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
84               &SHDOCVW_ConnectionPoint);
85         *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
86         return S_OK;
87     }
88     else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
89     {
90         TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
91               &SHDOCVW_ConnectionPoint);
92         *ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
93         return S_OK;
94     }
95
96     return E_FAIL;
97 }
98
99 /**********************************************************************
100  * IConnectionPointContainer virtual function table for IE Web Browser component
101  */
102
103 static ICOM_VTABLE(IConnectionPointContainer) WBCPC_Vtbl =
104 {
105     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
106     WBCPC_QueryInterface,
107     WBCPC_AddRef,
108     WBCPC_Release,
109     WBCPC_EnumConnectionPoints,
110     WBCPC_FindConnectionPoint
111 };
112
113 IConnectionPointContainerImpl SHDOCVW_ConnectionPointContainer = { &WBCPC_Vtbl, 1 };
114
115
116 /**********************************************************************
117  * Implement the IConnectionPoint interface
118  */
119
120 static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
121                                           REFIID riid, LPVOID *ppobj)
122 {
123     ICOM_THIS(IConnectionPointImpl, iface);
124
125     FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
126     return E_NOINTERFACE;
127 }
128
129 static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
130 {
131     ICOM_THIS(IConnectionPointImpl, iface);
132
133     TRACE("\n");
134     return ++(This->ref);
135 }
136
137 static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
138 {
139     ICOM_THIS(IConnectionPointImpl, iface);
140
141     /* static class, won't be freed */
142     TRACE("\n");
143     return --(This->ref);
144 }
145
146 static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
147 {
148     FIXME("stub: %s\n", debugstr_guid(pIId));
149     return S_OK;
150 }
151
152 /* Get this connection point's owning container */
153 static HRESULT WINAPI
154 WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
155                                  LPCONNECTIONPOINTCONTAINER *ppCPC)
156 {
157     FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
158     return S_OK;
159 }
160
161 /* Connect the pUnkSink event-handling implementation (in the control site)
162  * to this connection point.  Return a handle to this connection in
163  * pdwCookie (for later use in Unadvise()).
164  */
165 static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
166                                   LPUNKNOWN pUnkSink, DWORD *pdwCookie)
167 {
168     static int new_cookie;
169
170     FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
171
172     *pdwCookie = ++new_cookie;
173     TRACE ("Returning cookie = %ld\n", *pdwCookie);
174
175     return S_OK;
176 }
177
178 /* Disconnect this implementation from the connection point. */
179 static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
180                                     DWORD dwCookie)
181 {
182     FIXME("stub: cookie to disconnect = %ld\n", dwCookie);
183     return S_OK;
184 }
185
186 /* Get a list of connections in this connection point. */
187 static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
188                                            LPENUMCONNECTIONS *ppEnum)
189 {
190     FIXME("stub: IEnumConnections = %p\n", *ppEnum);
191     return S_OK;
192 }
193
194 /**********************************************************************
195  * IConnectionPoint virtual function table for IE Web Browser component
196  */
197
198 static ICOM_VTABLE(IConnectionPoint) WBCP_Vtbl =
199 {
200     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
201     WBCP_QueryInterface,
202     WBCP_AddRef,
203     WBCP_Release,
204     WBCP_GetConnectionInterface,
205     WBCP_GetConnectionPointContainer,
206     WBCP_Advise,
207     WBCP_Unadvise,
208     WBCP_EnumConnections
209 };
210
211 IConnectionPointImpl SHDOCVW_ConnectionPoint = { &WBCP_Vtbl, 1 };