shell32: Add some selection tests.
[wine/multimedia.git] / dlls / mshtml / ipwindow.c
blobbce01ebe99205f28111a790e7a7954e033aee195
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"
35 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 typedef struct {
40 IOleInPlaceFrame IOleInPlaceFrame_iface;
41 LONG ref;
42 } InPlaceFrame;
44 static inline InPlaceFrame *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
46 return CONTAINING_RECORD(iface, InPlaceFrame, IOleInPlaceFrame_iface);
49 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface,
50 REFIID riid, void **ppv)
52 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
54 if(IsEqualGUID(&IID_IUnknown, riid)) {
55 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56 *ppv = &This->IOleInPlaceFrame_iface;
57 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
58 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
59 *ppv = &This->IOleInPlaceFrame_iface;
60 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
61 TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv);
62 *ppv = &This->IOleInPlaceFrame_iface;
63 }else if(IsEqualGUID(&IID_IOleInPlaceFrame, riid)) {
64 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppv);
65 *ppv = &This->IOleInPlaceFrame_iface;
66 }else {
67 WARN("Unsopported interface %s\n", debugstr_guid(riid));
68 *ppv = NULL;
69 return E_NOINTERFACE;
72 IUnknown_AddRef((IUnknown*)*ppv);
73 return S_OK;
76 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
78 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
79 LONG ref = InterlockedIncrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 return ref;
86 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
88 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
89 LONG ref = InterlockedDecrement(&This->ref);
91 TRACE("(%p) ref=%d\n", This, ref);
93 if(!ref)
94 heap_free(This);
96 return ref;
99 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
101 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
102 FIXME("(%p)->(%p)\n", This, phwnd);
103 return E_NOTIMPL;
106 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface,
107 BOOL fEnterMode)
109 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
110 FIXME("(%p)->(%x)\n", This, fEnterMode);
111 return E_NOTIMPL;
114 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
116 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
117 FIXME("(%p)->(%p)\n", This, lprectBorder);
118 return E_NOTIMPL;
121 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
122 LPCBORDERWIDTHS pborderwidths)
124 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
125 FIXME("(%p)->(%p)\n", This, pborderwidths);
126 return E_NOTIMPL;
129 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
130 LPCBORDERWIDTHS pborderwidths)
132 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
133 FIXME("(%p)->(%p)\n", This, pborderwidths);
134 return E_NOTIMPL;
137 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
138 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
140 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
141 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
142 return E_NOTIMPL;
145 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
146 LPOLEMENUGROUPWIDTHS lpMenuWidths)
148 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
149 FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths);
150 return E_NOTIMPL;
153 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
154 HOLEMENU holemenu, HWND hwndActiveObject)
156 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
157 FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject);
158 return E_NOTIMPL;
161 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
163 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
164 FIXME("(%p)->(%p)\n", This, hmenuShared);
165 return E_NOTIMPL;
168 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
169 LPCOLESTR pszStatusText)
171 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
172 FIXME("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
173 return E_NOTIMPL;
176 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
178 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
179 FIXME("(%p)->(%x)\n", This, fEnable);
180 return E_NOTIMPL;
183 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg,
184 WORD wID)
186 InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
187 FIXME("(%p)->(%p %d)\n", This, lpmsg, wID);
188 return E_NOTIMPL;
191 static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = {
192 InPlaceFrame_QueryInterface,
193 InPlaceFrame_AddRef,
194 InPlaceFrame_Release,
195 InPlaceFrame_GetWindow,
196 InPlaceFrame_ContextSensitiveHelp,
197 InPlaceFrame_GetBorder,
198 InPlaceFrame_RequestBorderSpace,
199 InPlaceFrame_SetBorderSpace,
200 InPlaceFrame_SetActiveObject,
201 InPlaceFrame_InsertMenus,
202 InPlaceFrame_SetMenu,
203 InPlaceFrame_RemoveMenus,
204 InPlaceFrame_SetStatusText,
205 InPlaceFrame_EnableModeless,
206 InPlaceFrame_TranslateAccelerator
209 HRESULT create_ip_frame(IOleInPlaceFrame **ret)
211 InPlaceFrame *frame;
213 frame = heap_alloc_zero(sizeof(*frame));
214 if(!frame)
215 return E_OUTOFMEMORY;
217 frame->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl;
218 frame->ref = 1;
220 *ret = &frame->IOleInPlaceFrame_iface;
221 return S_OK;
224 typedef struct {
225 IOleInPlaceUIWindow IOleInPlaceUIWindow_iface;
226 LONG ref;
227 } InPlaceUIWindow;
229 static inline InPlaceUIWindow *impl_from_IOleInPlaceUIWindow(IOleInPlaceUIWindow *iface)
231 return CONTAINING_RECORD(iface, InPlaceUIWindow, IOleInPlaceUIWindow_iface);
234 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceUIWindow *iface, REFIID riid, void **ppv)
236 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
238 if(IsEqualGUID(&IID_IUnknown, riid)) {
239 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
240 *ppv = &This->IOleInPlaceUIWindow_iface;
241 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
242 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
243 *ppv = &This->IOleInPlaceUIWindow_iface;
244 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
245 TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv);
246 *ppv = &This->IOleInPlaceUIWindow_iface;
247 }else {
248 WARN("Unsopported interface %s\n", debugstr_guid(riid));
249 *ppv = NULL;
250 return E_NOINTERFACE;
253 IUnknown_AddRef((IUnknown*)*ppv);
254 return S_OK;
257 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceUIWindow *iface)
259 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
260 LONG ref = InterlockedIncrement(&This->ref);
262 TRACE("(%p) ref=%d\n", This, ref);
264 return ref;
267 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceUIWindow *iface)
269 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
270 LONG ref = InterlockedDecrement(&This->ref);
272 TRACE("(%p) ref=%d\n", This, ref);
274 if(!ref)
275 heap_free(This);
277 return ref;
280 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceUIWindow *iface, HWND *phwnd)
282 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
283 FIXME("(%p)->(%p)\n", This, phwnd);
284 return E_NOTIMPL;
287 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceUIWindow *iface,
288 BOOL fEnterMode)
290 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
291 FIXME("(%p)->(%x)\n", This, fEnterMode);
292 return E_NOTIMPL;
295 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceUIWindow *iface, LPRECT lprectBorder)
297 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
298 FIXME("(%p)->(%p)\n", This, lprectBorder);
299 return E_NOTIMPL;
302 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceUIWindow *iface,
303 LPCBORDERWIDTHS pborderwidths)
305 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
306 FIXME("(%p)->(%p)\n", This, pborderwidths);
307 return E_NOTIMPL;
310 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceUIWindow *iface,
311 LPCBORDERWIDTHS pborderwidths)
313 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
314 FIXME("(%p)->(%p)\n", This, pborderwidths);
315 return E_NOTIMPL;
318 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceUIWindow *iface,
319 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
321 InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
322 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
323 return E_NOTIMPL;
326 static const IOleInPlaceUIWindowVtbl OleInPlaceUIWindowVtbl = {
327 InPlaceUIWindow_QueryInterface,
328 InPlaceUIWindow_AddRef,
329 InPlaceUIWindow_Release,
330 InPlaceUIWindow_GetWindow,
331 InPlaceUIWindow_ContextSensitiveHelp,
332 InPlaceUIWindow_GetBorder,
333 InPlaceUIWindow_RequestBorderSpace,
334 InPlaceUIWindow_SetBorderSpace,
335 InPlaceUIWindow_SetActiveObject,
338 HRESULT create_ip_window(IOleInPlaceUIWindow **ret)
340 InPlaceUIWindow *uiwindow;
342 uiwindow = heap_alloc_zero(sizeof(*uiwindow));
343 if(!uiwindow)
344 return E_OUTOFMEMORY;
346 uiwindow->IOleInPlaceUIWindow_iface.lpVtbl = &OleInPlaceUIWindowVtbl;
347 uiwindow->ref = 1;
349 *ret = &uiwindow->IOleInPlaceUIWindow_iface;
350 return S_OK;