push bae61e3002acd849d282a00366b18661e823097b
[wine/hacks.git] / dlls / mshtml / htmlframebase.c
blob6c0dd40a5e8986a102adf05d9d8f32cc784f789c
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 #define HTMLFRAMEBASE_THIS(iface) DEFINE_THIS(HTMLFrameBase, IHTMLFrameBase, iface)
36 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
38 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
40 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
43 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
45 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
47 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
50 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
52 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
54 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
57 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
59 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
61 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
64 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
65 LCID lcid, ITypeInfo **ppTInfo)
67 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
69 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
72 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
73 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
75 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
77 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames,
78 cNames, lcid, rgDispId);
81 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
82 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
83 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
85 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
87 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
88 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
91 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
93 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
94 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
95 return E_NOTIMPL;
98 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
100 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, p);
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
107 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
108 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
109 return E_NOTIMPL;
112 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
114 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
115 FIXME("(%p)->(%p)\n", This, p);
116 return E_NOTIMPL;
119 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
121 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
122 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
123 return E_NOTIMPL;
126 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
128 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
129 FIXME("(%p)->(%p)\n", This, p);
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
135 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
136 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
142 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, p);
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
149 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
150 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
151 return E_NOTIMPL;
154 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
156 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
157 FIXME("(%p)->(%p)\n", This, p);
158 return E_NOTIMPL;
161 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
163 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
164 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
170 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
171 FIXME("(%p)->(%p)\n", This, p);
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
177 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
178 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
179 return E_NOTIMPL;
182 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
184 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
185 FIXME("(%p)->(%p)\n", This, p);
186 return E_NOTIMPL;
189 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
191 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
192 FIXME("(%p)->(%x)\n", This, v);
193 return E_NOTIMPL;
196 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
198 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
199 FIXME("(%p)->(%p)\n", This, p);
200 return E_NOTIMPL;
203 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
205 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
206 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
207 return E_NOTIMPL;
210 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
212 HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
213 FIXME("(%p)->(%p)\n", This, p);
214 return E_NOTIMPL;
217 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
218 HTMLFrameBase_QueryInterface,
219 HTMLFrameBase_AddRef,
220 HTMLFrameBase_Release,
221 HTMLFrameBase_GetTypeInfoCount,
222 HTMLFrameBase_GetTypeInfo,
223 HTMLFrameBase_GetIDsOfNames,
224 HTMLFrameBase_Invoke,
225 HTMLFrameBase_put_src,
226 HTMLFrameBase_get_src,
227 HTMLFrameBase_put_name,
228 HTMLFrameBase_get_name,
229 HTMLFrameBase_put_border,
230 HTMLFrameBase_get_border,
231 HTMLFrameBase_put_frameBorder,
232 HTMLFrameBase_get_frameBorder,
233 HTMLFrameBase_put_frameSpacing,
234 HTMLFrameBase_get_frameSpacing,
235 HTMLFrameBase_put_marginWidth,
236 HTMLFrameBase_get_marginWidth,
237 HTMLFrameBase_put_marginHeight,
238 HTMLFrameBase_get_marginHeight,
239 HTMLFrameBase_put_noResize,
240 HTMLFrameBase_get_noResize,
241 HTMLFrameBase_put_scrolling,
242 HTMLFrameBase_get_scrolling
245 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
247 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
248 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
249 *ppv = HTMLFRAMEBASE(This);
250 }else {
251 return HTMLElement_QI(&This->element.node, riid, ppv);
254 IUnknown_AddRef((IUnknown*)*ppv);
255 return S_OK;
258 void HTMLFrameBase_destructor(HTMLFrameBase *This)
260 if(This->content_window) {
261 This->content_window->frame_element = NULL;
262 IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
265 HTMLElement_destructor(&This->element.node);
268 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
269 HTMLWindow *content_window, dispex_static_data_t *dispex_data)
271 This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl;
273 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
275 if(content_window) {
276 IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
277 content_window->frame_element = This;
279 This->content_window = content_window;
282 typedef struct {
283 HTMLFrameBase framebase;
284 } HTMLFrameElement;
286 #define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
288 static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
290 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
292 return HTMLFrameBase_QI(&This->framebase, riid, ppv);
295 static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
297 HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
299 HTMLFrameBase_destructor(&This->framebase);
302 #undef HTMLFRAME_NODE_THIS
304 static const NodeImplVtbl HTMLFrameElementImplVtbl = {
305 HTMLFrameElement_QI,
306 HTMLFrameElement_destructor
309 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLWindow *content_window)
311 nsIDOMHTMLFrameElement *nsframe;
312 HTMLFrameElement *ret;
313 nsresult nsres;
315 ret = heap_alloc_zero(sizeof(HTMLFrameElement));
317 ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
319 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
320 if(NS_FAILED(nsres))
321 ERR("Could not get nsIDOMHTMLFrameElement iface: %08x\n", nsres);
323 HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, NULL);
325 return &ret->framebase.element;