mshtml: Added HTMLInputElement::onchange implementation.
[wine/multimedia.git] / dlls / mshtml / htmlinput.c
blobf4f513c09cfab22cd2333012dcaba11d6f092c45
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 IHTMLInputElement IHTMLInputElement_iface;
40 IHTMLInputTextElement IHTMLInputTextElement_iface;
42 nsIDOMHTMLInputElement *nsinput;
43 } HTMLInputElement;
45 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
47 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
50 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
52 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
55 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
56 REFIID riid, void **ppv)
58 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
60 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
63 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
65 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
67 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
70 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
72 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
74 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
77 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
79 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
81 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
84 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
85 LCID lcid, ITypeInfo **ppTInfo)
87 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
89 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
90 ppTInfo);
93 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
94 LPOLESTR *rgszNames, UINT cNames,
95 LCID lcid, DISPID *rgDispId)
97 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
99 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
100 cNames, lcid, rgDispId);
103 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
104 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
105 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
107 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
109 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
110 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
113 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
115 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
116 nsAString type_str;
117 nsresult nsres;
119 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
122 * FIXME:
123 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
125 nsAString_InitDepend(&type_str, v);
126 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
127 nsAString_Finish(&type_str);
128 if(NS_FAILED(nsres)) {
129 ERR("SetType failed: %08x\n", nsres);
130 return E_FAIL;
133 return S_OK;
136 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
138 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
139 nsAString type_str;
140 nsresult nsres;
142 TRACE("(%p)->(%p)\n", This, p);
144 nsAString_Init(&type_str, NULL);
145 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
146 return return_nsstr(nsres, &type_str, p);
149 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
151 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
152 nsAString val_str;
153 nsresult nsres;
155 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
157 nsAString_InitDepend(&val_str, v);
158 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
159 nsAString_Finish(&val_str);
160 if(NS_FAILED(nsres))
161 ERR("SetValue failed: %08x\n", nsres);
163 return S_OK;
166 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
168 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
169 nsAString value_str;
170 nsresult nsres;
172 TRACE("(%p)->(%p)\n", This, p);
174 nsAString_Init(&value_str, NULL);
175 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
176 return return_nsstr(nsres, &value_str, p);
179 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
181 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
182 nsAString name_str;
183 nsresult nsres;
185 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
187 nsAString_InitDepend(&name_str, v);
188 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
189 nsAString_Finish(&name_str);
190 if(NS_FAILED(nsres)) {
191 ERR("SetName failed: %08x\n", nsres);
192 return E_FAIL;
195 return S_OK;
198 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
200 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
201 nsAString name_str;
202 nsresult nsres;
204 TRACE("(%p)->(%p)\n", This, p);
206 nsAString_Init(&name_str, NULL);
207 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
208 return return_nsstr(nsres, &name_str, p);
211 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
213 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
214 FIXME("(%p)->(%x)\n", This, v);
215 return E_NOTIMPL;
218 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
220 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
221 FIXME("(%p)->(%p)\n", This, p);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
227 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
228 nsresult nsres;
230 TRACE("(%p)->(%x)\n", This, v);
232 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
233 if(NS_FAILED(nsres))
234 ERR("SetDisabled failed: %08x\n", nsres);
236 return S_OK;
239 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
241 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
242 cpp_bool disabled = FALSE;
244 TRACE("(%p)->(%p)\n", This, p);
246 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
248 *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
249 return S_OK;
252 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
254 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
255 FIXME("(%p)->(%p)\n", This, p);
256 return E_NOTIMPL;
259 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
261 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
262 FIXME("(%p)->(%d)\n", This, v);
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
268 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
269 FIXME("(%p)->(%p)\n", This, p);
270 return E_NOTIMPL;
273 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
275 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
276 FIXME("(%p)->(%d)\n", This, v);
277 return E_NOTIMPL;
280 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
282 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
283 FIXME("(%p)->(%p)\n", This, p);
284 return E_NOTIMPL;
287 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
289 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
290 nsresult nsres;
292 TRACE("(%p)\n", This);
294 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
295 if(NS_FAILED(nsres)) {
296 ERR("Select failed: %08x\n", nsres);
297 return E_FAIL;
300 return S_OK;
303 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
305 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
307 TRACE("(%p)->()\n", This);
309 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
312 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
314 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
316 TRACE("(%p)->(%p)\n", This, p);
318 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
321 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
323 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
324 FIXME("(%p)->()\n", This);
325 return E_NOTIMPL;
328 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
330 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
331 FIXME("(%p)->(%p)\n", This, p);
332 return E_NOTIMPL;
335 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
337 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
338 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
339 return E_NOTIMPL;
342 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
344 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
345 FIXME("(%p)->(%p)\n", This, p);
346 return E_NOTIMPL;
349 static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
351 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
352 FIXME("(%p)->(%x)\n", This, v);
353 return E_NOTIMPL;
356 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
358 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
359 FIXME("(%p)->(%p)\n", This, p);
360 return E_NOTIMPL;
363 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
365 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
366 FIXME("(%p)->(%p)\n", This, range);
367 return E_NOTIMPL;
370 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
372 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
373 FIXME("(%p)->(%x)\n", This, v);
374 return E_NOTIMPL;
377 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
379 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
380 FIXME("(%p)->(%p)\n", This, p);
381 return E_NOTIMPL;
384 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
386 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
387 nsresult nsres;
389 TRACE("(%p)->(%x)\n", This, v);
391 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
392 if(NS_FAILED(nsres)) {
393 ERR("SetDefaultChecked failed: %08x\n", nsres);
394 return E_FAIL;
397 return S_OK;
400 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
402 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
403 cpp_bool default_checked = FALSE;
404 nsresult nsres;
406 TRACE("(%p)->(%p)\n", This, p);
408 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
409 if(NS_FAILED(nsres)) {
410 ERR("GetDefaultChecked failed: %08x\n", nsres);
411 return E_FAIL;
414 *p = default_checked ? VARIANT_TRUE : VARIANT_FALSE;
415 return S_OK;
418 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
420 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
421 nsresult nsres;
423 TRACE("(%p)->(%x)\n", This, v);
425 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
426 if(NS_FAILED(nsres)) {
427 ERR("SetChecked failed: %08x\n", nsres);
428 return E_FAIL;
431 return S_OK;
434 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
436 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
437 cpp_bool checked;
438 nsresult nsres;
440 TRACE("(%p)->(%p)\n", This, p);
442 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
443 if(NS_FAILED(nsres)) {
444 ERR("GetChecked failed: %08x\n", nsres);
445 return E_FAIL;
448 *p = checked ? VARIANT_TRUE : VARIANT_FALSE;
449 TRACE("checked=%x\n", *p);
450 return S_OK;
453 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
455 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
456 FIXME("(%p)->()\n", This);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
462 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
463 FIXME("(%p)->(%p)\n", This, p);
464 return E_NOTIMPL;
467 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
469 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
470 FIXME("(%p)->(%d)\n", This, v);
471 return E_NOTIMPL;
474 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
476 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
477 FIXME("(%p)->(%p)\n", This, p);
478 return E_NOTIMPL;
481 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
483 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
484 FIXME("(%p)->(%d)\n", This, v);
485 return E_NOTIMPL;
488 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
490 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
491 FIXME("(%p)->(%p)\n", This, p);
492 return E_NOTIMPL;
495 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
497 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
498 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
499 return E_NOTIMPL;
502 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
504 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
505 FIXME("(%p)->(%p)\n", This, p);
506 return E_NOTIMPL;
509 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
511 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
512 nsAString nsstr;
513 nsresult nsres;
515 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
517 nsAString_InitDepend(&nsstr, v);
518 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
519 nsAString_Finish(&nsstr);
520 if(NS_FAILED(nsres))
521 ERR("SetSrc failed: %08x\n", nsres);
523 return S_OK;
526 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
528 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
529 const PRUnichar *src;
530 nsAString src_str;
531 nsresult nsres;
532 HRESULT hres;
534 TRACE("(%p)->(%p)\n", This, p);
536 nsAString_Init(&src_str, NULL);
537 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
538 if(NS_FAILED(nsres)) {
539 ERR("GetSrc failed: %08x\n", nsres);
540 return E_FAIL;
543 nsAString_GetData(&src_str, &src);
544 hres = nsuri_to_url(src, FALSE, p);
545 nsAString_Finish(&src_str);
547 return hres;
550 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
552 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
553 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
554 return E_NOTIMPL;
557 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
559 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
560 FIXME("(%p)->(%p)\n", This, p);
561 return E_NOTIMPL;
564 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
566 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
567 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
568 return E_NOTIMPL;
571 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
573 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
574 FIXME("(%p)->(%p)\n", This, p);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
580 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
581 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
582 return E_NOTIMPL;
585 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
587 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
588 FIXME("(%p)->(%p)\n", This, p);
589 return E_NOTIMPL;
592 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
594 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
595 FIXME("(%p)->(%p)\n", This, p);
596 return E_NOTIMPL;
599 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
601 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
602 FIXME("(%p)->(%p)\n", This, p);
603 return E_NOTIMPL;
606 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
608 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
609 FIXME("(%p)->()\n", This);
610 return E_NOTIMPL;
613 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
615 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
616 FIXME("(%p)->(%p)\n", This, p);
617 return E_NOTIMPL;
620 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
622 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
623 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
624 return E_NOTIMPL;
627 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
629 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
630 FIXME("(%p)->(%p)\n", This, p);
631 return E_NOTIMPL;
634 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
636 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
637 FIXME("(%p)->()\n", This);
638 return E_NOTIMPL;
641 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
643 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
644 FIXME("(%p)->(%p)\n", This, p);
645 return E_NOTIMPL;
648 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
650 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
651 FIXME("(%p)->()\n", This);
652 return E_NOTIMPL;
655 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
657 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
658 FIXME("(%p)->(%p)\n", This, p);
659 return E_NOTIMPL;
662 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
664 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
665 FIXME("(%p)->()\n", This);
666 return E_NOTIMPL;
669 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
671 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
672 FIXME("(%p)->(%p)\n", This, p);
673 return E_NOTIMPL;
676 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
678 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
679 FIXME("(%p)->(%d)\n", This, v);
680 return E_NOTIMPL;
683 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
685 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
686 FIXME("(%p)->(%p)\n", This, p);
687 return E_NOTIMPL;
690 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
692 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
693 FIXME("(%p)->(%d)\n", This, v);
694 return E_NOTIMPL;
697 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
699 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
700 FIXME("(%p)->(%p)\n", This, p);
701 return E_NOTIMPL;
704 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
706 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
707 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
708 return E_NOTIMPL;
711 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
713 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
714 FIXME("(%p)->(%p)\n", This, p);
715 return E_NOTIMPL;
718 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
719 HTMLInputElement_QueryInterface,
720 HTMLInputElement_AddRef,
721 HTMLInputElement_Release,
722 HTMLInputElement_GetTypeInfoCount,
723 HTMLInputElement_GetTypeInfo,
724 HTMLInputElement_GetIDsOfNames,
725 HTMLInputElement_Invoke,
726 HTMLInputElement_put_type,
727 HTMLInputElement_get_type,
728 HTMLInputElement_put_value,
729 HTMLInputElement_get_value,
730 HTMLInputElement_put_name,
731 HTMLInputElement_get_name,
732 HTMLInputElement_put_status,
733 HTMLInputElement_get_status,
734 HTMLInputElement_put_disabled,
735 HTMLInputElement_get_disabled,
736 HTMLInputElement_get_form,
737 HTMLInputElement_put_size,
738 HTMLInputElement_get_size,
739 HTMLInputElement_put_maxLength,
740 HTMLInputElement_get_maxLength,
741 HTMLInputElement_select,
742 HTMLInputElement_put_onchange,
743 HTMLInputElement_get_onchange,
744 HTMLInputElement_put_onselect,
745 HTMLInputElement_get_onselect,
746 HTMLInputElement_put_defaultValue,
747 HTMLInputElement_get_defaultValue,
748 HTMLInputElement_put_readOnly,
749 HTMLInputElement_get_readOnly,
750 HTMLInputElement_createTextRange,
751 HTMLInputElement_put_indeterminate,
752 HTMLInputElement_get_indeterminate,
753 HTMLInputElement_put_defaultChecked,
754 HTMLInputElement_get_defaultChecked,
755 HTMLInputElement_put_checked,
756 HTMLInputElement_get_checked,
757 HTMLInputElement_put_border,
758 HTMLInputElement_get_border,
759 HTMLInputElement_put_vspace,
760 HTMLInputElement_get_vspace,
761 HTMLInputElement_put_hspace,
762 HTMLInputElement_get_hspace,
763 HTMLInputElement_put_alt,
764 HTMLInputElement_get_alt,
765 HTMLInputElement_put_src,
766 HTMLInputElement_get_src,
767 HTMLInputElement_put_lowsrc,
768 HTMLInputElement_get_lowsrc,
769 HTMLInputElement_put_vrml,
770 HTMLInputElement_get_vrml,
771 HTMLInputElement_put_dynsrc,
772 HTMLInputElement_get_dynsrc,
773 HTMLInputElement_get_readyState,
774 HTMLInputElement_get_complete,
775 HTMLInputElement_put_loop,
776 HTMLInputElement_get_loop,
777 HTMLInputElement_put_align,
778 HTMLInputElement_get_align,
779 HTMLInputElement_put_onload,
780 HTMLInputElement_get_onload,
781 HTMLInputElement_put_onerror,
782 HTMLInputElement_get_onerror,
783 HTMLInputElement_put_onabort,
784 HTMLInputElement_get_onabort,
785 HTMLInputElement_put_width,
786 HTMLInputElement_get_width,
787 HTMLInputElement_put_height,
788 HTMLInputElement_get_height,
789 HTMLInputElement_put_start,
790 HTMLInputElement_get_start
793 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
794 REFIID riid, void **ppv)
796 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
798 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
801 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
803 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
805 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
808 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
810 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
812 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
815 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
817 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
818 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
821 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
822 LCID lcid, ITypeInfo **ppTInfo)
824 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
825 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
826 ppTInfo);
829 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
830 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
832 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
833 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
834 cNames, lcid, rgDispId);
837 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
838 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
839 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
841 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
842 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
843 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
846 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
848 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
850 TRACE("(%p)->(%p)\n", This, p);
852 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
855 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
857 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
859 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
861 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
864 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
866 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
868 TRACE("(%p)->(%p)\n", This, p);
870 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
873 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
875 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
877 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
879 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
882 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
884 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
886 TRACE("(%p)->(%p)\n", This, p);
888 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
891 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
893 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
894 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
895 return E_NOTIMPL;
898 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
900 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
901 TRACE("(%p)->(%p)\n", This, p);
902 return E_NOTIMPL;
905 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
907 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
909 TRACE("(%p)->(%x)\n", This, v);
911 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
914 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
916 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
918 TRACE("(%p)->(%p)\n", This, p);
920 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
923 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
925 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
927 TRACE("(%p)->(%p)\n", This, p);
929 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
932 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
934 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
936 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
938 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
941 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
943 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
945 TRACE("(%p)->(%p)\n", This, p);
947 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
950 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
952 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
954 TRACE("(%p)->(%d)\n", This, v);
956 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
959 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
961 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
963 TRACE("(%p)->(%p)\n", This, p);
965 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
968 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
970 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
972 TRACE("(%p)->(%d)\n", This, v);
974 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
977 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
979 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
981 TRACE("(%p)->(%p)\n", This, p);
983 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
986 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
988 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
990 TRACE("(%p)\n", This);
992 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
995 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
997 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
999 TRACE("(%p)->()\n", This);
1001 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1004 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1006 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1008 TRACE("(%p)->(%p)\n", This, p);
1010 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1013 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1015 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1017 TRACE("(%p)->()\n", This);
1019 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1022 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1024 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1026 TRACE("(%p)->(%p)\n", This, p);
1028 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1031 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1033 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1035 TRACE("(%p)->(%x)\n", This, v);
1037 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1040 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1042 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1044 TRACE("(%p)->(%p)\n", This, p);
1046 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1049 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1051 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1053 TRACE("(%p)->(%p)\n", This, range);
1055 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1058 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1059 HTMLInputTextElement_QueryInterface,
1060 HTMLInputTextElement_AddRef,
1061 HTMLInputTextElement_Release,
1062 HTMLInputTextElement_GetTypeInfoCount,
1063 HTMLInputTextElement_GetTypeInfo,
1064 HTMLInputTextElement_GetIDsOfNames,
1065 HTMLInputTextElement_Invoke,
1066 HTMLInputTextElement_get_type,
1067 HTMLInputTextElement_put_value,
1068 HTMLInputTextElement_get_value,
1069 HTMLInputTextElement_put_name,
1070 HTMLInputTextElement_get_name,
1071 HTMLInputTextElement_put_status,
1072 HTMLInputTextElement_get_status,
1073 HTMLInputTextElement_put_disabled,
1074 HTMLInputTextElement_get_disabled,
1075 HTMLInputTextElement_get_form,
1076 HTMLInputTextElement_put_defaultValue,
1077 HTMLInputTextElement_get_defaultValue,
1078 HTMLInputTextElement_put_size,
1079 HTMLInputTextElement_get_size,
1080 HTMLInputTextElement_put_maxLength,
1081 HTMLInputTextElement_get_maxLength,
1082 HTMLInputTextElement_select,
1083 HTMLInputTextElement_put_onchange,
1084 HTMLInputTextElement_get_onchange,
1085 HTMLInputTextElement_put_onselect,
1086 HTMLInputTextElement_get_onselect,
1087 HTMLInputTextElement_put_readOnly,
1088 HTMLInputTextElement_get_readOnly,
1089 HTMLInputTextElement_createTextRange
1092 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1094 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1097 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1099 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1101 *ppv = NULL;
1103 if(IsEqualGUID(&IID_IUnknown, riid)) {
1104 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1105 *ppv = &This->IHTMLInputElement_iface;
1106 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1107 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1108 *ppv = &This->IHTMLInputElement_iface;
1109 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1110 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1111 *ppv = &This->IHTMLInputElement_iface;
1112 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1113 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1114 *ppv = &This->IHTMLInputTextElement_iface;
1117 if(*ppv) {
1118 IUnknown_AddRef((IUnknown*)*ppv);
1119 return S_OK;
1122 return HTMLElement_QI(&This->element.node, riid, ppv);
1125 static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
1127 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1129 if(eid == EVENTID_CLICK) {
1130 nsresult nsres;
1132 *handled = TRUE;
1134 nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
1135 if(NS_FAILED(nsres)) {
1136 ERR("Click failed: %08x\n", nsres);
1137 return E_FAIL;
1141 return S_OK;
1144 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1146 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1147 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1150 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1152 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1153 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1156 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1157 HTMLInputElement_QI,
1158 HTMLElement_destructor,
1159 HTMLElement_clone,
1160 HTMLElement_get_attr_col,
1161 NULL,
1162 HTMLInputElementImpl_fire_event,
1163 NULL,
1164 HTMLInputElementImpl_put_disabled,
1165 HTMLInputElementImpl_get_disabled,
1168 static const tid_t HTMLInputElement_iface_tids[] = {
1169 HTMLELEMENT_TIDS,
1170 IHTMLInputElement_tid,
1173 static dispex_static_data_t HTMLInputElement_dispex = {
1174 NULL,
1175 DispHTMLInputElement_tid,
1176 NULL,
1177 HTMLInputElement_iface_tids
1180 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
1182 HTMLInputElement *ret;
1183 nsresult nsres;
1185 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1186 if(!ret)
1187 return E_OUTOFMEMORY;
1189 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1190 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1191 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1193 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1195 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1197 /* Share nsinput reference with nsnode */
1198 assert(nsres == NS_OK && (nsIDOMNode*)ret->nsinput == ret->element.node.nsnode);
1199 nsIDOMNode_Release(ret->element.node.nsnode);
1201 *elem = &ret->element;
1202 return S_OK;