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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
37 IHTMLTextAreaElement IHTMLTextAreaElement_iface
;
39 nsIDOMHTMLTextAreaElement
*nstextarea
;
40 } HTMLTextAreaElement
;
42 static inline HTMLTextAreaElement
*impl_from_IHTMLTextAreaElement(IHTMLTextAreaElement
*iface
)
44 return CONTAINING_RECORD(iface
, HTMLTextAreaElement
, IHTMLTextAreaElement_iface
);
47 static HRESULT WINAPI
HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement
*iface
,
48 REFIID riid
, void **ppv
)
50 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
52 return IHTMLDOMNode_QueryInterface(&This
->element
.node
.IHTMLDOMNode_iface
, riid
, ppv
);
55 static ULONG WINAPI
HTMLTextAreaElement_AddRef(IHTMLTextAreaElement
*iface
)
57 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
59 return IHTMLDOMNode_AddRef(&This
->element
.node
.IHTMLDOMNode_iface
);
62 static ULONG WINAPI
HTMLTextAreaElement_Release(IHTMLTextAreaElement
*iface
)
64 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
66 return IHTMLDOMNode_Release(&This
->element
.node
.IHTMLDOMNode_iface
);
69 static HRESULT WINAPI
HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement
*iface
, UINT
*pctinfo
)
71 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
72 return IDispatchEx_GetTypeInfoCount(&This
->element
.node
.dispex
.IDispatchEx_iface
, pctinfo
);
75 static HRESULT WINAPI
HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement
*iface
, UINT iTInfo
,
76 LCID lcid
, ITypeInfo
**ppTInfo
)
78 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
79 return IDispatchEx_GetTypeInfo(&This
->element
.node
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
,
83 static HRESULT WINAPI
HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement
*iface
, REFIID riid
,
84 LPOLESTR
*rgszNames
, UINT cNames
,
85 LCID lcid
, DISPID
*rgDispId
)
87 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
88 return IDispatchEx_GetIDsOfNames(&This
->element
.node
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
89 cNames
, lcid
, rgDispId
);
92 static HRESULT WINAPI
HTMLTextAreaElement_Invoke(IHTMLTextAreaElement
*iface
, DISPID dispIdMember
,
93 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
94 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
96 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
97 return IDispatchEx_Invoke(&This
->element
.node
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
,
98 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
101 static HRESULT WINAPI
HTMLTextAreaElement_get_type(IHTMLTextAreaElement
*iface
, BSTR
*p
)
103 static const WCHAR textareaW
[] = {'t','e','x','t','a','r','e','a',0};
105 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
107 TRACE("(%p)->(%p)\n", This
, p
);
109 *p
= SysAllocString(textareaW
);
111 return E_OUTOFMEMORY
;
115 static HRESULT WINAPI
HTMLTextAreaElement_put_value(IHTMLTextAreaElement
*iface
, BSTR v
)
117 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
121 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
123 nsAString_InitDepend(&value_str
, v
);
124 nsres
= nsIDOMHTMLTextAreaElement_SetValue(This
->nstextarea
, &value_str
);
125 nsAString_Finish(&value_str
);
126 if(NS_FAILED(nsres
)) {
127 ERR("SetValue failed: %08x\n", nsres
);
134 static HRESULT WINAPI
HTMLTextAreaElement_get_value(IHTMLTextAreaElement
*iface
, BSTR
*p
)
136 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
140 TRACE("(%p)->(%p)\n", This
, p
);
142 nsAString_Init(&value_str
, NULL
);
143 nsres
= nsIDOMHTMLTextAreaElement_GetValue(This
->nstextarea
, &value_str
);
144 return return_nsstr(nsres
, &value_str
, p
);
147 static HRESULT WINAPI
HTMLTextAreaElement_put_name(IHTMLTextAreaElement
*iface
, BSTR v
)
149 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
150 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
154 static HRESULT WINAPI
HTMLTextAreaElement_get_name(IHTMLTextAreaElement
*iface
, BSTR
*p
)
156 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
160 TRACE("(%p)->(%p)\n", This
, p
);
162 nsAString_Init(&name_str
, NULL
);
163 nsres
= nsIDOMHTMLTextAreaElement_GetName(This
->nstextarea
, &name_str
);
164 return return_nsstr(nsres
, &name_str
, p
);
167 static HRESULT WINAPI
HTMLTextAreaElement_put_status(IHTMLTextAreaElement
*iface
, VARIANT v
)
169 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
170 FIXME("(%p)->()\n", This
);
174 static HRESULT WINAPI
HTMLTextAreaElement_get_status(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
176 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
177 FIXME("(%p)->(%p)\n", This
, p
);
181 static HRESULT WINAPI
HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement
*iface
, VARIANT_BOOL v
)
183 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
184 FIXME("(%p)->(%x)\n", This
, v
);
188 static HRESULT WINAPI
HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement
*iface
, VARIANT_BOOL
*p
)
190 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
191 FIXME("(%p)->(%p)\n", This
, p
);
195 static HRESULT WINAPI
HTMLTextAreaElement_get_form(IHTMLTextAreaElement
*iface
, IHTMLFormElement
**p
)
197 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
198 FIXME("(%p)->(%p)\n", This
, p
);
202 static HRESULT WINAPI
HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement
*iface
, BSTR v
)
204 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
205 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
209 static HRESULT WINAPI
HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement
*iface
, BSTR
*p
)
211 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
212 FIXME("(%p)->(%p)\n", This
, p
);
216 static HRESULT WINAPI
HTMLTextAreaElement_select(IHTMLTextAreaElement
*iface
)
218 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
219 FIXME("(%p)\n", This
);
223 static HRESULT WINAPI
HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement
*iface
, VARIANT v
)
225 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
226 FIXME("(%p)->()\n", This
);
230 static HRESULT WINAPI
HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
232 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
233 FIXME("(%p)->(%p)\n", This
, p
);
237 static HRESULT WINAPI
HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement
*iface
, VARIANT v
)
239 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
240 FIXME("(%p)->()\n", This
);
244 static HRESULT WINAPI
HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
246 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
247 FIXME("(%p)->(%p)\n", This
, p
);
251 static HRESULT WINAPI
HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement
*iface
, VARIANT_BOOL v
)
253 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
256 TRACE("(%p)->(%x)\n", This
, v
);
258 nsres
= nsIDOMHTMLTextAreaElement_SetReadOnly(This
->nstextarea
, v
!= VARIANT_FALSE
);
259 if(NS_FAILED(nsres
)) {
260 ERR("SetReadOnly failed: %08x\n", nsres
);
267 static HRESULT WINAPI
HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement
*iface
, VARIANT_BOOL
*p
)
269 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
273 TRACE("(%p)->(%p)\n", This
, p
);
275 nsres
= nsIDOMHTMLTextAreaElement_GetReadOnly(This
->nstextarea
, &b
);
276 if(NS_FAILED(nsres
)) {
277 ERR("GetReadOnly failed: %08x\n", nsres
);
281 *p
= b
? VARIANT_TRUE
: VARIANT_FALSE
;
285 static HRESULT WINAPI
HTMLTextAreaElement_put_rows(IHTMLTextAreaElement
*iface
, LONG v
)
287 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
288 FIXME("(%p)->(%d)\n", This
, v
);
292 static HRESULT WINAPI
HTMLTextAreaElement_get_rows(IHTMLTextAreaElement
*iface
, LONG
*p
)
294 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
295 FIXME("(%p)->(%p)\n", This
, p
);
299 static HRESULT WINAPI
HTMLTextAreaElement_put_cols(IHTMLTextAreaElement
*iface
, LONG v
)
301 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
302 FIXME("(%p)->(%d)\n", This
, v
);
306 static HRESULT WINAPI
HTMLTextAreaElement_get_cols(IHTMLTextAreaElement
*iface
, LONG
*p
)
308 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
309 FIXME("(%p)->(%p)\n", This
, p
);
313 static HRESULT WINAPI
HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement
*iface
, BSTR v
)
315 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
316 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
320 static HRESULT WINAPI
HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement
*iface
, BSTR
*p
)
322 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
323 FIXME("(%p)->(%p)\n", This
, p
);
327 static HRESULT WINAPI
HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement
*iface
,
328 IHTMLTxtRange
**range
)
330 HTMLTextAreaElement
*This
= impl_from_IHTMLTextAreaElement(iface
);
331 FIXME("(%p)->(%p)\n", This
, range
);
335 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl
= {
336 HTMLTextAreaElement_QueryInterface
,
337 HTMLTextAreaElement_AddRef
,
338 HTMLTextAreaElement_Release
,
339 HTMLTextAreaElement_GetTypeInfoCount
,
340 HTMLTextAreaElement_GetTypeInfo
,
341 HTMLTextAreaElement_GetIDsOfNames
,
342 HTMLTextAreaElement_Invoke
,
343 HTMLTextAreaElement_get_type
,
344 HTMLTextAreaElement_put_value
,
345 HTMLTextAreaElement_get_value
,
346 HTMLTextAreaElement_put_name
,
347 HTMLTextAreaElement_get_name
,
348 HTMLTextAreaElement_put_status
,
349 HTMLTextAreaElement_get_status
,
350 HTMLTextAreaElement_put_disabled
,
351 HTMLTextAreaElement_get_disabled
,
352 HTMLTextAreaElement_get_form
,
353 HTMLTextAreaElement_put_defaultValue
,
354 HTMLTextAreaElement_get_defaultValue
,
355 HTMLTextAreaElement_select
,
356 HTMLTextAreaElement_put_onchange
,
357 HTMLTextAreaElement_get_onchange
,
358 HTMLTextAreaElement_put_onselect
,
359 HTMLTextAreaElement_get_onselect
,
360 HTMLTextAreaElement_put_readOnly
,
361 HTMLTextAreaElement_get_readOnly
,
362 HTMLTextAreaElement_put_rows
,
363 HTMLTextAreaElement_get_rows
,
364 HTMLTextAreaElement_put_cols
,
365 HTMLTextAreaElement_get_cols
,
366 HTMLTextAreaElement_put_wrap
,
367 HTMLTextAreaElement_get_wrap
,
368 HTMLTextAreaElement_createTextRange
371 static inline HTMLTextAreaElement
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
373 return CONTAINING_RECORD(iface
, HTMLTextAreaElement
, element
.node
);
376 static HRESULT
HTMLTextAreaElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
378 HTMLTextAreaElement
*This
= impl_from_HTMLDOMNode(iface
);
382 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
383 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
384 *ppv
= &This
->IHTMLTextAreaElement_iface
;
385 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
386 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
387 *ppv
= &This
->IHTMLTextAreaElement_iface
;
388 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement
, riid
)) {
389 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This
, ppv
);
390 *ppv
= &This
->IHTMLTextAreaElement_iface
;
394 IUnknown_AddRef((IUnknown
*)*ppv
);
398 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
401 static void HTMLTextAreaElement_destructor(HTMLDOMNode
*iface
)
403 HTMLTextAreaElement
*This
= impl_from_HTMLDOMNode(iface
);
405 nsIDOMHTMLTextAreaElement_Release(This
->nstextarea
);
407 HTMLElement_destructor(&This
->element
.node
);
410 static HRESULT
HTMLTextAreaElementImpl_put_disabled(HTMLDOMNode
*iface
, VARIANT_BOOL v
)
412 HTMLTextAreaElement
*This
= impl_from_HTMLDOMNode(iface
);
413 return IHTMLTextAreaElement_put_disabled(&This
->IHTMLTextAreaElement_iface
, v
);
416 static HRESULT
HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode
*iface
, VARIANT_BOOL
*p
)
418 HTMLTextAreaElement
*This
= impl_from_HTMLDOMNode(iface
);
419 return IHTMLTextAreaElement_get_disabled(&This
->IHTMLTextAreaElement_iface
, p
);
422 static const NodeImplVtbl HTMLTextAreaElementImplVtbl
= {
423 HTMLTextAreaElement_QI
,
424 HTMLTextAreaElement_destructor
,
426 HTMLElement_get_attr_col
,
430 HTMLTextAreaElementImpl_put_disabled
,
431 HTMLTextAreaElementImpl_get_disabled
434 static const tid_t HTMLTextAreaElement_iface_tids
[] = {
436 IHTMLTextAreaElement_tid
,
440 static dispex_static_data_t HTMLTextAreaElement_dispex
= {
442 DispHTMLTextAreaElement_tid
,
444 HTMLTextAreaElement_iface_tids
447 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*doc
, nsIDOMHTMLElement
*nselem
, HTMLElement
**elem
)
449 HTMLTextAreaElement
*ret
;
452 ret
= heap_alloc_zero(sizeof(HTMLTextAreaElement
));
454 return E_OUTOFMEMORY
;
456 ret
->IHTMLTextAreaElement_iface
.lpVtbl
= &HTMLTextAreaElementVtbl
;
457 ret
->element
.node
.vtbl
= &HTMLTextAreaElementImplVtbl
;
459 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTextAreaElement
,
460 (void**)&ret
->nstextarea
);
461 if(NS_FAILED(nsres
)) {
462 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres
);
467 HTMLElement_Init(&ret
->element
, doc
, nselem
, &HTMLTextAreaElement_dispex
);
469 *elem
= &ret
->element
;