atl100: Trace ATL version and keep debug channel consistent.
[wine.git] / dlls / mshtml / ipwindow.c
blobf4f32c721cf3047b888ed9ba4c9a1f89dbd2833f
1 /*
2 * Copyright 2010 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "shlobj.h"
31 #include "mshtml_private.h"
32 #include "pluginhost.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 typedef struct {
39 IOleInPlaceFrame IOleInPlaceFrame_iface;
40 LONG ref;
41 } InPlaceFrame;
43 static inline InPlaceFrame *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
45 return CONTAINING_RECORD(iface, InPlaceFrame, IOleInPlaceFrame_iface);
48 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface,
49 REFIID riid, void **ppv)
51 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
53 if(IsEqualGUID(&IID_IUnknown, riid)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
55 *ppv = &This->IOleInPlaceFrame_iface;
56 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
57 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
58 *ppv = &This->IOleInPlaceFrame_iface;
59 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
60 TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv);
61 *ppv = &This->IOleInPlaceFrame_iface;
62 }else if(IsEqualGUID(&IID_IOleInPlaceFrame, riid)) {
63 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppv);
64 *ppv = &This->IOleInPlaceFrame_iface;
65 }else {
66 WARN("Unsopported interface %s\n", debugstr_guid(riid));
67 *ppv = NULL;
68 return E_NOINTERFACE;
71 IUnknown_AddRef((IUnknown*)*ppv);
72 return S_OK;
75 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
77 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
78 LONG ref = InterlockedIncrement(&This->ref);
80 TRACE("(%p) ref=%d\n", This, ref);
82 return ref;
85 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
87 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
88 LONG ref = InterlockedDecrement(&This->ref);
90 TRACE("(%p) ref=%d\n", This, ref);
92 if(!ref)
93 heap_free(This);
95 return ref;
98 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
100 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
101 FIXME("(%p)->(%p)\n", This, phwnd);
102 return E_NOTIMPL;
105 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface,
106 BOOL fEnterMode)
108 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
109 FIXME("(%p)->(%x)\n", This, fEnterMode);
110 return E_NOTIMPL;
113 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
115 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
116 FIXME("(%p)->(%p)\n", This, lprectBorder);
117 return E_NOTIMPL;
120 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
121 LPCBORDERWIDTHS pborderwidths)
123 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
124 FIXME("(%p)->(%p)\n", This, pborderwidths);
125 return E_NOTIMPL;
128 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
129 LPCBORDERWIDTHS pborderwidths)
131 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
132 FIXME("(%p)->(%p)\n", This, pborderwidths);
133 return E_NOTIMPL;
136 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
137 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
139 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
140 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
141 return E_NOTIMPL;
144 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
145 LPOLEMENUGROUPWIDTHS lpMenuWidths)
147 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
148 FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths);
149 return E_NOTIMPL;
152 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
153 HOLEMENU holemenu, HWND hwndActiveObject)
155 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
156 FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject);
157 return E_NOTIMPL;
160 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
162 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
163 FIXME("(%p)->(%p)\n", This, hmenuShared);
164 return E_NOTIMPL;
167 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
168 LPCOLESTR pszStatusText)
170 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
171 FIXME("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
172 return E_NOTIMPL;
175 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
177 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
178 FIXME("(%p)->(%x)\n", This, fEnable);
179 return E_NOTIMPL;
182 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg,
183 WORD wID)
185 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
186 FIXME("(%p)->(%p %d)\n", This, lpmsg, wID);
187 return E_NOTIMPL;
190 static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = {
191 InPlaceFrame_QueryInterface,
192 InPlaceFrame_AddRef,
193 InPlaceFrame_Release,
194 InPlaceFrame_GetWindow,
195 InPlaceFrame_ContextSensitiveHelp,
196 InPlaceFrame_GetBorder,
197 InPlaceFrame_RequestBorderSpace,
198 InPlaceFrame_SetBorderSpace,
199 InPlaceFrame_SetActiveObject,
200 InPlaceFrame_InsertMenus,
201 InPlaceFrame_SetMenu,
202 InPlaceFrame_RemoveMenus,
203 InPlaceFrame_SetStatusText,
204 InPlaceFrame_EnableModeless,
205 InPlaceFrame_TranslateAccelerator
208 HRESULT create_ip_frame(IOleInPlaceFrame **ret)
210 InPlaceFrame *frame;
212 frame = heap_alloc_zero(sizeof(*frame));
213 if(!frame)
214 return E_OUTOFMEMORY;
216 frame->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl;
217 frame->ref = 1;
219 *ret = &frame->IOleInPlaceFrame_iface;
220 return S_OK;
223 typedef struct {
224 IOleInPlaceUIWindow IOleInPlaceUIWindow_iface;
225 LONG ref;
226 } InPlaceUIWindow;
228 static inline InPlaceUIWindow *impl_from_IOleInPlaceUIWindow(IOleInPlaceUIWindow *iface)
230 return CONTAINING_RECORD(iface, InPlaceUIWindow, IOleInPlaceUIWindow_iface);
233 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceUIWindow *iface, REFIID riid, void **ppv)
235 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
237 if(IsEqualGUID(&IID_IUnknown, riid)) {
238 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
239 *ppv = &This->IOleInPlaceUIWindow_iface;
240 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
241 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
242 *ppv = &This->IOleInPlaceUIWindow_iface;
243 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
244 TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv);
245 *ppv = &This->IOleInPlaceUIWindow_iface;
246 }else {
247 WARN("Unsopported interface %s\n", debugstr_guid(riid));
248 *ppv = NULL;
249 return E_NOINTERFACE;
252 IUnknown_AddRef((IUnknown*)*ppv);
253 return S_OK;
256 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceUIWindow *iface)
258 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
259 LONG ref = InterlockedIncrement(&This->ref);
261 TRACE("(%p) ref=%d\n", This, ref);
263 return ref;
266 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceUIWindow *iface)
268 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
269 LONG ref = InterlockedDecrement(&This->ref);
271 TRACE("(%p) ref=%d\n", This, ref);
273 if(!ref)
274 heap_free(This);
276 return ref;
279 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceUIWindow *iface, HWND *phwnd)
281 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
282 FIXME("(%p)->(%p)\n", This, phwnd);
283 return E_NOTIMPL;
286 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceUIWindow *iface,
287 BOOL fEnterMode)
289 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
290 FIXME("(%p)->(%x)\n", This, fEnterMode);
291 return E_NOTIMPL;
294 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceUIWindow *iface, LPRECT lprectBorder)
296 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
297 FIXME("(%p)->(%p)\n", This, lprectBorder);
298 return E_NOTIMPL;
301 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceUIWindow *iface,
302 LPCBORDERWIDTHS pborderwidths)
304 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
305 FIXME("(%p)->(%p)\n", This, pborderwidths);
306 return E_NOTIMPL;
309 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceUIWindow *iface,
310 LPCBORDERWIDTHS pborderwidths)
312 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
313 FIXME("(%p)->(%p)\n", This, pborderwidths);
314 return E_NOTIMPL;
317 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceUIWindow *iface,
318 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
320 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
321 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
322 return E_NOTIMPL;
325 static const IOleInPlaceUIWindowVtbl OleInPlaceUIWindowVtbl = {
326 InPlaceUIWindow_QueryInterface,
327 InPlaceUIWindow_AddRef,
328 InPlaceUIWindow_Release,
329 InPlaceUIWindow_GetWindow,
330 InPlaceUIWindow_ContextSensitiveHelp,
331 InPlaceUIWindow_GetBorder,
332 InPlaceUIWindow_RequestBorderSpace,
333 InPlaceUIWindow_SetBorderSpace,
334 InPlaceUIWindow_SetActiveObject,
337 HRESULT create_ip_window(IOleInPlaceUIWindow **ret)
339 InPlaceUIWindow *uiwindow;
341 uiwindow = heap_alloc_zero(sizeof(*uiwindow));
342 if(!uiwindow)
343 return E_OUTOFMEMORY;
345 uiwindow->IOleInPlaceUIWindow_iface.lpVtbl = &OleInPlaceUIWindowVtbl;
346 uiwindow->ref = 1;
348 *ret = &uiwindow->IOleInPlaceUIWindow_iface;
349 return S_OK;