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 const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
39 nsIDOMHTMLTextAreaElement *nstextarea;
40 } HTMLTextAreaElement;
42 #define HTMLTXTAREA(x) ((IHTMLTextAreaElement*) &(x)->lpHTMLTextAreaElementVtbl)
44 #define HTMLTXTAREA_THIS(iface) DEFINE_THIS(HTMLTextAreaElement, HTMLTextAreaElement, iface)
46 static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *iface,
47 REFIID riid, void **ppv)
49 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
51 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
56 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
58 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
63 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
65 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
70 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
71 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
74 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
75 LCID lcid, ITypeInfo **ppTInfo)
77 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
78 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
81 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
82 LPOLESTR *rgszNames, UINT cNames,
83 LCID lcid, DISPID *rgDispId)
85 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
86 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
89 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
90 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
91 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
94 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
95 pVarResult, pExcepInfo, puArgErr);
98 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
100 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, p);
105 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
107 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
108 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
112 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
114 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
116 const PRUnichar *value;
119 TRACE("(%p)->(%p)\n", This, p);
121 nsAString_Init(&value_str, NULL);
123 nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
124 if(NS_SUCCEEDED(nsres)) {
125 nsAString_GetData(&value_str, &value);
126 *p = SysAllocString(value);
128 ERR("GetValue failed: %08x\n", nsres);
131 nsAString_Finish(&value_str);
133 TRACE("%s\n", debugstr_w(*p));
137 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
139 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
140 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
144 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
146 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
148 const PRUnichar *name;
151 TRACE("(%p)->(%p)\n", This, p);
153 nsAString_Init(&name_str, NULL);
155 nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
156 if(NS_SUCCEEDED(nsres)) {
157 nsAString_GetData(&name_str, &name);
158 *p = SysAllocString(name);
160 ERR("GetName failed: %08x\n", nsres);
163 nsAString_Finish(&name_str);
165 TRACE("%s\n", debugstr_w(*p));
169 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
171 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
172 FIXME("(%p)->()\n", This);
176 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
178 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
179 FIXME("(%p)->(%p)\n", This, p);
183 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
185 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
186 FIXME("(%p)->(%x)\n", This, v);
190 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
192 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
193 FIXME("(%p)->(%p)\n", This, p);
197 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
199 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
200 FIXME("(%p)->(%p)\n", This, p);
204 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
206 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
207 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
211 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
213 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
214 FIXME("(%p)->(%p)\n", This, p);
218 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
220 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
221 FIXME("(%p)\n", This);
225 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
227 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
228 FIXME("(%p)->()\n", This);
232 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
234 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
235 FIXME("(%p)->(%p)\n", This, p);
239 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
241 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
242 FIXME("(%p)->()\n", This);
246 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
248 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
249 FIXME("(%p)->(%p)\n", This, p);
253 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
255 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
256 FIXME("(%p)->(%x)\n", This, v);
260 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
262 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
263 FIXME("(%p)->(%p)\n", This, p);
267 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, LONG v)
269 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
270 FIXME("(%p)->(%d)\n", This, v);
274 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, LONG *p)
276 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
277 FIXME("(%p)->(%p)\n", This, p);
281 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, LONG v)
283 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
284 FIXME("(%p)->(%d)\n", This, v);
288 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, LONG *p)
290 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
291 FIXME("(%p)->(%p)\n", This, p);
295 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
297 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
298 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
302 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
304 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
305 FIXME("(%p)->(%p)\n", This, p);
309 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
310 IHTMLTxtRange **range)
312 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
313 FIXME("(%p)->(%p)\n", This, range);
317 #undef HTMLTXTAREA_THIS
319 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
320 HTMLTextAreaElement_QueryInterface,
321 HTMLTextAreaElement_AddRef,
322 HTMLTextAreaElement_Release,
323 HTMLTextAreaElement_GetTypeInfoCount,
324 HTMLTextAreaElement_GetTypeInfo,
325 HTMLTextAreaElement_GetIDsOfNames,
326 HTMLTextAreaElement_Invoke,
327 HTMLTextAreaElement_get_type,
328 HTMLTextAreaElement_put_value,
329 HTMLTextAreaElement_get_value,
330 HTMLTextAreaElement_put_name,
331 HTMLTextAreaElement_get_name,
332 HTMLTextAreaElement_put_status,
333 HTMLTextAreaElement_get_status,
334 HTMLTextAreaElement_put_disabled,
335 HTMLTextAreaElement_get_disabled,
336 HTMLTextAreaElement_get_form,
337 HTMLTextAreaElement_put_defaultValue,
338 HTMLTextAreaElement_get_defaultValue,
339 HTMLTextAreaElement_select,
340 HTMLTextAreaElement_put_onchange,
341 HTMLTextAreaElement_get_onchange,
342 HTMLTextAreaElement_put_onselect,
343 HTMLTextAreaElement_get_onselect,
344 HTMLTextAreaElement_put_readOnly,
345 HTMLTextAreaElement_get_readOnly,
346 HTMLTextAreaElement_put_rows,
347 HTMLTextAreaElement_get_rows,
348 HTMLTextAreaElement_put_cols,
349 HTMLTextAreaElement_get_cols,
350 HTMLTextAreaElement_put_wrap,
351 HTMLTextAreaElement_get_wrap,
352 HTMLTextAreaElement_createTextRange
355 #define HTMLTXTAREA_NODE_THIS(iface) DEFINE_THIS2(HTMLTextAreaElement, element.node, iface)
357 static HRESULT HTMLTextAreaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
359 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
363 if(IsEqualGUID(&IID_IUnknown, riid)) {
364 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
365 *ppv = HTMLTXTAREA(This);
366 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
367 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
368 *ppv = HTMLTXTAREA(This);
369 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
370 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
371 *ppv = HTMLTXTAREA(This);
375 IUnknown_AddRef((IUnknown*)*ppv);
379 return HTMLElement_QI(&This->element.node, riid, ppv);
382 static void HTMLTextAreaElement_destructor(HTMLDOMNode *iface)
384 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
386 nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
388 HTMLElement_destructor(&This->element.node);
391 static HRESULT HTMLTextAreaElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
393 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
394 return IHTMLTextAreaElement_put_disabled(HTMLTXTAREA(This), v);
397 static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
399 HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
400 return IHTMLTextAreaElement_get_disabled(HTMLTXTAREA(This), p);
403 #undef HTMLTXTAREA_NODE_THIS
405 static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
406 HTMLTextAreaElement_QI,
407 HTMLTextAreaElement_destructor,
410 HTMLTextAreaElementImpl_put_disabled,
411 HTMLTextAreaElementImpl_get_disabled
414 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)
416 HTMLTextAreaElement *ret = heap_alloc_zero(sizeof(HTMLTextAreaElement));
419 ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
420 ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl;
422 HTMLElement_Init(&ret->element, NULL);
424 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
425 (void**)&ret->nstextarea);
427 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
429 return &ret->element;