push ac8730bd9057ca84ecf262ddc5d43fb7b5849da7
[wine/hacks.git] / dlls / mshtml / htmliframe.c
blob232cbfb66203d7fa50aef5aeca817395fbfe4bc9
1 /*
2 * Copyright 2008 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 <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLElement element;
36 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
38 LONG ref;
40 nsIDOMHTMLIFrameElement *nsiframe;
41 } HTMLIFrame;
43 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
45 #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
47 static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
49 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
51 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 static ULONG WINAPI HTMLIFrameBase2_AddRef(IHTMLFrameBase2 *iface)
56 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
58 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 static ULONG WINAPI HTMLIFrameBase2_Release(IHTMLFrameBase2 *iface)
63 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
65 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
70 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
71 FIXME("(%p)\n", This);
72 return E_NOTIMPL;
75 static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
79 FIXME("(%p)\n", This);
80 return E_NOTIMPL;
83 static HRESULT WINAPI HTMLIFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
86 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
87 FIXME("(%p)\n", This);
88 return E_NOTIMPL;
91 static HRESULT WINAPI HTMLIFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
92 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
93 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
95 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
96 FIXME("(%p)\n", This);
97 return E_NOTIMPL;
100 static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
102 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
103 FIXME("(%p)->(%p)\n", This, p);
104 return E_NOTIMPL;
107 static HRESULT WINAPI HTMLIFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
109 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
110 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
111 return E_NOTIMPL;
114 static HRESULT WINAPI HTMLIFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
116 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
117 FIXME("(%p)->(%p)\n", This, p);
118 return E_NOTIMPL;
121 static HRESULT WINAPI HTMLIFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
123 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
124 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
125 return E_NOTIMPL;
128 static HRESULT WINAPI HTMLIFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
130 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
131 FIXME("(%p)->(%p)\n", This, p);
132 return E_NOTIMPL;
135 static HRESULT WINAPI HTMLIFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
137 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
138 FIXME("(%p)->(%p)\n", This, p);
139 return E_NOTIMPL;
142 static HRESULT WINAPI HTMLIFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
144 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
145 FIXME("(%p)->(%x)\n", This, v);
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLIFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
151 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
152 FIXME("(%p)->(%p)\n", This, p);
153 return E_NOTIMPL;
156 #undef HTMLFRAMEBASE2_THIS
158 static const IHTMLFrameBase2Vtbl HTMLIFrameBase2Vtbl = {
159 HTMLIFrameBase2_QueryInterface,
160 HTMLIFrameBase2_AddRef,
161 HTMLIFrameBase2_Release,
162 HTMLIFrameBase2_GetTypeInfoCount,
163 HTMLIFrameBase2_GetTypeInfo,
164 HTMLIFrameBase2_GetIDsOfNames,
165 HTMLIFrameBase2_Invoke,
166 HTMLIFrameBase2_get_contentWindow,
167 HTMLIFrameBase2_put_onload,
168 HTMLIFrameBase2_get_onload,
169 HTMLIFrameBase2_put_onreadystatechange,
170 HTMLIFrameBase2_get_onreadystatechange,
171 HTMLIFrameBase2_get_readyState,
172 HTMLIFrameBase2_put_allowTransparency,
173 HTMLIFrameBase2_get_allowTransparency
176 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, element.node, iface)
178 static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
180 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
182 *ppv = NULL;
184 if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
185 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
186 *ppv = HTMLFRAMEBASE2(This);
187 }else {
188 return HTMLElement_QI(&This->element.node, riid, ppv);
191 IUnknown_AddRef((IUnknown*)*ppv);
192 return S_OK;
195 static void HTMLIFrame_destructor(HTMLDOMNode *iface)
197 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
199 if(This->nsiframe)
200 nsIDOMHTMLIFrameElement_Release(This->nsiframe);
202 HTMLElement_destructor(&This->element.node);
205 #undef HTMLIFRAME_NODE_THIS
207 static const NodeImplVtbl HTMLIFrameImplVtbl = {
208 HTMLIFrame_QI,
209 HTMLIFrame_destructor
212 static const tid_t HTMLIFrame_iface_tids[] = {
213 IHTMLDOMNode_tid,
214 IHTMLDOMNode2_tid,
215 IHTMLElement_tid,
216 IHTMLElement2_tid,
217 IHTMLElement3_tid,
218 IHTMLFrameBase2_tid,
222 static dispex_static_data_t HTMLIFrame_dispex = {
223 NULL,
224 DispHTMLIFrame_tid,
225 NULL,
226 HTMLIFrame_iface_tids
229 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement *nselem)
231 HTMLIFrame *ret;
232 nsresult nsres;
234 ret = heap_alloc_zero(sizeof(HTMLIFrame));
236 ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
237 ret->element.node.vtbl = &HTMLIFrameImplVtbl;
239 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLFRAMEBASE2(ret), &HTMLIFrame_dispex);
240 HTMLElement_Init(&ret->element);
242 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
243 if(NS_FAILED(nsres))
244 ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
246 return &ret->element;