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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
42 nsIDOMHTMLTextAreaElement *nstextarea;
43 } HTMLTextAreaElement;
45 #define HTMLTXTAREA(x) ((IHTMLTextAreaElement*) &(x)->lpHTMLTextAreaElementVtbl)
47 #define HTMLTXTAREA_THIS(iface) DEFINE_THIS(HTMLTextAreaElement, HTMLTextAreaElement, iface)
49 static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *iface,
50 REFIID riid, void **ppv)
52 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
56 if(IsEqualGUID(&IID_IUnknown, riid)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
58 *ppv = HTMLTXTAREA(This);
59 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
60 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
61 *ppv = HTMLTXTAREA(This);
62 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
63 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
64 *ppv = HTMLTXTAREA(This);
65 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
66 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
67 *ppv = HTMLELEM(This->element);
68 }else if(IsEqualGUID(&IID_IHTMLDOMNode, riid)) {
69 TRACE("(%p)->(IID_IHTMLDOMNode %p)\n", This, ppv);
70 *ppv = HTMLDOMNODE(This->element->node);
74 IUnknown_AddRef((IUnknown*)*ppv);
78 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
82 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
84 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
86 TRACE("(%p)\n", This);
88 return IHTMLDocument2_AddRef(HTMLDOC(This->element->node->doc));
91 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
93 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
95 TRACE("(%p)\n", This);
97 return IHTMLDocument2_Release(HTMLDOC(This->element->node->doc));
100 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
102 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
103 FIXME("(%p)->(%p)\n", This, pctinfo);
107 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
108 LCID lcid, ITypeInfo **ppTInfo)
110 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
111 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
115 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
116 LPOLESTR *rgszNames, UINT cNames,
117 LCID lcid, DISPID *rgDispId)
119 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
120 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
125 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
126 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
127 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
129 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
130 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
131 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
135 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
137 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
138 FIXME("(%p)->(%p)\n", This, p);
142 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
144 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
145 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
149 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
151 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
153 const PRUnichar *value;
156 TRACE("(%p)->(%p)\n", This, p);
158 nsAString_Init(&value_str, NULL);
160 nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
161 if(NS_SUCCEEDED(nsres)) {
162 nsAString_GetData(&value_str, &value, NULL);
163 *p = SysAllocString(value);
165 ERR("GetValue failed: %08lx\n", nsres);
168 nsAString_Finish(&value_str);
170 TRACE("%s\n", debugstr_w(*p));
174 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
176 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
177 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
181 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
183 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
185 const PRUnichar *name;
188 TRACE("(%p)->(%p)\n", This, p);
190 nsAString_Init(&name_str, NULL);
192 nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
193 if(NS_SUCCEEDED(nsres)) {
194 nsAString_GetData(&name_str, &name, NULL);
195 *p = SysAllocString(name);
197 ERR("GetName failed: %08lx\n", nsres);
200 nsAString_Finish(&name_str);
202 TRACE("%s\n", debugstr_w(*p));
206 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
208 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
209 FIXME("(%p)->()\n", This);
213 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
215 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
216 FIXME("(%p)->(%p)\n", This, p);
220 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
222 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
223 FIXME("(%p)->(%x)\n", This, v);
227 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
229 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
230 FIXME("(%p)->(%p)\n", This, p);
234 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
236 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
237 FIXME("(%p)->(%p)\n", This, p);
241 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
243 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
244 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
248 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
250 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
251 FIXME("(%p)->(%p)\n", This, p);
255 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
257 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
258 FIXME("(%p)\n", This);
262 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
264 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
265 FIXME("(%p)->()\n", This);
269 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
271 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
272 FIXME("(%p)->(%p)\n", This, p);
276 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
278 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
279 FIXME("(%p)->()\n", This);
283 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
285 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
286 FIXME("(%p)->(%p)\n", This, p);
290 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
292 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
293 FIXME("(%p)->(%x)\n", This, v);
297 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
299 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
300 FIXME("(%p)->(%p)\n", This, p);
304 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, long v)
306 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
307 FIXME("(%p)->(%ld)\n", This, v);
311 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, long *p)
313 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
314 FIXME("(%p)->(%p)\n", This, p);
318 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, long v)
320 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
321 FIXME("(%p)->(%ld)\n", This, v);
325 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, long *p)
327 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
328 FIXME("(%p)->(%p)\n", This, p);
332 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
334 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
335 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
339 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
341 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
342 FIXME("(%p)->(%p)\n", This, p);
346 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
347 IHTMLTxtRange **range)
349 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
350 FIXME("(%p)->(%p)\n", This, range);
354 static void HTMLTextAreaElement_destructor(IUnknown *iface)
356 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
358 nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
359 HeapFree(GetProcessHeap(), 0, This);
362 #undef HTMLTXTAREA_THIS
364 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
365 HTMLTextAreaElement_QueryInterface,
366 HTMLTextAreaElement_AddRef,
367 HTMLTextAreaElement_Release,
368 HTMLTextAreaElement_GetTypeInfoCount,
369 HTMLTextAreaElement_GetTypeInfo,
370 HTMLTextAreaElement_GetIDsOfNames,
371 HTMLTextAreaElement_Invoke,
372 HTMLTextAreaElement_get_type,
373 HTMLTextAreaElement_put_value,
374 HTMLTextAreaElement_get_value,
375 HTMLTextAreaElement_put_name,
376 HTMLTextAreaElement_get_name,
377 HTMLTextAreaElement_put_status,
378 HTMLTextAreaElement_get_status,
379 HTMLTextAreaElement_put_disabled,
380 HTMLTextAreaElement_get_disabled,
381 HTMLTextAreaElement_get_form,
382 HTMLTextAreaElement_put_defaultValue,
383 HTMLTextAreaElement_get_defaultValue,
384 HTMLTextAreaElement_select,
385 HTMLTextAreaElement_put_onchange,
386 HTMLTextAreaElement_get_onchange,
387 HTMLTextAreaElement_put_onselect,
388 HTMLTextAreaElement_get_onselect,
389 HTMLTextAreaElement_put_readOnly,
390 HTMLTextAreaElement_get_readOnly,
391 HTMLTextAreaElement_put_rows,
392 HTMLTextAreaElement_get_rows,
393 HTMLTextAreaElement_put_cols,
394 HTMLTextAreaElement_get_cols,
395 HTMLTextAreaElement_put_wrap,
396 HTMLTextAreaElement_get_wrap,
397 HTMLTextAreaElement_createTextRange
400 void HTMLTextAreaElement_Create(HTMLElement *element)
402 HTMLTextAreaElement *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLTextAreaElement));
405 ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
406 ret->element = element;
408 nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLTextAreaElement,
409 (void**)&ret->nstextarea);
411 ERR("Could not get nsDOMHTMLInputElement: %08lx\n", nsres);
413 element->impl = (IUnknown*)HTMLTXTAREA(ret);
414 element->destructor = HTMLTextAreaElement_destructor;