d3d8: TRACE fixes.
[wine.git] / dlls / mshtml / ipwindow.c
blobfb3c7d95277d61b8e15ada31a26811343d417d50
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 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
55 if(IsEqualGUID(&IID_IUnknown, riid)) {
56 *ppv = &This->IOleInPlaceFrame_iface;
57 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
58 *ppv = &This->IOleInPlaceFrame_iface;
59 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
60 *ppv = &This->IOleInPlaceFrame_iface;
61 }else if(IsEqualGUID(&IID_IOleInPlaceFrame, riid)) {
62 *ppv = &This->IOleInPlaceFrame_iface;
63 }else {
64 WARN("Unsopported interface %s\n", debugstr_mshtml_guid(riid));
65 *ppv = NULL;
66 return E_NOINTERFACE;
69 IUnknown_AddRef((IUnknown*)*ppv);
70 return S_OK;
73 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
75 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
76 LONG ref = InterlockedIncrement(&This->ref);
78 TRACE("(%p) ref=%d\n", This, ref);
80 return ref;
83 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
85 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
86 LONG ref = InterlockedDecrement(&This->ref);
88 TRACE("(%p) ref=%d\n", This, ref);
90 if(!ref)
91 heap_free(This);
93 return ref;
96 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
98 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
99 FIXME("(%p)->(%p)\n", This, phwnd);
100 return E_NOTIMPL;
103 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface,
104 BOOL fEnterMode)
106 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
107 FIXME("(%p)->(%x)\n", This, fEnterMode);
108 return E_NOTIMPL;
111 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
113 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
114 FIXME("(%p)->(%p)\n", This, lprectBorder);
115 return E_NOTIMPL;
118 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
119 LPCBORDERWIDTHS pborderwidths)
121 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
122 FIXME("(%p)->(%p)\n", This, pborderwidths);
123 return E_NOTIMPL;
126 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
127 LPCBORDERWIDTHS pborderwidths)
129 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
130 FIXME("(%p)->(%p)\n", This, pborderwidths);
131 return E_NOTIMPL;
134 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
135 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
137 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
138 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
139 return E_NOTIMPL;
142 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
143 LPOLEMENUGROUPWIDTHS lpMenuWidths)
145 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
146 FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths);
147 return E_NOTIMPL;
150 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
151 HOLEMENU holemenu, HWND hwndActiveObject)
153 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
154 FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject);
155 return E_NOTIMPL;
158 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
160 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
161 FIXME("(%p)->(%p)\n", This, hmenuShared);
162 return E_NOTIMPL;
165 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
166 LPCOLESTR pszStatusText)
168 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
169 FIXME("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
170 return E_NOTIMPL;
173 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
175 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
176 FIXME("(%p)->(%x)\n", This, fEnable);
177 return E_NOTIMPL;
180 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg,
181 WORD wID)
183 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
184 FIXME("(%p)->(%p %d)\n", This, lpmsg, wID);
185 return E_NOTIMPL;
188 static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = {
189 InPlaceFrame_QueryInterface,
190 InPlaceFrame_AddRef,
191 InPlaceFrame_Release,
192 InPlaceFrame_GetWindow,
193 InPlaceFrame_ContextSensitiveHelp,
194 InPlaceFrame_GetBorder,
195 InPlaceFrame_RequestBorderSpace,
196 InPlaceFrame_SetBorderSpace,
197 InPlaceFrame_SetActiveObject,
198 InPlaceFrame_InsertMenus,
199 InPlaceFrame_SetMenu,
200 InPlaceFrame_RemoveMenus,
201 InPlaceFrame_SetStatusText,
202 InPlaceFrame_EnableModeless,
203 InPlaceFrame_TranslateAccelerator
206 HRESULT create_ip_frame(IOleInPlaceFrame **ret)
208 InPlaceFrame *frame;
210 frame = heap_alloc_zero(sizeof(*frame));
211 if(!frame)
212 return E_OUTOFMEMORY;
214 frame->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl;
215 frame->ref = 1;
217 *ret = &frame->IOleInPlaceFrame_iface;
218 return S_OK;
221 typedef struct {
222 IOleInPlaceUIWindow IOleInPlaceUIWindow_iface;
223 LONG ref;
224 } InPlaceUIWindow;
226 static inline InPlaceUIWindow *impl_from_IOleInPlaceUIWindow(IOleInPlaceUIWindow *iface)
228 return CONTAINING_RECORD(iface, InPlaceUIWindow, IOleInPlaceUIWindow_iface);
231 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceUIWindow *iface, REFIID riid, void **ppv)
233 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
235 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
237 if(IsEqualGUID(&IID_IUnknown, riid)) {
238 *ppv = &This->IOleInPlaceUIWindow_iface;
239 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
240 *ppv = &This->IOleInPlaceUIWindow_iface;
241 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
242 *ppv = &This->IOleInPlaceUIWindow_iface;
243 }else {
244 WARN("Unsopported interface %s\n", debugstr_mshtml_guid(riid));
245 *ppv = NULL;
246 return E_NOINTERFACE;
249 IUnknown_AddRef((IUnknown*)*ppv);
250 return S_OK;
253 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceUIWindow *iface)
255 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
256 LONG ref = InterlockedIncrement(&This->ref);
258 TRACE("(%p) ref=%d\n", This, ref);
260 return ref;
263 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceUIWindow *iface)
265 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
266 LONG ref = InterlockedDecrement(&This->ref);
268 TRACE("(%p) ref=%d\n", This, ref);
270 if(!ref)
271 heap_free(This);
273 return ref;
276 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceUIWindow *iface, HWND *phwnd)
278 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
279 FIXME("(%p)->(%p)\n", This, phwnd);
280 return E_NOTIMPL;
283 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceUIWindow *iface,
284 BOOL fEnterMode)
286 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
287 FIXME("(%p)->(%x)\n", This, fEnterMode);
288 return E_NOTIMPL;
291 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceUIWindow *iface, LPRECT lprectBorder)
293 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
294 FIXME("(%p)->(%p)\n", This, lprectBorder);
295 return E_NOTIMPL;
298 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceUIWindow *iface,
299 LPCBORDERWIDTHS pborderwidths)
301 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
302 FIXME("(%p)->(%p)\n", This, pborderwidths);
303 return E_NOTIMPL;
306 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceUIWindow *iface,
307 LPCBORDERWIDTHS pborderwidths)
309 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
310 FIXME("(%p)->(%p)\n", This, pborderwidths);
311 return E_NOTIMPL;
314 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceUIWindow *iface,
315 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
317 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
318 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
319 return E_NOTIMPL;
322 static const IOleInPlaceUIWindowVtbl OleInPlaceUIWindowVtbl = {
323 InPlaceUIWindow_QueryInterface,
324 InPlaceUIWindow_AddRef,
325 InPlaceUIWindow_Release,
326 InPlaceUIWindow_GetWindow,
327 InPlaceUIWindow_ContextSensitiveHelp,
328 InPlaceUIWindow_GetBorder,
329 InPlaceUIWindow_RequestBorderSpace,
330 InPlaceUIWindow_SetBorderSpace,
331 InPlaceUIWindow_SetActiveObject,
334 HRESULT create_ip_window(IOleInPlaceUIWindow **ret)
336 InPlaceUIWindow *uiwindow;
338 uiwindow = heap_alloc_zero(sizeof(*uiwindow));
339 if(!uiwindow)
340 return E_OUTOFMEMORY;
342 uiwindow->IOleInPlaceUIWindow_iface.lpVtbl = &OleInPlaceUIWindowVtbl;
343 uiwindow->ref = 1;
345 *ret = &uiwindow->IOleInPlaceUIWindow_iface;
346 return S_OK;