include: Add event trace flags and guid to evntrace.h.
[wine.git] / dlls / mshtml / htmlselect.c
blobebac427c659f398b3556b08ff3c7db56e9628df6
1 /*
2 * Copyright 2006 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>
20 #include <assert.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"
32 #include "htmlevent.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 typedef struct {
37 HTMLElement element;
39 IHTMLSelectElement IHTMLSelectElement_iface;
41 nsIDOMHTMLSelectElement *nsselect;
42 } HTMLSelectElement;
44 static inline HTMLSelectElement *impl_from_IHTMLSelectElement(IHTMLSelectElement *iface)
46 return CONTAINING_RECORD(iface, HTMLSelectElement, IHTMLSelectElement_iface);
49 static HRESULT htmlselect_item(HTMLSelectElement *This, int i, IDispatch **ret)
51 nsIDOMHTMLOptionsCollection *nscol;
52 nsIDOMNode *nsnode;
53 nsresult nsres;
54 HRESULT hres;
56 nsres = nsIDOMHTMLSelectElement_GetOptions(This->nsselect, &nscol);
57 if(NS_FAILED(nsres)) {
58 ERR("GetOptions failed: %08x\n", nsres);
59 return E_FAIL;
62 nsres = nsIDOMHTMLOptionsCollection_Item(nscol, i, &nsnode);
63 nsIDOMHTMLOptionsCollection_Release(nscol);
64 if(NS_FAILED(nsres)) {
65 ERR("Item failed: %08x\n", nsres);
66 return E_FAIL;
69 if(nsnode) {
70 HTMLDOMNode *node;
72 hres = get_node(This->element.node.doc, nsnode, TRUE, &node);
73 nsIDOMNode_Release(nsnode);
74 if(FAILED(hres))
75 return hres;
77 *ret = (IDispatch*)&node->IHTMLDOMNode_iface;
78 }else {
79 *ret = NULL;
81 return S_OK;
84 static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface,
85 REFIID riid, void **ppv)
87 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
89 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
92 static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
94 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
96 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
99 static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
101 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
103 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
106 static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
108 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
110 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
113 static HRESULT WINAPI HTMLSelectElement_GetTypeInfo(IHTMLSelectElement *iface, UINT iTInfo,
114 LCID lcid, ITypeInfo **ppTInfo)
116 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
118 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
119 ppTInfo);
122 static HRESULT WINAPI HTMLSelectElement_GetIDsOfNames(IHTMLSelectElement *iface, REFIID riid,
123 LPOLESTR *rgszNames, UINT cNames,
124 LCID lcid, DISPID *rgDispId)
126 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
128 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
129 cNames, lcid, rgDispId);
132 static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID dispIdMember,
133 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
134 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
136 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
138 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
139 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
142 static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, LONG v)
144 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
145 FIXME("(%p)->(%d)\n", This, v);
146 return E_NOTIMPL;
149 static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, LONG *p)
151 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
152 FIXME("(%p)->(%p)\n", This, p);
153 return E_NOTIMPL;
156 static HRESULT WINAPI HTMLSelectElement_put_multiple(IHTMLSelectElement *iface, VARIANT_BOOL v)
158 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
159 nsresult nsres;
161 TRACE("(%p)->(%x)\n", This, v);
163 nsres = nsIDOMHTMLSelectElement_SetMultiple(This->nsselect, !!v);
164 assert(nsres == NS_OK);
165 return S_OK;
168 static HRESULT WINAPI HTMLSelectElement_get_multiple(IHTMLSelectElement *iface, VARIANT_BOOL *p)
170 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
171 cpp_bool val;
172 nsresult nsres;
174 TRACE("(%p)->(%p)\n", This, p);
176 nsres = nsIDOMHTMLSelectElement_GetMultiple(This->nsselect, &val);
177 assert(nsres == NS_OK);
179 *p = val ? VARIANT_TRUE : VARIANT_FALSE;
180 return S_OK;
183 static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR v)
185 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
186 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
187 return E_NOTIMPL;
190 static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
192 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
193 nsAString name_str;
194 const PRUnichar *name = NULL;
195 nsresult nsres;
197 TRACE("(%p)->(%p)\n", This, p);
199 nsAString_Init(&name_str, NULL);
201 nsres = nsIDOMHTMLSelectElement_GetName(This->nsselect, &name_str);
202 if(NS_SUCCEEDED(nsres)) {
203 static const WCHAR wszGarbage[] = {'g','a','r','b','a','g','e',0};
205 nsAString_GetData(&name_str, &name);
208 * Native never returns empty string here. If an element has no name,
209 * name of previous element or ramdom data is returned.
211 *p = SysAllocString(*name ? name : wszGarbage);
212 }else {
213 ERR("GetName failed: %08x\n", nsres);
216 nsAString_Finish(&name_str);
218 TRACE("name=%s\n", debugstr_w(*p));
219 return S_OK;
222 static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
224 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
226 TRACE("(%p)->(%p)\n", This, p);
228 *p = (IDispatch*)&This->IHTMLSelectElement_iface;
229 IDispatch_AddRef(*p);
230 return S_OK;
233 static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface, VARIANT v)
235 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
237 TRACE("(%p)->()\n", This);
239 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
242 static HRESULT WINAPI HTMLSelectElement_get_onchange(IHTMLSelectElement *iface, VARIANT *p)
244 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
245 FIXME("(%p)->(%p)\n", This, p);
246 return E_NOTIMPL;
249 static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *iface, LONG v)
251 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
252 nsresult nsres;
254 TRACE("(%p)->(%d)\n", This, v);
256 nsres = nsIDOMHTMLSelectElement_SetSelectedIndex(This->nsselect, v);
257 if(NS_FAILED(nsres))
258 ERR("SetSelectedIndex failed: %08x\n", nsres);
260 return S_OK;
263 static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *iface, LONG *p)
265 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
266 nsresult nsres;
268 TRACE("(%p)->(%p)\n", This, p);
270 nsres = nsIDOMHTMLSelectElement_GetSelectedIndex(This->nsselect, p);
271 if(NS_FAILED(nsres)) {
272 ERR("GetSelectedIndex failed: %08x\n", nsres);
273 return E_FAIL;
276 return S_OK;
279 static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
281 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
282 nsAString type_str;
283 nsresult nsres;
285 TRACE("(%p)->(%p)\n", This, p);
287 nsAString_Init(&type_str, NULL);
288 nsres = nsIDOMHTMLSelectElement_GetType(This->nsselect, &type_str);
289 return return_nsstr(nsres, &type_str, p);
292 static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)
294 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
295 nsAString value_str;
296 nsresult nsres;
298 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
300 nsAString_InitDepend(&value_str, v);
301 nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
302 nsAString_Finish(&value_str);
303 if(NS_FAILED(nsres))
304 ERR("SetValue failed: %08x\n", nsres);
306 return S_OK;
309 static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BSTR *p)
311 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
312 nsAString value_str;
313 nsresult nsres;
315 TRACE("(%p)->(%p)\n", This, p);
317 nsAString_Init(&value_str, NULL);
318 nsres = nsIDOMHTMLSelectElement_GetValue(This->nsselect, &value_str);
319 return return_nsstr(nsres, &value_str, p);
322 static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface, VARIANT_BOOL v)
324 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
325 nsresult nsres;
327 TRACE("(%p)->(%x)\n", This, v);
329 nsres = nsIDOMHTMLSelectElement_SetDisabled(This->nsselect, v != VARIANT_FALSE);
330 if(NS_FAILED(nsres)) {
331 ERR("SetDisabled failed: %08x\n", nsres);
332 return E_FAIL;
335 return S_OK;
338 static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface, VARIANT_BOOL *p)
340 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
341 cpp_bool disabled = FALSE;
342 nsresult nsres;
344 TRACE("(%p)->(%p)\n", This, p);
346 nsres = nsIDOMHTMLSelectElement_GetDisabled(This->nsselect, &disabled);
347 if(NS_FAILED(nsres)) {
348 ERR("GetDisabled failed: %08x\n", nsres);
349 return E_FAIL;
352 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
353 return S_OK;
356 static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
358 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
359 FIXME("(%p)->(%p)\n", This, p);
360 return E_NOTIMPL;
363 static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
364 VARIANT before)
366 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
367 nsIWritableVariant *nsvariant;
368 HTMLElement *element_obj;
369 nsresult nsres;
371 TRACE("(%p)->(%p %s)\n", This, element, debugstr_variant(&before));
373 element_obj = unsafe_impl_from_IHTMLElement(element);
374 if(!element_obj) {
375 FIXME("External IHTMLElement implementation?\n");
376 return E_INVALIDARG;
379 nsvariant = create_nsvariant();
380 if(!nsvariant)
381 return E_FAIL;
383 switch(V_VT(&before)) {
384 case VT_EMPTY:
385 case VT_ERROR:
386 nsres = nsIWritableVariant_SetAsEmpty(nsvariant);
387 break;
388 case VT_I2:
389 nsres = nsIWritableVariant_SetAsInt16(nsvariant, V_I2(&before));
390 break;
391 default:
392 FIXME("unhandled before %s\n", debugstr_variant(&before));
393 nsIWritableVariant_Release(nsvariant);
394 return E_NOTIMPL;
397 if(NS_SUCCEEDED(nsres))
398 nsres = nsIDOMHTMLSelectElement_Add(This->nsselect, element_obj->nselem, (nsIVariant*)nsvariant);
399 nsIWritableVariant_Release(nsvariant);
400 if(NS_FAILED(nsres)) {
401 ERR("Add failed: %08x\n", nsres);
402 return E_FAIL;
405 return S_OK;
408 static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index)
410 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
411 nsresult nsres;
412 TRACE("(%p)->(%d)\n", This, index);
413 nsres = nsIDOMHTMLSelectElement_select_Remove(This->nsselect, index);
414 if(NS_FAILED(nsres)) {
415 ERR("Remove failed: %08x\n", nsres);
416 return E_FAIL;
418 return S_OK;
421 static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v)
423 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
424 nsresult nsres;
426 TRACE("(%p)->(%d)\n", This, v);
428 nsres = nsIDOMHTMLSelectElement_SetLength(This->nsselect, v);
429 if(NS_FAILED(nsres))
430 ERR("SetLength failed: %08x\n", nsres);
432 return S_OK;
435 static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LONG *p)
437 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
438 UINT32 length = 0;
439 nsresult nsres;
441 TRACE("(%p)->(%p)\n", This, p);
443 nsres = nsIDOMHTMLSelectElement_GetLength(This->nsselect, &length);
444 if(NS_FAILED(nsres))
445 ERR("GetLength failed: %08x\n", nsres);
447 *p = length;
449 TRACE("ret %d\n", *p);
450 return S_OK;
453 static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, IUnknown **p)
455 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
456 FIXME("(%p)->(%p)\n", This, p);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT name,
461 VARIANT index, IDispatch **pdisp)
463 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
465 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
467 if(!pdisp)
468 return E_POINTER;
469 *pdisp = NULL;
471 if(V_VT(&name) == VT_I4) {
472 if(V_I4(&name) < 0)
473 return E_INVALIDARG;
474 return htmlselect_item(This, V_I4(&name), pdisp);
477 FIXME("Unsupported args\n");
478 return E_NOTIMPL;
481 static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT tagName,
482 IDispatch **pdisp)
484 HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
485 FIXME("(%p)->(v %p)\n", This, pdisp);
486 return E_NOTIMPL;
489 static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
490 HTMLSelectElement_QueryInterface,
491 HTMLSelectElement_AddRef,
492 HTMLSelectElement_Release,
493 HTMLSelectElement_GetTypeInfoCount,
494 HTMLSelectElement_GetTypeInfo,
495 HTMLSelectElement_GetIDsOfNames,
496 HTMLSelectElement_Invoke,
497 HTMLSelectElement_put_size,
498 HTMLSelectElement_get_size,
499 HTMLSelectElement_put_multiple,
500 HTMLSelectElement_get_multiple,
501 HTMLSelectElement_put_name,
502 HTMLSelectElement_get_name,
503 HTMLSelectElement_get_options,
504 HTMLSelectElement_put_onchange,
505 HTMLSelectElement_get_onchange,
506 HTMLSelectElement_put_selectedIndex,
507 HTMLSelectElement_get_selectedIndex,
508 HTMLSelectElement_get_type,
509 HTMLSelectElement_put_value,
510 HTMLSelectElement_get_value,
511 HTMLSelectElement_put_disabled,
512 HTMLSelectElement_get_disabled,
513 HTMLSelectElement_get_form,
514 HTMLSelectElement_add,
515 HTMLSelectElement_remove,
516 HTMLSelectElement_put_length,
517 HTMLSelectElement_get_length,
518 HTMLSelectElement_get__newEnum,
519 HTMLSelectElement_item,
520 HTMLSelectElement_tags
523 static inline HTMLSelectElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
525 return CONTAINING_RECORD(iface, HTMLSelectElement, element.node);
528 static HRESULT HTMLSelectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
530 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
532 *ppv = NULL;
534 if(IsEqualGUID(&IID_IUnknown, riid)) {
535 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
536 *ppv = &This->IHTMLSelectElement_iface;
537 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
538 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
539 *ppv = &This->IHTMLSelectElement_iface;
540 }else if(IsEqualGUID(&IID_IHTMLSelectElement, riid)) {
541 TRACE("(%p)->(IID_IHTMLSelectElement %p)\n", This, ppv);
542 *ppv = &This->IHTMLSelectElement_iface;
545 if(*ppv) {
546 IUnknown_AddRef((IUnknown*)*ppv);
547 return S_OK;
550 return HTMLElement_QI(&This->element.node, riid, ppv);
553 static HRESULT HTMLSelectElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
555 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
556 return IHTMLSelectElement_put_disabled(&This->IHTMLSelectElement_iface, v);
559 static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
561 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
562 return IHTMLSelectElement_get_disabled(&This->IHTMLSelectElement_iface, p);
565 #define DISPID_OPTIONCOL_0 MSHTML_DISPID_CUSTOM_MIN
567 static HRESULT HTMLSelectElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD flags, DISPID *dispid)
569 const WCHAR *ptr;
570 DWORD idx = 0;
572 for(ptr = name; *ptr && isdigitW(*ptr); ptr++) {
573 idx = idx*10 + (*ptr-'0');
574 if(idx > MSHTML_CUSTOM_DISPID_CNT) {
575 WARN("too big idx\n");
576 return DISP_E_UNKNOWNNAME;
579 if(*ptr)
580 return DISP_E_UNKNOWNNAME;
582 *dispid = DISPID_OPTIONCOL_0 + idx;
583 return S_OK;
586 static HRESULT HTMLSelectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
587 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
589 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
591 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
593 switch(flags) {
594 case DISPATCH_PROPERTYGET: {
595 IDispatch *ret;
596 HRESULT hres;
598 hres = htmlselect_item(This, id-DISPID_OPTIONCOL_0, &ret);
599 if(FAILED(hres))
600 return hres;
602 if(ret) {
603 V_VT(res) = VT_DISPATCH;
604 V_DISPATCH(res) = ret;
605 }else {
606 V_VT(res) = VT_NULL;
608 break;
611 default:
612 FIXME("unimplemented flags %x\n", flags);
613 return E_NOTIMPL;
616 return S_OK;
619 static void HTMLSelectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
621 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
623 if(This->nsselect)
624 note_cc_edge((nsISupports*)This->nsselect, "This->nsselect", cb);
627 static void HTMLSelectElement_unlink(HTMLDOMNode *iface)
629 HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
631 if(This->nsselect) {
632 nsIDOMHTMLSelectElement *nsselect = This->nsselect;
634 This->nsselect = NULL;
635 nsIDOMHTMLSelectElement_Release(nsselect);
639 static const NodeImplVtbl HTMLSelectElementImplVtbl = {
640 HTMLSelectElement_QI,
641 HTMLElement_destructor,
642 HTMLElement_cpc,
643 HTMLElement_clone,
644 HTMLElement_handle_event,
645 HTMLElement_get_attr_col,
646 NULL,
647 NULL,
648 HTMLSelectElementImpl_put_disabled,
649 HTMLSelectElementImpl_get_disabled,
650 NULL,
651 NULL,
652 HTMLSelectElement_get_dispid,
653 HTMLSelectElement_invoke,
654 NULL,
655 HTMLSelectElement_traverse,
656 HTMLSelectElement_unlink
659 static const tid_t HTMLSelectElement_tids[] = {
660 HTMLELEMENT_TIDS,
661 IHTMLSelectElement_tid,
665 static dispex_static_data_t HTMLSelectElement_dispex = {
666 NULL,
667 DispHTMLSelectElement_tid,
668 NULL,
669 HTMLSelectElement_tids
672 HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
674 HTMLSelectElement *ret;
675 nsresult nsres;
677 ret = heap_alloc_zero(sizeof(HTMLSelectElement));
678 if(!ret)
679 return E_OUTOFMEMORY;
681 ret->IHTMLSelectElement_iface.lpVtbl = &HTMLSelectElementVtbl;
682 ret->element.node.vtbl = &HTMLSelectElementImplVtbl;
684 HTMLElement_Init(&ret->element, doc, nselem, &HTMLSelectElement_dispex);
686 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
687 (void**)&ret->nsselect);
688 assert(nsres == NS_OK);
690 *elem = &ret->element;
691 return S_OK;