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 FIXME("(%p)->(%p)\n", This
, pctinfo
);
75 static HRESULT WINAPI
HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement
*iface
, UINT iTInfo
,
76 LCID lcid
, ITypeInfo
**ppTInfo
)
78 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
79 FIXME("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
83 static HRESULT WINAPI
HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement
*iface
, REFIID riid
,
84 LPOLESTR
*rgszNames
, UINT cNames
,
85 LCID lcid
, DISPID
*rgDispId
)
87 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
88 FIXME("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
93 static HRESULT WINAPI
HTMLTextAreaElement_Invoke(IHTMLTextAreaElement
*iface
, DISPID dispIdMember
,
94 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
95 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
97 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
98 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
99 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
103 static HRESULT WINAPI
HTMLTextAreaElement_get_type(IHTMLTextAreaElement
*iface
, BSTR
*p
)
105 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
106 FIXME("(%p)->(%p)\n", This
, p
);
110 static HRESULT WINAPI
HTMLTextAreaElement_put_value(IHTMLTextAreaElement
*iface
, BSTR v
)
112 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
113 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
117 static HRESULT WINAPI
HTMLTextAreaElement_get_value(IHTMLTextAreaElement
*iface
, BSTR
*p
)
119 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
121 const PRUnichar
*value
;
124 TRACE("(%p)->(%p)\n", This
, p
);
126 nsAString_Init(&value_str
, NULL
);
128 nsres
= nsIDOMHTMLTextAreaElement_GetValue(This
->nstextarea
, &value_str
);
129 if(NS_SUCCEEDED(nsres
)) {
130 nsAString_GetData(&value_str
, &value
);
131 *p
= SysAllocString(value
);
133 ERR("GetValue failed: %08x\n", nsres
);
136 nsAString_Finish(&value_str
);
138 TRACE("%s\n", debugstr_w(*p
));
142 static HRESULT WINAPI
HTMLTextAreaElement_put_name(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_name(IHTMLTextAreaElement
*iface
, BSTR
*p
)
151 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
153 const PRUnichar
*name
;
156 TRACE("(%p)->(%p)\n", This
, p
);
158 nsAString_Init(&name_str
, NULL
);
160 nsres
= nsIDOMHTMLTextAreaElement_GetName(This
->nstextarea
, &name_str
);
161 if(NS_SUCCEEDED(nsres
)) {
162 nsAString_GetData(&name_str
, &name
);
163 *p
= SysAllocString(name
);
165 ERR("GetName failed: %08x\n", nsres
);
168 nsAString_Finish(&name_str
);
170 TRACE("%s\n", debugstr_w(*p
));
174 static HRESULT WINAPI
HTMLTextAreaElement_put_status(IHTMLTextAreaElement
*iface
, VARIANT v
)
176 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
177 FIXME("(%p)->()\n", This
);
181 static HRESULT WINAPI
HTMLTextAreaElement_get_status(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
183 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
184 FIXME("(%p)->(%p)\n", This
, p
);
188 static HRESULT WINAPI
HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement
*iface
, VARIANT_BOOL v
)
190 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
191 FIXME("(%p)->(%x)\n", This
, v
);
195 static HRESULT WINAPI
HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement
*iface
, VARIANT_BOOL
*p
)
197 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
198 FIXME("(%p)->(%p)\n", This
, p
);
202 static HRESULT WINAPI
HTMLTextAreaElement_get_form(IHTMLTextAreaElement
*iface
, IHTMLFormElement
**p
)
204 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
205 FIXME("(%p)->(%p)\n", This
, p
);
209 static HRESULT WINAPI
HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement
*iface
, BSTR v
)
211 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
212 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
216 static HRESULT WINAPI
HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement
*iface
, BSTR
*p
)
218 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
219 FIXME("(%p)->(%p)\n", This
, p
);
223 static HRESULT WINAPI
HTMLTextAreaElement_select(IHTMLTextAreaElement
*iface
)
225 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
226 FIXME("(%p)\n", This
);
230 static HRESULT WINAPI
HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement
*iface
, VARIANT v
)
232 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
233 FIXME("(%p)->()\n", This
);
237 static HRESULT WINAPI
HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
239 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
240 FIXME("(%p)->(%p)\n", This
, p
);
244 static HRESULT WINAPI
HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement
*iface
, VARIANT v
)
246 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
247 FIXME("(%p)->()\n", This
);
251 static HRESULT WINAPI
HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement
*iface
, VARIANT
*p
)
253 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
254 FIXME("(%p)->(%p)\n", This
, p
);
258 static HRESULT WINAPI
HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement
*iface
, VARIANT_BOOL v
)
260 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
261 FIXME("(%p)->(%x)\n", This
, v
);
265 static HRESULT WINAPI
HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement
*iface
, VARIANT_BOOL
*p
)
267 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
268 FIXME("(%p)->(%p)\n", This
, p
);
272 static HRESULT WINAPI
HTMLTextAreaElement_put_rows(IHTMLTextAreaElement
*iface
, long v
)
274 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
275 FIXME("(%p)->(%ld)\n", This
, v
);
279 static HRESULT WINAPI
HTMLTextAreaElement_get_rows(IHTMLTextAreaElement
*iface
, long *p
)
281 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
282 FIXME("(%p)->(%p)\n", This
, p
);
286 static HRESULT WINAPI
HTMLTextAreaElement_put_cols(IHTMLTextAreaElement
*iface
, long v
)
288 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
289 FIXME("(%p)->(%ld)\n", This
, v
);
293 static HRESULT WINAPI
HTMLTextAreaElement_get_cols(IHTMLTextAreaElement
*iface
, long *p
)
295 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
296 FIXME("(%p)->(%p)\n", This
, p
);
300 static HRESULT WINAPI
HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement
*iface
, BSTR v
)
302 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
303 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
307 static HRESULT WINAPI
HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement
*iface
, BSTR
*p
)
309 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
310 FIXME("(%p)->(%p)\n", This
, p
);
314 static HRESULT WINAPI
HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement
*iface
,
315 IHTMLTxtRange
**range
)
317 HTMLTextAreaElement
*This
= HTMLTXTAREA_THIS(iface
);
318 FIXME("(%p)->(%p)\n", This
, range
);
322 #undef HTMLTXTAREA_THIS
324 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl
= {
325 HTMLTextAreaElement_QueryInterface
,
326 HTMLTextAreaElement_AddRef
,
327 HTMLTextAreaElement_Release
,
328 HTMLTextAreaElement_GetTypeInfoCount
,
329 HTMLTextAreaElement_GetTypeInfo
,
330 HTMLTextAreaElement_GetIDsOfNames
,
331 HTMLTextAreaElement_Invoke
,
332 HTMLTextAreaElement_get_type
,
333 HTMLTextAreaElement_put_value
,
334 HTMLTextAreaElement_get_value
,
335 HTMLTextAreaElement_put_name
,
336 HTMLTextAreaElement_get_name
,
337 HTMLTextAreaElement_put_status
,
338 HTMLTextAreaElement_get_status
,
339 HTMLTextAreaElement_put_disabled
,
340 HTMLTextAreaElement_get_disabled
,
341 HTMLTextAreaElement_get_form
,
342 HTMLTextAreaElement_put_defaultValue
,
343 HTMLTextAreaElement_get_defaultValue
,
344 HTMLTextAreaElement_select
,
345 HTMLTextAreaElement_put_onchange
,
346 HTMLTextAreaElement_get_onchange
,
347 HTMLTextAreaElement_put_onselect
,
348 HTMLTextAreaElement_get_onselect
,
349 HTMLTextAreaElement_put_readOnly
,
350 HTMLTextAreaElement_get_readOnly
,
351 HTMLTextAreaElement_put_rows
,
352 HTMLTextAreaElement_get_rows
,
353 HTMLTextAreaElement_put_cols
,
354 HTMLTextAreaElement_get_cols
,
355 HTMLTextAreaElement_put_wrap
,
356 HTMLTextAreaElement_get_wrap
,
357 HTMLTextAreaElement_createTextRange
360 #define HTMLTXTAREA_NODE_THIS(iface) DEFINE_THIS2(HTMLTextAreaElement, element.node, iface)
362 static HRESULT
HTMLTextAreaElement_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
364 HTMLTextAreaElement
*This
= HTMLTXTAREA_NODE_THIS(iface
);
368 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
369 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
370 *ppv
= HTMLTXTAREA(This
);
371 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
372 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
373 *ppv
= HTMLTXTAREA(This
);
374 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement
, riid
)) {
375 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This
, ppv
);
376 *ppv
= HTMLTXTAREA(This
);
380 IUnknown_AddRef((IUnknown
*)*ppv
);
384 return HTMLElement_QI(&This
->element
.node
, riid
, ppv
);
387 static void HTMLTextAreaElement_destructor(HTMLDOMNode
*iface
)
389 HTMLTextAreaElement
*This
= HTMLTXTAREA_NODE_THIS(iface
);
391 nsIDOMHTMLTextAreaElement_Release(This
->nstextarea
);
393 HTMLElement_destructor(&This
->element
.node
);
396 #undef HTMLTXTAREA_NODE_THIS
398 static const NodeImplVtbl HTMLTextAreaElementImplVtbl
= {
399 HTMLTextAreaElement_QI
,
400 HTMLTextAreaElement_destructor
403 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*nselem
)
405 HTMLTextAreaElement
*ret
= heap_alloc(sizeof(HTMLTextAreaElement
));
408 HTMLElement_Init(&ret
->element
);
410 ret
->lpHTMLTextAreaElementVtbl
= &HTMLTextAreaElementVtbl
;
411 ret
->element
.node
.vtbl
= &HTMLTextAreaElementImplVtbl
;
413 nsres
= nsIDOMHTMLElement_QueryInterface(nselem
, &IID_nsIDOMHTMLTextAreaElement
,
414 (void**)&ret
->nstextarea
);
416 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres
);
418 return &ret
->element
;