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
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 struct HTMLGenericElement
{
39 IHTMLGenericElement IHTMLGenericElement_iface
;
42 static inline HTMLGenericElement
*impl_from_IHTMLGenericElement(IHTMLGenericElement
*iface
)
44 return CONTAINING_RECORD(iface
, HTMLGenericElement
, IHTMLGenericElement_iface
);
47 static HRESULT WINAPI
HTMLGenericElement_QueryInterface(IHTMLGenericElement
*iface
, REFIID riid
, void **ppv
)
49 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
51 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
54 static ULONG WINAPI
HTMLGenericElement_AddRef(IHTMLGenericElement
*iface
)
56 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
58 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
61 static ULONG WINAPI
HTMLGenericElement_Release(IHTMLGenericElement
*iface
)
63 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
65 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
68 static HRESULT WINAPI
HTMLGenericElement_GetTypeInfoCount(IHTMLGenericElement
*iface
, UINT
*pctinfo
)
70 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
71 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
74 static HRESULT WINAPI
HTMLGenericElement_GetTypeInfo(IHTMLGenericElement
*iface
, UINT iTInfo
,
75 LCID lcid
, ITypeInfo
**ppTInfo
)
77 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
78 return IDispatchEx_GetTypeInfo(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
82 static HRESULT WINAPI
HTMLGenericElement_GetIDsOfNames(IHTMLGenericElement
*iface
, REFIID riid
,
83 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
85 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
86 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
87 cNames
, lcid
, rgDispId
);
90 static HRESULT WINAPI
HTMLGenericElement_Invoke(IHTMLGenericElement
*iface
, DISPID dispIdMember
,
91 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
92 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
94 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
95 return IDispatchEx_Invoke(&This
->element
.node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
96 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
99 static HRESULT WINAPI
HTMLGenericElement_get_recordset(IHTMLGenericElement
*iface
, IDispatch
**p
)
101 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
102 FIXME("(%p)->(%p)\n", This
, p
);
106 static HRESULT WINAPI
HTMLGenericElement_namedRecordset(IHTMLGenericElement
*iface
,
107 BSTR dataMember
, VARIANT
*hierarchy
, IDispatch
**ppRecordset
)
109 HTMLGenericElement
*This
= impl_from_IHTMLGenericElement(iface
);
110 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(dataMember
), hierarchy
, ppRecordset
);
114 static const IHTMLGenericElementVtbl HTMLGenericElementVtbl
= {
115 HTMLGenericElement_QueryInterface
,
116 HTMLGenericElement_AddRef
,
117 HTMLGenericElement_Release
,
118 HTMLGenericElement_GetTypeInfoCount
,
119 HTMLGenericElement_GetTypeInfo
,
120 HTMLGenericElement_GetIDsOfNames
,
121 HTMLGenericElement_Invoke
,
122 HTMLGenericElement_get_recordset
,
123 HTMLGenericElement_namedRecordset
126 static inline HTMLGenericElement
*impl_from_DispatchEx(DispatchEx
*iface
)
128 return CONTAINING_RECORD(iface
, HTMLGenericElement
, element
.node
.event_target
.dispex
);
131 static void *HTMLGenericElement_query_interface(DispatchEx
*dispex
, REFIID riid
)
133 HTMLGenericElement
*This
= impl_from_DispatchEx(dispex
);
135 if(IsEqualGUID(&IID_IHTMLGenericElement
, riid
))
136 return &This
->IHTMLGenericElement_iface
;
138 return HTMLElement_query_interface(&This
->element
.node
.event_target
.dispex
, riid
);
141 static const NodeImplVtbl HTMLGenericElementImplVtbl
= {
142 .clsid
= &CLSID_HTMLGenericElement
,
143 .cpc_entries
= HTMLElement_cpc
,
144 .clone
= HTMLElement_clone
,
145 .get_attr_col
= HTMLElement_get_attr_col
148 static const event_target_vtbl_t HTMLGenericElement_event_target_vtbl
= {
150 HTMLELEMENT_DISPEX_VTBL_ENTRIES
,
151 .query_interface
= HTMLGenericElement_query_interface
,
152 .destructor
= HTMLElement_destructor
,
153 .traverse
= HTMLDOMNode_traverse
,
154 .unlink
= HTMLDOMNode_unlink
156 HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES
,
157 .handle_event
= HTMLElement_handle_event
160 static const tid_t HTMLGenericElement_iface_tids
[] = {
162 IHTMLGenericElement_tid
,
166 static dispex_static_data_t HTMLGenericElement_dispex
= {
167 "HTMLUnknownElement",
168 &HTMLGenericElement_event_target_vtbl
.dispex_vtbl
,
169 DispHTMLGenericElement_tid
,
170 HTMLGenericElement_iface_tids
,
171 HTMLElement_init_dispex_info
174 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, HTMLElement
**elem
)
176 HTMLGenericElement
*ret
;
178 ret
= calloc(1, sizeof(HTMLGenericElement
));
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
;