d2d1: Add a helper to set error state.
[wine.git] / dlls / mshtml / htmlinput.c
blob1ae1f8a55e334043a5081edb02286d84be04f349
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>
21 #include <limits.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
30 #include "wine/debug.h"
32 #include "mshtml_private.h"
33 #include "htmlevent.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 struct HTMLInputElement {
38 HTMLElement element;
40 IHTMLInputElement IHTMLInputElement_iface;
41 IHTMLInputTextElement IHTMLInputTextElement_iface;
42 IHTMLInputTextElement2 IHTMLInputTextElement2_iface;
44 nsIDOMHTMLInputElement *nsinput;
47 static const WCHAR forW[] = {'f','o','r',0};
49 static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
51 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
54 static inline HTMLInputElement *impl_from_IHTMLInputTextElement(IHTMLInputTextElement *iface)
56 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement_iface);
59 static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
60 REFIID riid, void **ppv)
62 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
64 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
67 static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
69 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
71 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
74 static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
76 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
78 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
81 static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
83 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
85 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
88 static HRESULT WINAPI HTMLInputElement_GetTypeInfo(IHTMLInputElement *iface, UINT iTInfo,
89 LCID lcid, ITypeInfo **ppTInfo)
91 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
93 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
94 ppTInfo);
97 static HRESULT WINAPI HTMLInputElement_GetIDsOfNames(IHTMLInputElement *iface, REFIID riid,
98 LPOLESTR *rgszNames, UINT cNames,
99 LCID lcid, DISPID *rgDispId)
101 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
103 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
104 cNames, lcid, rgDispId);
107 static HRESULT WINAPI HTMLInputElement_Invoke(IHTMLInputElement *iface, DISPID dispIdMember,
108 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
109 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
111 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
113 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
114 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
117 static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v)
119 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
120 nsAString type_str;
121 nsresult nsres;
123 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
126 * FIXME:
127 * On IE setting type works only on dynamically created elements before adding them to DOM tree.
129 nsAString_InitDepend(&type_str, v);
130 nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
131 nsAString_Finish(&type_str);
132 if(NS_FAILED(nsres)) {
133 ERR("SetType failed: %08x\n", nsres);
134 return E_FAIL;
137 return S_OK;
140 static HRESULT WINAPI HTMLInputElement_get_type(IHTMLInputElement *iface, BSTR *p)
142 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
143 nsAString type_str;
144 nsresult nsres;
146 TRACE("(%p)->(%p)\n", This, p);
148 nsAString_Init(&type_str, NULL);
149 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &type_str);
150 return return_nsstr(nsres, &type_str, p);
153 static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR v)
155 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
156 nsAString val_str;
157 nsresult nsres;
159 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
161 nsAString_InitDepend(&val_str, v);
162 nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
163 nsAString_Finish(&val_str);
164 if(NS_FAILED(nsres))
165 ERR("SetValue failed: %08x\n", nsres);
167 return S_OK;
170 static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR *p)
172 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
173 nsAString value_str;
174 nsresult nsres;
176 TRACE("(%p)->(%p)\n", This, p);
178 nsAString_Init(&value_str, NULL);
179 nsres = nsIDOMHTMLInputElement_GetValue(This->nsinput, &value_str);
180 return return_nsstr(nsres, &value_str, p);
183 static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
185 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
186 nsAString name_str;
187 nsresult nsres;
189 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
191 nsAString_InitDepend(&name_str, v);
192 nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
193 nsAString_Finish(&name_str);
194 if(NS_FAILED(nsres)) {
195 ERR("SetName failed: %08x\n", nsres);
196 return E_FAIL;
199 return S_OK;
202 static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
204 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
205 nsAString name_str;
206 nsresult nsres;
208 TRACE("(%p)->(%p)\n", This, p);
210 nsAString_Init(&name_str, NULL);
211 nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
212 return return_nsstr(nsres, &name_str, p);
215 static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)
217 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
218 FIXME("(%p)->(%x)\n", This, v);
219 return E_NOTIMPL;
222 static HRESULT WINAPI HTMLInputElement_get_status(IHTMLInputElement *iface, VARIANT_BOOL *p)
224 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
225 FIXME("(%p)->(%p)\n", This, p);
226 return E_NOTIMPL;
229 static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VARIANT_BOOL v)
231 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
232 nsresult nsres;
234 TRACE("(%p)->(%x)\n", This, v);
236 nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
237 if(NS_FAILED(nsres))
238 ERR("SetDisabled failed: %08x\n", nsres);
240 return S_OK;
243 static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p)
245 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
246 cpp_bool disabled = FALSE;
248 TRACE("(%p)->(%p)\n", This, p);
250 nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled);
252 *p = variant_bool(disabled);
253 return S_OK;
256 static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p)
258 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
259 nsIDOMHTMLFormElement *nsform;
260 nsresult nsres;
262 TRACE("(%p)->(%p)\n", This, p);
264 nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform);
265 return return_nsform(nsres, nsform, p);
268 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
270 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
271 UINT32 val = v;
272 nsresult nsres;
274 TRACE("(%p)->(%d)\n", This, v);
275 if (v <= 0)
276 return CTL_E_INVALIDPROPERTYVALUE;
278 nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
279 if (NS_FAILED(nsres)) {
280 ERR("Set Size(%u) failed: %08x\n", val, nsres);
281 return E_FAIL;
283 return S_OK;
286 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
288 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
289 UINT32 val;
290 nsresult nsres;
292 TRACE("(%p)->(%p)\n", This, p);
293 if (p == NULL)
294 return E_INVALIDARG;
296 nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
297 if (NS_FAILED(nsres)) {
298 ERR("Get Size failed: %08x\n", nsres);
299 return E_FAIL;
301 *p = val;
302 return S_OK;
305 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
307 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
308 nsresult nsres;
310 TRACE("(%p)->(%d)\n", This, v);
312 nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
313 if(NS_FAILED(nsres)) {
314 /* FIXME: Gecko throws an error on negative values, while MSHTML should accept them */
315 FIXME("SetMaxLength failed\n");
316 return E_FAIL;
319 return S_OK;
322 static HRESULT WINAPI HTMLInputElement_get_maxLength(IHTMLInputElement *iface, LONG *p)
324 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
325 LONG max_length;
326 nsresult nsres;
328 TRACE("(%p)->(%p)\n", This, p);
330 nsres = nsIDOMHTMLInputElement_GetMaxLength(This->nsinput, &max_length);
331 assert(nsres == NS_OK);
333 /* Gecko reports -1 as default value, while MSHTML uses INT_MAX */
334 *p = max_length == -1 ? INT_MAX : max_length;
335 return S_OK;
338 static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
340 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
341 nsresult nsres;
343 TRACE("(%p)\n", This);
345 nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
346 if(NS_FAILED(nsres)) {
347 ERR("Select failed: %08x\n", nsres);
348 return E_FAIL;
351 return S_OK;
354 static HRESULT WINAPI HTMLInputElement_put_onchange(IHTMLInputElement *iface, VARIANT v)
356 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
358 TRACE("(%p)->()\n", This);
360 return set_node_event(&This->element.node, EVENTID_CHANGE, &v);
363 static HRESULT WINAPI HTMLInputElement_get_onchange(IHTMLInputElement *iface, VARIANT *p)
365 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
367 TRACE("(%p)->(%p)\n", This, p);
369 return get_node_event(&This->element.node, EVENTID_CHANGE, p);
372 static HRESULT WINAPI HTMLInputElement_put_onselect(IHTMLInputElement *iface, VARIANT v)
374 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
375 FIXME("(%p)->()\n", This);
376 return E_NOTIMPL;
379 static HRESULT WINAPI HTMLInputElement_get_onselect(IHTMLInputElement *iface, VARIANT *p)
381 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
382 FIXME("(%p)->(%p)\n", This, p);
383 return E_NOTIMPL;
386 static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface, BSTR v)
388 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
389 nsAString nsstr;
390 nsresult nsres;
392 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
394 nsAString_InitDepend(&nsstr, v);
395 nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
396 nsAString_Finish(&nsstr);
397 if(NS_FAILED(nsres)) {
398 ERR("SetValue failed: %08x\n", nsres);
399 return E_FAIL;
402 return S_OK;
405 static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface, BSTR *p)
407 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
408 nsAString nsstr;
409 nsresult nsres;
411 TRACE("(%p)->(%p)\n", This, p);
413 nsAString_Init(&nsstr, NULL);
414 nsres = nsIDOMHTMLInputElement_GetDefaultValue(This->nsinput, &nsstr);
415 return return_nsstr(nsres, &nsstr, p);
418 static HRESULT WINAPI HTMLInputElement_put_readOnly(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_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
426 if (NS_FAILED(nsres)) {
427 ERR("Set ReadOnly Failed: %08x\n", nsres);
428 return E_FAIL;
430 return S_OK;
433 static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
435 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
436 nsresult nsres;
437 cpp_bool b;
439 TRACE("(%p)->(%p)\n", This, p);
441 nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
442 if (NS_FAILED(nsres)) {
443 ERR("Get ReadOnly Failed: %08x\n", nsres);
444 return E_FAIL;
447 *p = variant_bool(b);
448 return S_OK;
451 static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
453 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
454 FIXME("(%p)->(%p)\n", This, range);
455 return E_NOTIMPL;
458 static HRESULT WINAPI HTMLInputElement_put_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL v)
460 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
461 FIXME("(%p)->(%x)\n", This, v);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLInputElement_get_indeterminate(IHTMLInputElement *iface, VARIANT_BOOL *p)
467 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
468 FIXME("(%p)->(%p)\n", This, p);
469 return E_NOTIMPL;
472 static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL v)
474 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
475 nsresult nsres;
477 TRACE("(%p)->(%x)\n", This, v);
479 nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
480 if(NS_FAILED(nsres)) {
481 ERR("SetDefaultChecked failed: %08x\n", nsres);
482 return E_FAIL;
485 return S_OK;
488 static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *iface, VARIANT_BOOL *p)
490 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
491 cpp_bool default_checked = FALSE;
492 nsresult nsres;
494 TRACE("(%p)->(%p)\n", This, p);
496 nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
497 if(NS_FAILED(nsres)) {
498 ERR("GetDefaultChecked failed: %08x\n", nsres);
499 return E_FAIL;
502 *p = variant_bool(default_checked);
503 return S_OK;
506 static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VARIANT_BOOL v)
508 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
509 nsresult nsres;
511 TRACE("(%p)->(%x)\n", This, v);
513 nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
514 if(NS_FAILED(nsres)) {
515 ERR("SetChecked failed: %08x\n", nsres);
516 return E_FAIL;
519 return S_OK;
522 static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VARIANT_BOOL *p)
524 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
525 cpp_bool checked;
526 nsresult nsres;
528 TRACE("(%p)->(%p)\n", This, p);
530 nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
531 if(NS_FAILED(nsres)) {
532 ERR("GetChecked failed: %08x\n", nsres);
533 return E_FAIL;
536 *p = variant_bool(checked);
537 TRACE("checked=%x\n", *p);
538 return S_OK;
541 static HRESULT WINAPI HTMLInputElement_put_border(IHTMLInputElement *iface, VARIANT v)
543 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
544 FIXME("(%p)->()\n", This);
545 return E_NOTIMPL;
548 static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARIANT *p)
550 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
551 FIXME("(%p)->(%p)\n", This, p);
552 return E_NOTIMPL;
555 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
557 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
558 FIXME("(%p)->(%d)\n", This, v);
559 return E_NOTIMPL;
562 static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG *p)
564 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
565 FIXME("(%p)->(%p)\n", This, p);
566 return E_NOTIMPL;
569 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
571 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
572 FIXME("(%p)->(%d)\n", This, v);
573 return E_NOTIMPL;
576 static HRESULT WINAPI HTMLInputElement_get_hspace(IHTMLInputElement *iface, LONG *p)
578 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
579 FIXME("(%p)->(%p)\n", This, p);
580 return E_NOTIMPL;
583 static HRESULT WINAPI HTMLInputElement_put_alt(IHTMLInputElement *iface, BSTR v)
585 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
586 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
587 return E_NOTIMPL;
590 static HRESULT WINAPI HTMLInputElement_get_alt(IHTMLInputElement *iface, BSTR *p)
592 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
593 FIXME("(%p)->(%p)\n", This, p);
594 return E_NOTIMPL;
597 static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
599 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
600 nsAString nsstr;
601 nsresult nsres;
603 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
605 nsAString_InitDepend(&nsstr, v);
606 nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
607 nsAString_Finish(&nsstr);
608 if(NS_FAILED(nsres))
609 ERR("SetSrc failed: %08x\n", nsres);
611 return S_OK;
614 static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p)
616 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
617 const PRUnichar *src;
618 nsAString src_str;
619 nsresult nsres;
620 HRESULT hres;
622 TRACE("(%p)->(%p)\n", This, p);
624 nsAString_Init(&src_str, NULL);
625 nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
626 if(NS_FAILED(nsres)) {
627 ERR("GetSrc failed: %08x\n", nsres);
628 return E_FAIL;
631 nsAString_GetData(&src_str, &src);
632 hres = nsuri_to_url(src, FALSE, p);
633 nsAString_Finish(&src_str);
635 return hres;
638 static HRESULT WINAPI HTMLInputElement_put_lowsrc(IHTMLInputElement *iface, BSTR v)
640 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
641 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
642 return E_NOTIMPL;
645 static HRESULT WINAPI HTMLInputElement_get_lowsrc(IHTMLInputElement *iface, BSTR *p)
647 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
648 FIXME("(%p)->(%p)\n", This, p);
649 return E_NOTIMPL;
652 static HRESULT WINAPI HTMLInputElement_put_vrml(IHTMLInputElement *iface, BSTR v)
654 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
655 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
656 return E_NOTIMPL;
659 static HRESULT WINAPI HTMLInputElement_get_vrml(IHTMLInputElement *iface, BSTR *p)
661 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
662 FIXME("(%p)->(%p)\n", This, p);
663 return E_NOTIMPL;
666 static HRESULT WINAPI HTMLInputElement_put_dynsrc(IHTMLInputElement *iface, BSTR v)
668 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
669 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
670 return E_NOTIMPL;
673 static HRESULT WINAPI HTMLInputElement_get_dynsrc(IHTMLInputElement *iface, BSTR *p)
675 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
676 FIXME("(%p)->(%p)\n", This, p);
677 return E_NOTIMPL;
680 static HRESULT WINAPI HTMLInputElement_get_readyState(IHTMLInputElement *iface, BSTR *p)
682 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
683 FIXME("(%p)->(%p)\n", This, p);
684 return E_NOTIMPL;
687 static HRESULT WINAPI HTMLInputElement_get_complete(IHTMLInputElement *iface, VARIANT_BOOL *p)
689 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
690 FIXME("(%p)->(%p)\n", This, p);
691 return E_NOTIMPL;
694 static HRESULT WINAPI HTMLInputElement_put_loop(IHTMLInputElement *iface, VARIANT v)
696 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
697 FIXME("(%p)->()\n", This);
698 return E_NOTIMPL;
701 static HRESULT WINAPI HTMLInputElement_get_loop(IHTMLInputElement *iface, VARIANT *p)
703 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
704 FIXME("(%p)->(%p)\n", This, p);
705 return E_NOTIMPL;
708 static HRESULT WINAPI HTMLInputElement_put_align(IHTMLInputElement *iface, BSTR v)
710 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
711 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
712 return E_NOTIMPL;
715 static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR *p)
717 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
718 FIXME("(%p)->(%p)\n", This, p);
719 return E_NOTIMPL;
722 static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v)
724 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
725 FIXME("(%p)->()\n", This);
726 return E_NOTIMPL;
729 static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p)
731 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
732 FIXME("(%p)->(%p)\n", This, p);
733 return E_NOTIMPL;
736 static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v)
738 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
739 FIXME("(%p)->()\n", This);
740 return E_NOTIMPL;
743 static HRESULT WINAPI HTMLInputElement_get_onerror(IHTMLInputElement *iface, VARIANT *p)
745 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
746 FIXME("(%p)->(%p)\n", This, p);
747 return E_NOTIMPL;
750 static HRESULT WINAPI HTMLInputElement_put_onabort(IHTMLInputElement *iface, VARIANT v)
752 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
753 FIXME("(%p)->()\n", This);
754 return E_NOTIMPL;
757 static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VARIANT *p)
759 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
760 FIXME("(%p)->(%p)\n", This, p);
761 return E_NOTIMPL;
764 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
766 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
767 FIXME("(%p)->(%d)\n", This, v);
768 return E_NOTIMPL;
771 static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG *p)
773 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
774 FIXME("(%p)->(%p)\n", This, p);
775 return E_NOTIMPL;
778 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
780 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
781 FIXME("(%p)->(%d)\n", This, v);
782 return E_NOTIMPL;
785 static HRESULT WINAPI HTMLInputElement_get_height(IHTMLInputElement *iface, LONG *p)
787 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
788 FIXME("(%p)->(%p)\n", This, p);
789 return E_NOTIMPL;
792 static HRESULT WINAPI HTMLInputElement_put_start(IHTMLInputElement *iface, BSTR v)
794 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
795 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
796 return E_NOTIMPL;
799 static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR *p)
801 HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
802 FIXME("(%p)->(%p)\n", This, p);
803 return E_NOTIMPL;
806 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
807 HTMLInputElement_QueryInterface,
808 HTMLInputElement_AddRef,
809 HTMLInputElement_Release,
810 HTMLInputElement_GetTypeInfoCount,
811 HTMLInputElement_GetTypeInfo,
812 HTMLInputElement_GetIDsOfNames,
813 HTMLInputElement_Invoke,
814 HTMLInputElement_put_type,
815 HTMLInputElement_get_type,
816 HTMLInputElement_put_value,
817 HTMLInputElement_get_value,
818 HTMLInputElement_put_name,
819 HTMLInputElement_get_name,
820 HTMLInputElement_put_status,
821 HTMLInputElement_get_status,
822 HTMLInputElement_put_disabled,
823 HTMLInputElement_get_disabled,
824 HTMLInputElement_get_form,
825 HTMLInputElement_put_size,
826 HTMLInputElement_get_size,
827 HTMLInputElement_put_maxLength,
828 HTMLInputElement_get_maxLength,
829 HTMLInputElement_select,
830 HTMLInputElement_put_onchange,
831 HTMLInputElement_get_onchange,
832 HTMLInputElement_put_onselect,
833 HTMLInputElement_get_onselect,
834 HTMLInputElement_put_defaultValue,
835 HTMLInputElement_get_defaultValue,
836 HTMLInputElement_put_readOnly,
837 HTMLInputElement_get_readOnly,
838 HTMLInputElement_createTextRange,
839 HTMLInputElement_put_indeterminate,
840 HTMLInputElement_get_indeterminate,
841 HTMLInputElement_put_defaultChecked,
842 HTMLInputElement_get_defaultChecked,
843 HTMLInputElement_put_checked,
844 HTMLInputElement_get_checked,
845 HTMLInputElement_put_border,
846 HTMLInputElement_get_border,
847 HTMLInputElement_put_vspace,
848 HTMLInputElement_get_vspace,
849 HTMLInputElement_put_hspace,
850 HTMLInputElement_get_hspace,
851 HTMLInputElement_put_alt,
852 HTMLInputElement_get_alt,
853 HTMLInputElement_put_src,
854 HTMLInputElement_get_src,
855 HTMLInputElement_put_lowsrc,
856 HTMLInputElement_get_lowsrc,
857 HTMLInputElement_put_vrml,
858 HTMLInputElement_get_vrml,
859 HTMLInputElement_put_dynsrc,
860 HTMLInputElement_get_dynsrc,
861 HTMLInputElement_get_readyState,
862 HTMLInputElement_get_complete,
863 HTMLInputElement_put_loop,
864 HTMLInputElement_get_loop,
865 HTMLInputElement_put_align,
866 HTMLInputElement_get_align,
867 HTMLInputElement_put_onload,
868 HTMLInputElement_get_onload,
869 HTMLInputElement_put_onerror,
870 HTMLInputElement_get_onerror,
871 HTMLInputElement_put_onabort,
872 HTMLInputElement_get_onabort,
873 HTMLInputElement_put_width,
874 HTMLInputElement_get_width,
875 HTMLInputElement_put_height,
876 HTMLInputElement_get_height,
877 HTMLInputElement_put_start,
878 HTMLInputElement_get_start
881 static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface,
882 REFIID riid, void **ppv)
884 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
886 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
889 static ULONG WINAPI HTMLInputTextElement_AddRef(IHTMLInputTextElement *iface)
891 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
893 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
896 static ULONG WINAPI HTMLInputTextElement_Release(IHTMLInputTextElement *iface)
898 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
900 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
903 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfoCount(IHTMLInputTextElement *iface, UINT *pctinfo)
905 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
906 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
909 static HRESULT WINAPI HTMLInputTextElement_GetTypeInfo(IHTMLInputTextElement *iface, UINT iTInfo,
910 LCID lcid, ITypeInfo **ppTInfo)
912 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
913 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
914 ppTInfo);
917 static HRESULT WINAPI HTMLInputTextElement_GetIDsOfNames(IHTMLInputTextElement *iface, REFIID riid,
918 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
920 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
921 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
922 cNames, lcid, rgDispId);
925 static HRESULT WINAPI HTMLInputTextElement_Invoke(IHTMLInputTextElement *iface, DISPID dispIdMember,
926 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
927 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
929 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
930 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
931 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
934 static HRESULT WINAPI HTMLInputTextElement_get_type(IHTMLInputTextElement *iface, BSTR *p)
936 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
938 TRACE("(%p)->(%p)\n", This, p);
940 return IHTMLInputElement_get_type(&This->IHTMLInputElement_iface, p);
943 static HRESULT WINAPI HTMLInputTextElement_put_value(IHTMLInputTextElement *iface, BSTR v)
945 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
947 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
949 return IHTMLInputElement_put_value(&This->IHTMLInputElement_iface, v);
952 static HRESULT WINAPI HTMLInputTextElement_get_value(IHTMLInputTextElement *iface, BSTR *p)
954 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
956 TRACE("(%p)->(%p)\n", This, p);
958 return IHTMLInputElement_get_value(&This->IHTMLInputElement_iface, p);
961 static HRESULT WINAPI HTMLInputTextElement_put_name(IHTMLInputTextElement *iface, BSTR v)
963 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
965 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
967 return IHTMLInputElement_put_name(&This->IHTMLInputElement_iface, v);
970 static HRESULT WINAPI HTMLInputTextElement_get_name(IHTMLInputTextElement *iface, BSTR *p)
972 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
974 TRACE("(%p)->(%p)\n", This, p);
976 return IHTMLInputElement_get_name(&This->IHTMLInputElement_iface, p);
979 static HRESULT WINAPI HTMLInputTextElement_put_status(IHTMLInputTextElement *iface, VARIANT v)
981 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
982 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
983 return E_NOTIMPL;
986 static HRESULT WINAPI HTMLInputTextElement_get_status(IHTMLInputTextElement *iface, VARIANT *p)
988 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
989 TRACE("(%p)->(%p)\n", This, p);
990 return E_NOTIMPL;
993 static HRESULT WINAPI HTMLInputTextElement_put_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL v)
995 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
997 TRACE("(%p)->(%x)\n", This, v);
999 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1002 static HRESULT WINAPI HTMLInputTextElement_get_disabled(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1004 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1006 TRACE("(%p)->(%p)\n", This, p);
1008 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1011 static HRESULT WINAPI HTMLInputTextElement_get_form(IHTMLInputTextElement *iface, IHTMLFormElement **p)
1013 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1015 TRACE("(%p)->(%p)\n", This, p);
1017 return IHTMLInputElement_get_form(&This->IHTMLInputElement_iface, p);
1020 static HRESULT WINAPI HTMLInputTextElement_put_defaultValue(IHTMLInputTextElement *iface, BSTR v)
1022 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1024 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1026 return IHTMLInputElement_put_defaultValue(&This->IHTMLInputElement_iface, v);
1029 static HRESULT WINAPI HTMLInputTextElement_get_defaultValue(IHTMLInputTextElement *iface, BSTR *p)
1031 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1033 TRACE("(%p)->(%p)\n", This, p);
1035 return IHTMLInputElement_get_defaultValue(&This->IHTMLInputElement_iface, p);
1038 static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface, LONG v)
1040 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1042 TRACE("(%p)->(%d)\n", This, v);
1044 return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
1047 static HRESULT WINAPI HTMLInputTextElement_get_size(IHTMLInputTextElement *iface, LONG *p)
1049 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1051 TRACE("(%p)->(%p)\n", This, p);
1053 return IHTMLInputElement_get_size(&This->IHTMLInputElement_iface, p);
1056 static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *iface, LONG v)
1058 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1060 TRACE("(%p)->(%d)\n", This, v);
1062 return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
1065 static HRESULT WINAPI HTMLInputTextElement_get_maxLength(IHTMLInputTextElement *iface, LONG *p)
1067 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1069 TRACE("(%p)->(%p)\n", This, p);
1071 return IHTMLInputElement_get_maxLength(&This->IHTMLInputElement_iface, p);
1074 static HRESULT WINAPI HTMLInputTextElement_select(IHTMLInputTextElement *iface)
1076 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1078 TRACE("(%p)\n", This);
1080 return IHTMLInputElement_select(&This->IHTMLInputElement_iface);
1083 static HRESULT WINAPI HTMLInputTextElement_put_onchange(IHTMLInputTextElement *iface, VARIANT v)
1085 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1087 TRACE("(%p)->()\n", This);
1089 return IHTMLInputElement_put_onchange(&This->IHTMLInputElement_iface, v);
1092 static HRESULT WINAPI HTMLInputTextElement_get_onchange(IHTMLInputTextElement *iface, VARIANT *p)
1094 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1096 TRACE("(%p)->(%p)\n", This, p);
1098 return IHTMLInputElement_get_onchange(&This->IHTMLInputElement_iface, p);
1101 static HRESULT WINAPI HTMLInputTextElement_put_onselect(IHTMLInputTextElement *iface, VARIANT v)
1103 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1105 TRACE("(%p)->()\n", This);
1107 return IHTMLInputElement_put_onselect(&This->IHTMLInputElement_iface, v);
1110 static HRESULT WINAPI HTMLInputTextElement_get_onselect(IHTMLInputTextElement *iface, VARIANT *p)
1112 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1114 TRACE("(%p)->(%p)\n", This, p);
1116 return IHTMLInputElement_get_onselect(&This->IHTMLInputElement_iface, p);
1119 static HRESULT WINAPI HTMLInputTextElement_put_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL v)
1121 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1123 TRACE("(%p)->(%x)\n", This, v);
1125 return IHTMLInputElement_put_readOnly(&This->IHTMLInputElement_iface, v);
1128 static HRESULT WINAPI HTMLInputTextElement_get_readOnly(IHTMLInputTextElement *iface, VARIANT_BOOL *p)
1130 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1132 TRACE("(%p)->(%p)\n", This, p);
1134 return IHTMLInputElement_get_readOnly(&This->IHTMLInputElement_iface, p);
1137 static HRESULT WINAPI HTMLInputTextElement_createTextRange(IHTMLInputTextElement *iface, IHTMLTxtRange **range)
1139 HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
1141 TRACE("(%p)->(%p)\n", This, range);
1143 return IHTMLInputElement_createTextRange(&This->IHTMLInputElement_iface, range);
1146 static const IHTMLInputTextElementVtbl HTMLInputTextElementVtbl = {
1147 HTMLInputTextElement_QueryInterface,
1148 HTMLInputTextElement_AddRef,
1149 HTMLInputTextElement_Release,
1150 HTMLInputTextElement_GetTypeInfoCount,
1151 HTMLInputTextElement_GetTypeInfo,
1152 HTMLInputTextElement_GetIDsOfNames,
1153 HTMLInputTextElement_Invoke,
1154 HTMLInputTextElement_get_type,
1155 HTMLInputTextElement_put_value,
1156 HTMLInputTextElement_get_value,
1157 HTMLInputTextElement_put_name,
1158 HTMLInputTextElement_get_name,
1159 HTMLInputTextElement_put_status,
1160 HTMLInputTextElement_get_status,
1161 HTMLInputTextElement_put_disabled,
1162 HTMLInputTextElement_get_disabled,
1163 HTMLInputTextElement_get_form,
1164 HTMLInputTextElement_put_defaultValue,
1165 HTMLInputTextElement_get_defaultValue,
1166 HTMLInputTextElement_put_size,
1167 HTMLInputTextElement_get_size,
1168 HTMLInputTextElement_put_maxLength,
1169 HTMLInputTextElement_get_maxLength,
1170 HTMLInputTextElement_select,
1171 HTMLInputTextElement_put_onchange,
1172 HTMLInputTextElement_get_onchange,
1173 HTMLInputTextElement_put_onselect,
1174 HTMLInputTextElement_get_onselect,
1175 HTMLInputTextElement_put_readOnly,
1176 HTMLInputTextElement_get_readOnly,
1177 HTMLInputTextElement_createTextRange
1180 static inline HTMLInputElement *impl_from_IHTMLInputTextElement2(IHTMLInputTextElement2 *iface)
1182 return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputTextElement2_iface);
1185 static HRESULT WINAPI HTMLInputTextElement2_QueryInterface(IHTMLInputTextElement2 *iface, REFIID riid, void **ppv)
1187 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1188 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1191 static ULONG WINAPI HTMLInputTextElement2_AddRef(IHTMLInputTextElement2 *iface)
1193 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1194 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1197 static ULONG WINAPI HTMLInputTextElement2_Release(IHTMLInputTextElement2 *iface)
1199 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1200 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1203 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfoCount(IHTMLInputTextElement2 *iface, UINT *pctinfo)
1205 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1206 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1209 static HRESULT WINAPI HTMLInputTextElement2_GetTypeInfo(IHTMLInputTextElement2 *iface, UINT iTInfo,
1210 LCID lcid, ITypeInfo **ppTInfo)
1212 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1213 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1216 static HRESULT WINAPI HTMLInputTextElement2_GetIDsOfNames(IHTMLInputTextElement2 *iface, REFIID riid,
1217 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1219 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1220 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1221 cNames, lcid, rgDispId);
1224 static HRESULT WINAPI HTMLInputTextElement2_Invoke(IHTMLInputTextElement2 *iface, DISPID dispIdMember,
1225 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1226 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1228 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1229 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1230 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1233 static HRESULT WINAPI HTMLInputTextElement2_put_selectionStart(IHTMLInputTextElement2 *iface, LONG v)
1235 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1236 nsresult nsres;
1238 TRACE("(%p)->(%d)\n", This, v);
1240 nsres = nsIDOMHTMLInputElement_SetSelectionStart(This->nsinput, v);
1241 if(NS_FAILED(nsres)) {
1242 ERR("SetSelectionStart failed: %08x\n", nsres);
1243 return E_FAIL;
1245 return S_OK;
1248 static HRESULT WINAPI HTMLInputTextElement2_get_selectionStart(IHTMLInputTextElement2 *iface, LONG *p)
1250 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1251 INT32 selection_start;
1252 nsresult nsres;
1254 TRACE("(%p)->(%p)\n", This, p);
1256 nsres = nsIDOMHTMLInputElement_GetSelectionStart(This->nsinput, &selection_start);
1257 if(NS_FAILED(nsres)) {
1258 ERR("GetSelectionStart failed: %08x\n", nsres);
1259 return E_FAIL;
1262 *p = selection_start;
1263 return S_OK;
1266 static HRESULT WINAPI HTMLInputTextElement2_put_selectionEnd(IHTMLInputTextElement2 *iface, LONG v)
1268 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1269 nsresult nsres;
1271 TRACE("(%p)->(%d)\n", This, v);
1273 nsres = nsIDOMHTMLInputElement_SetSelectionEnd(This->nsinput, v);
1274 if(NS_FAILED(nsres)) {
1275 ERR("SetSelectionEnd failed: %08x\n", nsres);
1276 return E_FAIL;
1278 return S_OK;
1281 static HRESULT WINAPI HTMLInputTextElement2_get_selectionEnd(IHTMLInputTextElement2 *iface, LONG *p)
1283 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1284 INT32 selection_end;
1285 nsresult nsres;
1287 TRACE("(%p)->(%p)\n", This, p);
1289 nsres = nsIDOMHTMLInputElement_GetSelectionEnd(This->nsinput, &selection_end);
1290 if(NS_FAILED(nsres)) {
1291 ERR("GetSelectionEnd failed: %08x\n", nsres);
1292 return E_FAIL;
1295 *p = selection_end;
1296 return S_OK;
1299 static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElement2 *iface, LONG start, LONG end)
1301 HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
1302 nsAString none_str;
1303 nsresult nsres;
1305 static const WCHAR noneW[] = {'n','o','n','e',0};
1307 TRACE("(%p)->(%d %d)\n", This, start, end);
1309 nsAString_InitDepend(&none_str, noneW);
1310 nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
1311 nsAString_Finish(&none_str);
1312 if(NS_FAILED(nsres)) {
1313 ERR("SetSelectionRange failed: %08x\n", nsres);
1314 return E_FAIL;
1316 return S_OK;
1319 static const IHTMLInputTextElement2Vtbl HTMLInputTextElement2Vtbl = {
1320 HTMLInputTextElement2_QueryInterface,
1321 HTMLInputTextElement2_AddRef,
1322 HTMLInputTextElement2_Release,
1323 HTMLInputTextElement2_GetTypeInfoCount,
1324 HTMLInputTextElement2_GetTypeInfo,
1325 HTMLInputTextElement2_GetIDsOfNames,
1326 HTMLInputTextElement2_Invoke,
1327 HTMLInputTextElement2_put_selectionStart,
1328 HTMLInputTextElement2_get_selectionStart,
1329 HTMLInputTextElement2_put_selectionEnd,
1330 HTMLInputTextElement2_get_selectionEnd,
1331 HTMLInputTextElement2_setSelectionRange
1334 static inline HTMLInputElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
1336 return CONTAINING_RECORD(iface, HTMLInputElement, element.node);
1339 static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1341 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1343 *ppv = NULL;
1345 if(IsEqualGUID(&IID_IUnknown, riid)) {
1346 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1347 *ppv = &This->IHTMLInputElement_iface;
1348 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1349 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1350 *ppv = &This->IHTMLInputElement_iface;
1351 }else if(IsEqualGUID(&IID_IHTMLInputElement, riid)) {
1352 TRACE("(%p)->(IID_IHTMLInputElement %p)\n", This, ppv);
1353 *ppv = &This->IHTMLInputElement_iface;
1354 }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) {
1355 TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv);
1356 *ppv = &This->IHTMLInputTextElement_iface;
1357 }else if(IsEqualGUID(&IID_IHTMLInputTextElement2, riid)) {
1358 TRACE("(%p)->(IID_IHTMLInputTextElement2 %p)\n", This, ppv);
1359 *ppv = &This->IHTMLInputTextElement2_iface;
1362 if(*ppv) {
1363 IUnknown_AddRef((IUnknown*)*ppv);
1364 return S_OK;
1367 return HTMLElement_QI(&This->element.node, riid, ppv);
1370 static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1372 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1373 return IHTMLInputElement_put_disabled(&This->IHTMLInputElement_iface, v);
1376 static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1378 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1379 return IHTMLInputElement_get_disabled(&This->IHTMLInputElement_iface, p);
1382 static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
1384 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1385 const PRUnichar *type;
1386 nsAString nsstr;
1387 nsresult nsres;
1388 BOOL ret = FALSE;
1390 static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
1391 static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
1392 static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
1393 static const WCHAR resetW[] = {'r','e','s','e','t',0};
1394 static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
1395 static const WCHAR textW[] = {'t','e','x','t',0};
1397 nsAString_Init(&nsstr, NULL);
1398 nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
1399 if(NS_SUCCEEDED(nsres)) {
1400 nsAString_GetData(&nsstr, &type);
1401 ret = !strcmpW(type, buttonW) || !strcmpW(type, hiddenW) || !strcmpW(type, passwordW)
1402 || !strcmpW(type, resetW) || !strcmpW(type, submitW) || !strcmpW(type, textW);
1404 nsAString_Finish(&nsstr);
1405 return ret;
1408 static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1410 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1412 if(This->nsinput)
1413 note_cc_edge((nsISupports*)This->nsinput, "This->nsinput", cb);
1416 static void HTMLInputElement_unlink(HTMLDOMNode *iface)
1418 HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
1420 if(This->nsinput) {
1421 nsIDOMHTMLInputElement *nsinput = This->nsinput;
1423 This->nsinput = NULL;
1424 nsIDOMHTMLInputElement_Release(nsinput);
1428 static const NodeImplVtbl HTMLInputElementImplVtbl = {
1429 &CLSID_HTMLInputElement,
1430 HTMLInputElement_QI,
1431 HTMLElement_destructor,
1432 HTMLElement_cpc,
1433 HTMLElement_clone,
1434 HTMLElement_handle_event,
1435 HTMLElement_get_attr_col,
1436 NULL,
1437 HTMLInputElementImpl_put_disabled,
1438 HTMLInputElementImpl_get_disabled,
1439 NULL,
1440 NULL,
1441 NULL,
1442 NULL,
1443 NULL,
1444 HTMLInputElement_traverse,
1445 HTMLInputElement_unlink,
1446 HTMLInputElement_is_text_edit
1449 static const tid_t HTMLInputElement_iface_tids[] = {
1450 HTMLELEMENT_TIDS,
1451 IHTMLInputElement_tid,
1452 IHTMLInputTextElement2_tid,
1455 static dispex_static_data_t HTMLInputElement_dispex = {
1456 NULL,
1457 DispHTMLInputElement_tid,
1458 HTMLInputElement_iface_tids,
1459 HTMLElement_init_dispex_info
1462 HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1464 HTMLInputElement *ret;
1465 nsresult nsres;
1467 ret = heap_alloc_zero(sizeof(HTMLInputElement));
1468 if(!ret)
1469 return E_OUTOFMEMORY;
1471 ret->IHTMLInputElement_iface.lpVtbl = &HTMLInputElementVtbl;
1472 ret->IHTMLInputTextElement_iface.lpVtbl = &HTMLInputTextElementVtbl;
1473 ret->IHTMLInputTextElement2_iface.lpVtbl = &HTMLInputTextElement2Vtbl;
1474 ret->element.node.vtbl = &HTMLInputElementImplVtbl;
1476 HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
1478 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
1479 assert(nsres == NS_OK);
1481 *elem = &ret->element;
1482 return S_OK;
1485 struct HTMLLabelElement {
1486 HTMLElement element;
1488 IHTMLLabelElement IHTMLLabelElement_iface;
1491 static inline HTMLLabelElement *impl_from_IHTMLLabelElement(IHTMLLabelElement *iface)
1493 return CONTAINING_RECORD(iface, HTMLLabelElement, IHTMLLabelElement_iface);
1496 static HRESULT WINAPI HTMLLabelElement_QueryInterface(IHTMLLabelElement *iface,
1497 REFIID riid, void **ppv)
1499 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1501 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1504 static ULONG WINAPI HTMLLabelElement_AddRef(IHTMLLabelElement *iface)
1506 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1508 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1511 static ULONG WINAPI HTMLLabelElement_Release(IHTMLLabelElement *iface)
1513 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1515 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1518 static HRESULT WINAPI HTMLLabelElement_GetTypeInfoCount(IHTMLLabelElement *iface, UINT *pctinfo)
1520 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1522 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1525 static HRESULT WINAPI HTMLLabelElement_GetTypeInfo(IHTMLLabelElement *iface, UINT iTInfo,
1526 LCID lcid, ITypeInfo **ppTInfo)
1528 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1530 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1533 static HRESULT WINAPI HTMLLabelElement_GetIDsOfNames(IHTMLLabelElement *iface, REFIID riid,
1534 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1536 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1538 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1539 cNames, lcid, rgDispId);
1542 static HRESULT WINAPI HTMLLabelElement_Invoke(IHTMLLabelElement *iface, DISPID dispIdMember,
1543 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1544 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1546 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1548 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1549 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1552 static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BSTR v)
1554 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1555 nsAString for_str, val_str;
1556 nsresult nsres;
1558 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1560 nsAString_InitDepend(&for_str, forW);
1561 nsAString_InitDepend(&val_str, v);
1562 nsres = nsIDOMElement_SetAttribute(This->element.dom_element, &for_str, &val_str);
1563 nsAString_Finish(&for_str);
1564 nsAString_Finish(&val_str);
1565 if(NS_FAILED(nsres)) {
1566 ERR("SetAttribute failed: %08x\n", nsres);
1567 return E_FAIL;
1570 return S_OK;
1573 static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BSTR *p)
1575 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1577 TRACE("(%p)->(%p)\n", This, p);
1579 return elem_string_attr_getter(&This->element, forW, FALSE, p);
1582 static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
1584 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1585 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
1586 return E_NOTIMPL;
1589 static HRESULT WINAPI HTMLLabelElement_get_accessKey(IHTMLLabelElement *iface, BSTR *p)
1591 HTMLLabelElement *This = impl_from_IHTMLLabelElement(iface);
1592 FIXME("(%p)->(%p)\n", This, p);
1593 return E_NOTIMPL;
1596 static const IHTMLLabelElementVtbl HTMLLabelElementVtbl = {
1597 HTMLLabelElement_QueryInterface,
1598 HTMLLabelElement_AddRef,
1599 HTMLLabelElement_Release,
1600 HTMLLabelElement_GetTypeInfoCount,
1601 HTMLLabelElement_GetTypeInfo,
1602 HTMLLabelElement_GetIDsOfNames,
1603 HTMLLabelElement_Invoke,
1604 HTMLLabelElement_put_htmlFor,
1605 HTMLLabelElement_get_htmlFor,
1606 HTMLLabelElement_put_accessKey,
1607 HTMLLabelElement_get_accessKey
1610 static inline HTMLLabelElement *label_from_HTMLDOMNode(HTMLDOMNode *iface)
1612 return CONTAINING_RECORD(iface, HTMLLabelElement, element.node);
1615 static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1617 HTMLLabelElement *This = label_from_HTMLDOMNode(iface);
1619 *ppv = NULL;
1621 if(IsEqualGUID(&IID_IUnknown, riid)) {
1622 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1623 *ppv = &This->IHTMLLabelElement_iface;
1624 }else if(IsEqualGUID(&IID_IHTMLLabelElement, riid)) {
1625 TRACE("(%p)->(IID_IHTMLLabelElement %p)\n", This, ppv);
1626 *ppv = &This->IHTMLLabelElement_iface;
1627 }else {
1628 return HTMLElement_QI(&This->element.node, riid, ppv);
1631 IUnknown_AddRef((IUnknown*)*ppv);
1632 return S_OK;
1635 static const NodeImplVtbl HTMLLabelElementImplVtbl = {
1636 &CLSID_HTMLLabelElement,
1637 HTMLLabelElement_QI,
1638 HTMLElement_destructor,
1639 HTMLElement_cpc,
1640 HTMLElement_clone,
1641 HTMLElement_handle_event,
1642 HTMLElement_get_attr_col,
1645 static const tid_t HTMLLabelElement_iface_tids[] = {
1646 HTMLELEMENT_TIDS,
1647 IHTMLLabelElement_tid,
1651 static dispex_static_data_t HTMLLabelElement_dispex = {
1652 NULL,
1653 DispHTMLLabelElement_tid,
1654 HTMLLabelElement_iface_tids,
1655 HTMLElement_init_dispex_info
1658 HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
1660 HTMLLabelElement *ret;
1662 ret = heap_alloc_zero(sizeof(*ret));
1663 if(!ret)
1664 return E_OUTOFMEMORY;
1666 ret->IHTMLLabelElement_iface.lpVtbl = &HTMLLabelElementVtbl;
1667 ret->element.node.vtbl = &HTMLLabelElementImplVtbl;
1669 HTMLElement_Init(&ret->element, doc, nselem, &HTMLLabelElement_dispex);
1670 *elem = &ret->element;
1671 return S_OK;
1674 struct HTMLButtonElement {
1675 HTMLElement element;
1677 IHTMLButtonElement IHTMLButtonElement_iface;
1679 nsIDOMHTMLButtonElement *nsbutton;
1682 static inline HTMLButtonElement *impl_from_IHTMLButtonElement(IHTMLButtonElement *iface)
1684 return CONTAINING_RECORD(iface, HTMLButtonElement, IHTMLButtonElement_iface);
1687 static HRESULT WINAPI HTMLButtonElement_QueryInterface(IHTMLButtonElement *iface,
1688 REFIID riid, void **ppv)
1690 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1692 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
1695 static ULONG WINAPI HTMLButtonElement_AddRef(IHTMLButtonElement *iface)
1697 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1699 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
1702 static ULONG WINAPI HTMLButtonElement_Release(IHTMLButtonElement *iface)
1704 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1706 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
1709 static HRESULT WINAPI HTMLButtonElement_GetTypeInfoCount(IHTMLButtonElement *iface, UINT *pctinfo)
1711 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1713 return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
1716 static HRESULT WINAPI HTMLButtonElement_GetTypeInfo(IHTMLButtonElement *iface, UINT iTInfo,
1717 LCID lcid, ITypeInfo **ppTInfo)
1719 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1721 return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1724 static HRESULT WINAPI HTMLButtonElement_GetIDsOfNames(IHTMLButtonElement *iface, REFIID riid,
1725 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1727 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1729 return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
1730 cNames, lcid, rgDispId);
1733 static HRESULT WINAPI HTMLButtonElement_Invoke(IHTMLButtonElement *iface, DISPID dispIdMember,
1734 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1735 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1737 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1739 return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
1740 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1743 static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR *p)
1745 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1746 nsAString type_str;
1747 nsresult nsres;
1749 TRACE("(%p)->(%p)\n", This, p);
1751 nsAString_Init(&type_str, NULL);
1752 nsres = nsIDOMHTMLButtonElement_GetType(This->nsbutton, &type_str);
1753 return return_nsstr(nsres, &type_str, p);
1756 static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
1758 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1759 nsAString nsstr;
1760 nsresult nsres;
1762 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1764 nsAString_InitDepend(&nsstr, v);
1765 nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
1766 nsAString_Finish(&nsstr);
1767 if(NS_FAILED(nsres)) {
1768 ERR("SetValue failed: %08x\n", nsres);
1769 return E_FAIL;
1772 return S_OK;
1775 static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
1777 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1778 nsAString value_str;
1779 nsresult nsres;
1781 TRACE("(%p)->(%p)\n", This, p);
1783 nsAString_Init(&value_str, NULL);
1784 nsres = nsIDOMHTMLButtonElement_GetValue(This->nsbutton, &value_str);
1785 return return_nsstr(nsres, &value_str, p);
1788 static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)
1790 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1791 nsAString name_str;
1792 nsresult nsres;
1794 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
1796 nsAString_InitDepend(&name_str, v);
1797 nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
1798 nsAString_Finish(&name_str);
1799 if(NS_FAILED(nsres)) {
1800 ERR("SetName failed: %08x\n", nsres);
1801 return E_FAIL;
1804 return S_OK;
1807 static HRESULT WINAPI HTMLButtonElement_get_name(IHTMLButtonElement *iface, BSTR *p)
1809 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1810 nsAString name_str;
1811 nsresult nsres;
1813 TRACE("(%p)->(%p)\n", This, p);
1815 nsAString_Init(&name_str, NULL);
1816 nsres = nsIDOMHTMLButtonElement_GetName(This->nsbutton, &name_str);
1817 return return_nsstr(nsres, &name_str, p);
1820 static HRESULT WINAPI HTMLButtonElement_put_status(IHTMLButtonElement *iface, VARIANT v)
1822 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1823 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1824 return E_NOTIMPL;
1827 static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VARIANT *p)
1829 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1830 FIXME("(%p)->(%p)\n", This, p);
1831 return E_NOTIMPL;
1834 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
1836 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1837 nsresult nsres;
1839 TRACE("(%p)->(%x)\n", This, v);
1841 nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
1842 if(NS_FAILED(nsres)) {
1843 ERR("SetDisabled failed: %08x\n", nsres);
1844 return E_FAIL;
1847 return S_OK;
1850 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
1852 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1853 cpp_bool disabled;
1854 nsresult nsres;
1856 TRACE("(%p)->(%p)\n", This, p);
1858 nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
1859 if(NS_FAILED(nsres)) {
1860 ERR("GetDisabled failed: %08x\n", nsres);
1861 return E_FAIL;
1864 *p = variant_bool(disabled);
1865 return S_OK;
1868 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
1870 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1871 nsIDOMHTMLFormElement *nsform;
1872 nsresult nsres;
1874 TRACE("(%p)->(%p)\n", This, p);
1876 nsres = nsIDOMHTMLButtonElement_GetForm(This->nsbutton, &nsform);
1877 return return_nsform(nsres, nsform, p);
1880 static HRESULT WINAPI HTMLButtonElement_createTextRange(IHTMLButtonElement *iface, IHTMLTxtRange **range)
1882 HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
1883 FIXME("(%p)->(%p)\n", This, range);
1884 return E_NOTIMPL;
1887 static const IHTMLButtonElementVtbl HTMLButtonElementVtbl = {
1888 HTMLButtonElement_QueryInterface,
1889 HTMLButtonElement_AddRef,
1890 HTMLButtonElement_Release,
1891 HTMLButtonElement_GetTypeInfoCount,
1892 HTMLButtonElement_GetTypeInfo,
1893 HTMLButtonElement_GetIDsOfNames,
1894 HTMLButtonElement_Invoke,
1895 HTMLButtonElement_get_type,
1896 HTMLButtonElement_put_value,
1897 HTMLButtonElement_get_value,
1898 HTMLButtonElement_put_name,
1899 HTMLButtonElement_get_name,
1900 HTMLButtonElement_put_status,
1901 HTMLButtonElement_get_status,
1902 HTMLButtonElement_put_disabled,
1903 HTMLButtonElement_get_disabled,
1904 HTMLButtonElement_get_form,
1905 HTMLButtonElement_createTextRange
1908 static inline HTMLButtonElement *button_from_HTMLDOMNode(HTMLDOMNode *iface)
1910 return CONTAINING_RECORD(iface, HTMLButtonElement, element.node);
1913 static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1915 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1917 *ppv = NULL;
1919 if(IsEqualGUID(&IID_IUnknown, riid)) {
1920 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1921 *ppv = &This->IHTMLButtonElement_iface;
1922 }else if(IsEqualGUID(&IID_IHTMLButtonElement, riid)) {
1923 TRACE("(%p)->(IID_IHTMLButtonElement %p)\n", This, ppv);
1924 *ppv = &This->IHTMLButtonElement_iface;
1925 }else {
1926 return HTMLElement_QI(&This->element.node, riid, ppv);
1929 IUnknown_AddRef((IUnknown*)*ppv);
1930 return S_OK;
1933 static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
1935 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1936 return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
1939 static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
1941 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1942 return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
1945 static BOOL HTMLButtonElement_is_text_edit(HTMLDOMNode *iface)
1947 return TRUE;
1950 static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
1952 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1954 if(This->nsbutton)
1955 note_cc_edge((nsISupports*)This->nsbutton, "This->nsbutton", cb);
1958 static void HTMLButtonElement_unlink(HTMLDOMNode *iface)
1960 HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
1962 if(This->nsbutton) {
1963 nsIDOMHTMLButtonElement *nsbutton = This->nsbutton;
1965 This->nsbutton = NULL;
1966 nsIDOMHTMLButtonElement_Release(nsbutton);
1970 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
1971 &CLSID_HTMLButtonElement,
1972 HTMLButtonElement_QI,
1973 HTMLElement_destructor,
1974 HTMLElement_cpc,
1975 HTMLElement_clone,
1976 HTMLElement_handle_event,
1977 HTMLElement_get_attr_col,
1978 NULL,
1979 HTMLButtonElementImpl_put_disabled,
1980 HTMLButtonElementImpl_get_disabled,
1981 NULL,
1982 NULL,
1983 NULL,
1984 NULL,
1985 NULL,
1986 HTMLButtonElement_traverse,
1987 HTMLButtonElement_unlink,
1988 HTMLButtonElement_is_text_edit
1991 static const tid_t HTMLButtonElement_iface_tids[] = {
1992 HTMLELEMENT_TIDS,
1993 IHTMLButtonElement_tid,
1997 static dispex_static_data_t HTMLButtonElement_dispex = {
1998 NULL,
1999 DispHTMLButtonElement_tid,
2000 HTMLButtonElement_iface_tids,
2001 HTMLElement_init_dispex_info
2004 HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem)
2006 HTMLButtonElement *ret;
2007 nsresult nsres;
2009 ret = heap_alloc_zero(sizeof(*ret));
2010 if(!ret)
2011 return E_OUTOFMEMORY;
2013 ret->IHTMLButtonElement_iface.lpVtbl = &HTMLButtonElementVtbl;
2014 ret->element.node.vtbl = &HTMLButtonElementImplVtbl;
2016 HTMLElement_Init(&ret->element, doc, nselem, &HTMLButtonElement_dispex);
2018 nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLButtonElement, (void**)&ret->nsbutton);
2019 assert(nsres == NS_OK);
2021 *elem = &ret->element;
2022 return S_OK;