wined3d: Remove some unneeded context cache members from the device.
[wine/multimedia.git] / dlls / mshtml / htmltextarea.c
blob16e9ddfffedc833aa68eb05955d543ff91601f0e
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 "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 typedef struct {
39 const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
41 HTMLElement *element;
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);
53 HRESULT hres;
55 *ppv = NULL;
57 if(IsEqualGUID(&IID_IUnknown, riid)) {
58 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
59 *ppv = HTMLTXTAREA(This);
60 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
61 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
62 *ppv = HTMLTXTAREA(This);
63 }else if(IsEqualGUID(&IID_IHTMLTextAreaElement, riid)) {
64 TRACE("(%p)->(IID_IHTMLTextAreaElement %p)\n", This, ppv);
65 *ppv = HTMLTXTAREA(This);
68 if(*ppv) {
69 IUnknown_AddRef((IUnknown*)*ppv);
70 return S_OK;
73 hres = HTMLElement_QI(This->element, riid, ppv);
74 if(FAILED(hres))
75 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
77 return hres;
80 static ULONG WINAPI HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
82 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
84 TRACE("(%p)\n", This);
86 return IHTMLDocument2_AddRef(HTMLDOC(This->element->node->doc));
89 static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
91 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
93 TRACE("(%p)\n", This);
95 return IHTMLDocument2_Release(HTMLDOC(This->element->node->doc));
98 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
100 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, pctinfo);
102 return E_NOTIMPL;
105 static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfo(IHTMLTextAreaElement *iface, UINT iTInfo,
106 LCID lcid, ITypeInfo **ppTInfo)
108 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
109 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
110 return E_NOTIMPL;
113 static HRESULT WINAPI HTMLTextAreaElement_GetIDsOfNames(IHTMLTextAreaElement *iface, REFIID riid,
114 LPOLESTR *rgszNames, UINT cNames,
115 LCID lcid, DISPID *rgDispId)
117 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
118 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
119 lcid, rgDispId);
120 return E_NOTIMPL;
123 static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DISPID dispIdMember,
124 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
125 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
127 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
128 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
129 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
135 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
136 FIXME("(%p)->(%p)\n", This, p);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface, BSTR v)
142 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
143 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLTextAreaElement_get_value(IHTMLTextAreaElement *iface, BSTR *p)
149 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
150 nsAString value_str;
151 const PRUnichar *value;
152 nsresult nsres;
154 TRACE("(%p)->(%p)\n", This, p);
156 nsAString_Init(&value_str, NULL);
158 nsres = nsIDOMHTMLTextAreaElement_GetValue(This->nstextarea, &value_str);
159 if(NS_SUCCEEDED(nsres)) {
160 nsAString_GetData(&value_str, &value, NULL);
161 *p = SysAllocString(value);
162 }else {
163 ERR("GetValue failed: %08x\n", nsres);
166 nsAString_Finish(&value_str);
168 TRACE("%s\n", debugstr_w(*p));
169 return S_OK;
172 static HRESULT WINAPI HTMLTextAreaElement_put_name(IHTMLTextAreaElement *iface, BSTR v)
174 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
175 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
176 return E_NOTIMPL;
179 static HRESULT WINAPI HTMLTextAreaElement_get_name(IHTMLTextAreaElement *iface, BSTR *p)
181 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
182 nsAString name_str;
183 const PRUnichar *name;
184 nsresult nsres;
186 TRACE("(%p)->(%p)\n", This, p);
188 nsAString_Init(&name_str, NULL);
190 nsres = nsIDOMHTMLTextAreaElement_GetName(This->nstextarea, &name_str);
191 if(NS_SUCCEEDED(nsres)) {
192 nsAString_GetData(&name_str, &name, NULL);
193 *p = SysAllocString(name);
194 }else {
195 ERR("GetName failed: %08x\n", nsres);
198 nsAString_Finish(&name_str);
200 TRACE("%s\n", debugstr_w(*p));
201 return S_OK;
204 static HRESULT WINAPI HTMLTextAreaElement_put_status(IHTMLTextAreaElement *iface, VARIANT v)
206 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
207 FIXME("(%p)->()\n", This);
208 return E_NOTIMPL;
211 static HRESULT WINAPI HTMLTextAreaElement_get_status(IHTMLTextAreaElement *iface, VARIANT *p)
213 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
214 FIXME("(%p)->(%p)\n", This, p);
215 return E_NOTIMPL;
218 static HRESULT WINAPI HTMLTextAreaElement_put_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
220 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
221 FIXME("(%p)->(%x)\n", This, v);
222 return E_NOTIMPL;
225 static HRESULT WINAPI HTMLTextAreaElement_get_disabled(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
227 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
228 FIXME("(%p)->(%p)\n", This, p);
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p)
234 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
235 FIXME("(%p)->(%p)\n", This, p);
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
241 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
242 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
243 return E_NOTIMPL;
246 static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
248 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
249 FIXME("(%p)->(%p)\n", This, p);
250 return E_NOTIMPL;
253 static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)
255 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
256 FIXME("(%p)\n", This);
257 return E_NOTIMPL;
260 static HRESULT WINAPI HTMLTextAreaElement_put_onchange(IHTMLTextAreaElement *iface, VARIANT v)
262 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
263 FIXME("(%p)->()\n", This);
264 return E_NOTIMPL;
267 static HRESULT WINAPI HTMLTextAreaElement_get_onchange(IHTMLTextAreaElement *iface, VARIANT *p)
269 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
270 FIXME("(%p)->(%p)\n", This, p);
271 return E_NOTIMPL;
274 static HRESULT WINAPI HTMLTextAreaElement_put_onselect(IHTMLTextAreaElement *iface, VARIANT v)
276 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
277 FIXME("(%p)->()\n", This);
278 return E_NOTIMPL;
281 static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *iface, VARIANT *p)
283 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
284 FIXME("(%p)->(%p)\n", This, p);
285 return E_NOTIMPL;
288 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
290 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
291 FIXME("(%p)->(%x)\n", This, v);
292 return E_NOTIMPL;
295 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
297 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
298 FIXME("(%p)->(%p)\n", This, p);
299 return E_NOTIMPL;
302 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, long v)
304 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
305 FIXME("(%p)->(%ld)\n", This, v);
306 return E_NOTIMPL;
309 static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface, long *p)
311 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
312 FIXME("(%p)->(%p)\n", This, p);
313 return E_NOTIMPL;
316 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, long v)
318 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
319 FIXME("(%p)->(%ld)\n", This, v);
320 return E_NOTIMPL;
323 static HRESULT WINAPI HTMLTextAreaElement_get_cols(IHTMLTextAreaElement *iface, long *p)
325 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
326 FIXME("(%p)->(%p)\n", This, p);
327 return E_NOTIMPL;
330 static HRESULT WINAPI HTMLTextAreaElement_put_wrap(IHTMLTextAreaElement *iface, BSTR v)
332 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
333 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
334 return E_NOTIMPL;
337 static HRESULT WINAPI HTMLTextAreaElement_get_wrap(IHTMLTextAreaElement *iface, BSTR *p)
339 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
340 FIXME("(%p)->(%p)\n", This, p);
341 return E_NOTIMPL;
344 static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *iface,
345 IHTMLTxtRange **range)
347 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
348 FIXME("(%p)->(%p)\n", This, range);
349 return E_NOTIMPL;
352 static void HTMLTextAreaElement_destructor(IUnknown *iface)
354 HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
356 nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
357 mshtml_free(This);
360 #undef HTMLTXTAREA_THIS
362 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
363 HTMLTextAreaElement_QueryInterface,
364 HTMLTextAreaElement_AddRef,
365 HTMLTextAreaElement_Release,
366 HTMLTextAreaElement_GetTypeInfoCount,
367 HTMLTextAreaElement_GetTypeInfo,
368 HTMLTextAreaElement_GetIDsOfNames,
369 HTMLTextAreaElement_Invoke,
370 HTMLTextAreaElement_get_type,
371 HTMLTextAreaElement_put_value,
372 HTMLTextAreaElement_get_value,
373 HTMLTextAreaElement_put_name,
374 HTMLTextAreaElement_get_name,
375 HTMLTextAreaElement_put_status,
376 HTMLTextAreaElement_get_status,
377 HTMLTextAreaElement_put_disabled,
378 HTMLTextAreaElement_get_disabled,
379 HTMLTextAreaElement_get_form,
380 HTMLTextAreaElement_put_defaultValue,
381 HTMLTextAreaElement_get_defaultValue,
382 HTMLTextAreaElement_select,
383 HTMLTextAreaElement_put_onchange,
384 HTMLTextAreaElement_get_onchange,
385 HTMLTextAreaElement_put_onselect,
386 HTMLTextAreaElement_get_onselect,
387 HTMLTextAreaElement_put_readOnly,
388 HTMLTextAreaElement_get_readOnly,
389 HTMLTextAreaElement_put_rows,
390 HTMLTextAreaElement_get_rows,
391 HTMLTextAreaElement_put_cols,
392 HTMLTextAreaElement_get_cols,
393 HTMLTextAreaElement_put_wrap,
394 HTMLTextAreaElement_get_wrap,
395 HTMLTextAreaElement_createTextRange
398 void HTMLTextAreaElement_Create(HTMLElement *element)
400 HTMLTextAreaElement *ret = mshtml_alloc(sizeof(HTMLTextAreaElement));
401 nsresult nsres;
403 ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
404 ret->element = element;
406 nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLTextAreaElement,
407 (void**)&ret->nstextarea);
408 if(NS_FAILED(nsres))
409 ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
411 element->impl = (IUnknown*)HTMLTXTAREA(ret);
412 element->destructor = HTMLTextAreaElement_destructor;