mshtml: Added IHTMLWindow2::get_history implementation.
[wine/multimedia.git] / dlls / mshtml / htmlgeneric.c
blob703349d4fca2c21034072eec276f19bcf058d822
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
20 #include <stdarg.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct {
36 HTMLElement element;
38 IHTMLGenericElement IHTMLGenericElement_iface;
39 } HTMLGenericElement;
41 static inline HTMLGenericElement *impl_from_IHTMLGenericElement(IHTMLGenericElement *iface)
43 return CONTAINING_RECORD(iface, HTMLGenericElement, IHTMLGenericElement_iface);
46 static HRESULT WINAPI HTMLGenericElement_QueryInterface(IHTMLGenericElement *iface, REFIID riid, void **ppv)
48 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
50 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
53 static ULONG WINAPI HTMLGenericElement_AddRef(IHTMLGenericElement *iface)
55 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
57 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
60 static ULONG WINAPI HTMLGenericElement_Release(IHTMLGenericElement *iface)
62 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
64 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
67 static HRESULT WINAPI HTMLGenericElement_GetTypeInfoCount(IHTMLGenericElement *iface, UINT *pctinfo)
69 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
70 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
73 static HRESULT WINAPI HTMLGenericElement_GetTypeInfo(IHTMLGenericElement *iface, UINT iTInfo,
74 LCID lcid, ITypeInfo **ppTInfo)
76 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
77 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
78 ppTInfo);
81 static HRESULT WINAPI HTMLGenericElement_GetIDsOfNames(IHTMLGenericElement *iface, REFIID riid,
82 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
84 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
85 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
86 cNames, lcid, rgDispId);
89 static HRESULT WINAPI HTMLGenericElement_Invoke(IHTMLGenericElement *iface, DISPID dispIdMember,
90 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
91 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
94 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
95 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
98 static HRESULT WINAPI HTMLGenericElement_get_recordset(IHTMLGenericElement *iface, IDispatch **p)
100 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
101 FIXME("(%p)->(%p)\n", This, p);
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLGenericElement_namedRecordset(IHTMLGenericElement *iface,
106 BSTR dataMember, VARIANT *hierarchy, IDispatch **ppRecordset)
108 HTMLGenericElement *This = impl_from_IHTMLGenericElement(iface);
109 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(dataMember), hierarchy, ppRecordset);
110 return E_NOTIMPL;
113 static const IHTMLGenericElementVtbl HTMLGenericElementVtbl = {
114 HTMLGenericElement_QueryInterface,
115 HTMLGenericElement_AddRef,
116 HTMLGenericElement_Release,
117 HTMLGenericElement_GetTypeInfoCount,
118 HTMLGenericElement_GetTypeInfo,
119 HTMLGenericElement_GetIDsOfNames,
120 HTMLGenericElement_Invoke,
121 HTMLGenericElement_get_recordset,
122 HTMLGenericElement_namedRecordset
125 static inline HTMLGenericElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
127 return CONTAINING_RECORD(iface, HTMLGenericElement, element.node);
130 static HRESULT HTMLGenericElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
132 HTMLGenericElement *This = impl_from_HTMLDOMNode(iface);
134 *ppv = NULL;
136 if(IsEqualGUID(&IID_IHTMLGenericElement, riid)) {
137 TRACE("(%p)->(IID_IHTMLGenericElement %p)\n", This, ppv);
138 *ppv = &This->IHTMLGenericElement_iface;
139 }else {
140 return HTMLElement_QI(&This->element.node, riid, ppv);
143 IUnknown_AddRef((IUnknown*)*ppv);
144 return S_OK;
147 static void HTMLGenericElement_destructor(HTMLDOMNode *iface)
149 HTMLGenericElement *This = impl_from_HTMLDOMNode(iface);
151 HTMLElement_destructor(&This->element.node);
154 static const NodeImplVtbl HTMLGenericElementImplVtbl = {
155 HTMLGenericElement_QI,
156 HTMLGenericElement_destructor,
157 HTMLElement_clone,
158 HTMLElement_get_attr_col
161 static const tid_t HTMLGenericElement_iface_tids[] = {
162 HTMLELEMENT_TIDS,
163 IHTMLGenericElement_tid,
167 static dispex_static_data_t HTMLGenericElement_dispex = {
168 NULL,
169 DispHTMLGenericElement_tid,
170 NULL,
171 HTMLGenericElement_iface_tids
174 HRESULT HTMLGenericElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
176 HTMLGenericElement *ret;
178 ret = heap_alloc_zero(sizeof(HTMLGenericElement));
179 if(!ret)
180 return E_OUTOFMEMORY;
182 ret->IHTMLGenericElement_iface.lpVtbl = &HTMLGenericElementVtbl;
183 ret->element.node.vtbl = &HTMLGenericElementImplVtbl;
185 HTMLElement_Init(&ret->element, doc, nselem, &HTMLGenericElement_dispex);
187 *elem = &ret->element;
188 return S_OK;