mshtml: Added IHTMLButtonElement::name tests.
[wine.git] / dlls / mshtml / htmlgeneric.c
blob4deae2e87e9cfd460a11932a9d874b13952c687c
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_cpc,
158 HTMLElement_clone,
159 HTMLElement_handle_event,
160 HTMLElement_get_attr_col
163 static const tid_t HTMLGenericElement_iface_tids[] = {
164 HTMLELEMENT_TIDS,
165 IHTMLGenericElement_tid,
169 static dispex_static_data_t HTMLGenericElement_dispex = {
170 NULL,
171 DispHTMLGenericElement_tid,
172 NULL,
173 HTMLGenericElement_iface_tids
176 HRESULT HTMLGenericElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
178 HTMLGenericElement *ret;
180 ret = heap_alloc_zero(sizeof(HTMLGenericElement));
181 if(!ret)
182 return E_OUTOFMEMORY;
184 ret->IHTMLGenericElement_iface.lpVtbl = &HTMLGenericElementVtbl;
185 ret->element.node.vtbl = &HTMLGenericElementImplVtbl;
187 HTMLElement_Init(&ret->element, doc, nselem, &HTMLGenericElement_dispex);
189 *elem = &ret->element;
190 return S_OK;