winhttp: A non-standard port must be included in the host header.
[wine/multimedia.git] / dlls / mshtml / htmlimg.c
blobe0c06194b9719393cda7d3cb39eb390a48ac8312
1 /*
2 * Copyright 2008 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 <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLElement element;
37 const IHTMLImgElementVtbl *lpHTMLImgElementVtbl;
39 nsIDOMHTMLImageElement *nsimg;
40 } HTMLImgElement;
42 #define HTMLIMG(x) ((IHTMLImgElement*) &(x)->lpHTMLImgElementVtbl)
44 #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface)
46 static HRESULT WINAPI HTMLImgElement_QueryInterface(IHTMLImgElement *iface, REFIID riid, void **ppv)
48 HTMLImgElement *This = HTMLIMG_THIS(iface);
50 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
53 static ULONG WINAPI HTMLImgElement_AddRef(IHTMLImgElement *iface)
55 HTMLImgElement *This = HTMLIMG_THIS(iface);
57 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
60 static ULONG WINAPI HTMLImgElement_Release(IHTMLImgElement *iface)
62 HTMLImgElement *This = HTMLIMG_THIS(iface);
64 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
67 static HRESULT WINAPI HTMLImgElement_GetTypeInfoCount(IHTMLImgElement *iface, UINT *pctinfo)
69 HTMLImgElement *This = HTMLIMG_THIS(iface);
70 FIXME("(%p)->(%p)\n", This, pctinfo);
71 return E_NOTIMPL;
74 static HRESULT WINAPI HTMLImgElement_GetTypeInfo(IHTMLImgElement *iface, UINT iTInfo,
75 LCID lcid, ITypeInfo **ppTInfo)
77 HTMLImgElement *This = HTMLIMG_THIS(iface);
78 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
79 return E_NOTIMPL;
82 static HRESULT WINAPI HTMLImgElement_GetIDsOfNames(IHTMLImgElement *iface, REFIID riid,
83 LPOLESTR *rgszNames, UINT cNames,
84 LCID lcid, DISPID *rgDispId)
86 HTMLImgElement *This = HTMLIMG_THIS(iface);
87 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
88 lcid, rgDispId);
89 return E_NOTIMPL;
92 static HRESULT WINAPI HTMLImgElement_Invoke(IHTMLImgElement *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 HTMLImgElement *This = HTMLIMG_THIS(iface);
97 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
98 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
99 return E_NOTIMPL;
102 static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v)
104 HTMLImgElement *This = HTMLIMG_THIS(iface);
105 FIXME("(%p)->(%x)\n", This, v);
106 return E_NOTIMPL;
109 static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p)
111 HTMLImgElement *This = HTMLIMG_THIS(iface);
112 FIXME("(%p)->(%p)\n", This, p);
113 return E_NOTIMPL;
116 static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v)
118 HTMLImgElement *This = HTMLIMG_THIS(iface);
119 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
120 return E_NOTIMPL;
123 static HRESULT WINAPI HTMLImgElement_get_useMap(IHTMLImgElement *iface, BSTR *p)
125 HTMLImgElement *This = HTMLIMG_THIS(iface);
126 FIXME("(%p)->(%p)\n", This, p);
127 return E_NOTIMPL;
130 static HRESULT WINAPI HTMLImgElement_get_mimeType(IHTMLImgElement *iface, BSTR *p)
132 HTMLImgElement *This = HTMLIMG_THIS(iface);
133 FIXME("(%p)->(%p)\n", This, p);
134 return E_NOTIMPL;
137 static HRESULT WINAPI HTMLImgElement_get_fileSize(IHTMLImgElement *iface, BSTR *p)
139 HTMLImgElement *This = HTMLIMG_THIS(iface);
140 FIXME("(%p)->(%p)\n", This, p);
141 return E_NOTIMPL;
144 static HRESULT WINAPI HTMLImgElement_get_fileCreatedDate(IHTMLImgElement *iface, BSTR *p)
146 HTMLImgElement *This = HTMLIMG_THIS(iface);
147 FIXME("(%p)->(%p)\n", This, p);
148 return E_NOTIMPL;
151 static HRESULT WINAPI HTMLImgElement_get_fileModifiedDate(IHTMLImgElement *iface, BSTR *p)
153 HTMLImgElement *This = HTMLIMG_THIS(iface);
154 FIXME("(%p)->(%p)\n", This, p);
155 return E_NOTIMPL;
158 static HRESULT WINAPI HTMLImgElement_get_fileUpdatedDate(IHTMLImgElement *iface, BSTR *p)
160 HTMLImgElement *This = HTMLIMG_THIS(iface);
161 FIXME("(%p)->(%p)\n", This, p);
162 return E_NOTIMPL;
165 static HRESULT WINAPI HTMLImgElement_get_protocol(IHTMLImgElement *iface, BSTR *p)
167 HTMLImgElement *This = HTMLIMG_THIS(iface);
168 FIXME("(%p)->(%p)\n", This, p);
169 return E_NOTIMPL;
172 static HRESULT WINAPI HTMLImgElement_get_href(IHTMLImgElement *iface, BSTR *p)
174 HTMLImgElement *This = HTMLIMG_THIS(iface);
175 FIXME("(%p)->(%p)\n", This, p);
176 return E_NOTIMPL;
179 static HRESULT WINAPI HTMLImgElement_get_nameProp(IHTMLImgElement *iface, BSTR *p)
181 HTMLImgElement *This = HTMLIMG_THIS(iface);
182 FIXME("(%p)->(%p)\n", This, p);
183 return E_NOTIMPL;
186 static HRESULT WINAPI HTMLImgElement_put_border(IHTMLImgElement *iface, VARIANT v)
188 HTMLImgElement *This = HTMLIMG_THIS(iface);
189 FIXME("(%p)->()\n", This);
190 return E_NOTIMPL;
193 static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT *p)
195 HTMLImgElement *This = HTMLIMG_THIS(iface);
196 FIXME("(%p)->(%p)\n", This, p);
197 return E_NOTIMPL;
200 static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, long v)
202 HTMLImgElement *This = HTMLIMG_THIS(iface);
203 FIXME("(%p)->(%ld)\n", This, v);
204 return E_NOTIMPL;
207 static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, long *p)
209 HTMLImgElement *This = HTMLIMG_THIS(iface);
210 FIXME("(%p)->(%p)\n", This, p);
211 return E_NOTIMPL;
214 static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, long v)
216 HTMLImgElement *This = HTMLIMG_THIS(iface);
217 FIXME("(%p)->(%ld)\n", This, v);
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLImgElement_get_hspace(IHTMLImgElement *iface, long *p)
223 HTMLImgElement *This = HTMLIMG_THIS(iface);
224 FIXME("(%p)->(%p)\n", This, p);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
230 HTMLImgElement *This = HTMLIMG_THIS(iface);
231 nsAString alt_str;
232 nsresult nsres;
234 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
236 nsAString_Init(&alt_str, v);
237 nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
238 nsAString_Finish(&alt_str);
239 if(NS_FAILED(nsres))
240 ERR("SetAlt failed: %08x\n", nsres);
242 return S_OK;
245 static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
247 HTMLImgElement *This = HTMLIMG_THIS(iface);
248 nsAString alt_str;
249 nsresult nsres;
251 TRACE("(%p)->(%p)\n", This, p);
253 nsAString_Init(&alt_str, NULL);
254 nsres = nsIDOMHTMLImageElement_GetAlt(This->nsimg, &alt_str);
255 if(NS_SUCCEEDED(nsres)) {
256 const PRUnichar *alt;
258 nsAString_GetData(&alt_str, &alt);
259 *p = *alt ? SysAllocString(alt) : NULL;
260 }else {
261 ERR("GetAlt failed: %08x\n", nsres);
263 nsAString_Finish(&alt_str);
265 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
268 static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
270 HTMLImgElement *This = HTMLIMG_THIS(iface);
271 nsAString src_str;
272 nsresult nsres;
274 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
276 nsAString_Init(&src_str, v);
277 nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
278 nsAString_Finish(&src_str);
279 if(NS_FAILED(nsres))
280 ERR("SetSrc failed: %08x\n", nsres);
282 return NS_OK;
285 static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
287 HTMLImgElement *This = HTMLIMG_THIS(iface);
288 FIXME("(%p)->(%p)\n", This, p);
289 return E_NOTIMPL;
292 static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
294 HTMLImgElement *This = HTMLIMG_THIS(iface);
295 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
296 return E_NOTIMPL;
299 static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
301 HTMLImgElement *This = HTMLIMG_THIS(iface);
302 FIXME("(%p)->(%p)\n", This, p);
303 return E_NOTIMPL;
306 static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
308 HTMLImgElement *This = HTMLIMG_THIS(iface);
309 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
310 return E_NOTIMPL;
313 static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
315 HTMLImgElement *This = HTMLIMG_THIS(iface);
316 FIXME("(%p)->(%p)\n", This, p);
317 return E_NOTIMPL;
320 static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
322 HTMLImgElement *This = HTMLIMG_THIS(iface);
323 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
324 return E_NOTIMPL;
327 static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
329 HTMLImgElement *This = HTMLIMG_THIS(iface);
330 FIXME("(%p)->(%p)\n", This, p);
331 return E_NOTIMPL;
334 static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
336 HTMLImgElement *This = HTMLIMG_THIS(iface);
337 FIXME("(%p)->(%p)\n", This, p);
338 return E_NOTIMPL;
341 static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
343 HTMLImgElement *This = HTMLIMG_THIS(iface);
344 FIXME("(%p)->(%p)\n", This, p);
345 return E_NOTIMPL;
348 static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
350 HTMLImgElement *This = HTMLIMG_THIS(iface);
351 FIXME("(%p)->()\n", This);
352 return E_NOTIMPL;
355 static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
357 HTMLImgElement *This = HTMLIMG_THIS(iface);
358 FIXME("(%p)->(%p)\n", This, p);
359 return E_NOTIMPL;
362 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
364 HTMLImgElement *This = HTMLIMG_THIS(iface);
365 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
366 return E_NOTIMPL;
369 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
371 HTMLImgElement *This = HTMLIMG_THIS(iface);
372 FIXME("(%p)->(%p)\n", This, p);
373 return E_NOTIMPL;
376 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
378 HTMLImgElement *This = HTMLIMG_THIS(iface);
379 FIXME("(%p)->()\n", This);
380 return E_NOTIMPL;
383 static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
385 HTMLImgElement *This = HTMLIMG_THIS(iface);
386 FIXME("(%p)->(%p)\n", This, p);
387 return E_NOTIMPL;
390 static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
392 HTMLImgElement *This = HTMLIMG_THIS(iface);
393 FIXME("(%p)->()\n", This);
394 return E_NOTIMPL;
397 static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
399 HTMLImgElement *This = HTMLIMG_THIS(iface);
400 FIXME("(%p)->(%p)\n", This, p);
401 return E_NOTIMPL;
404 static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
406 HTMLImgElement *This = HTMLIMG_THIS(iface);
407 FIXME("(%p)->()\n", This);
408 return E_NOTIMPL;
411 static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
413 HTMLImgElement *This = HTMLIMG_THIS(iface);
414 FIXME("(%p)->(%p)\n", This, p);
415 return E_NOTIMPL;
418 static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
420 HTMLImgElement *This = HTMLIMG_THIS(iface);
421 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
422 return E_NOTIMPL;
425 static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
427 HTMLImgElement *This = HTMLIMG_THIS(iface);
428 FIXME("(%p)->(%p)\n", This, p);
429 return E_NOTIMPL;
432 static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, long v)
434 HTMLImgElement *This = HTMLIMG_THIS(iface);
435 FIXME("(%p)->(%ld)\n", This, v);
436 return E_NOTIMPL;
439 static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, long *p)
441 HTMLImgElement *This = HTMLIMG_THIS(iface);
442 FIXME("(%p)->(%p)\n", This, p);
443 return E_NOTIMPL;
446 static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, long v)
448 HTMLImgElement *This = HTMLIMG_THIS(iface);
449 FIXME("(%p)->(%ld)\n", This, v);
450 return E_NOTIMPL;
453 static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, long *p)
455 HTMLImgElement *This = HTMLIMG_THIS(iface);
456 FIXME("(%p)->(%p)\n", This, p);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
462 HTMLImgElement *This = HTMLIMG_THIS(iface);
463 FIXME("(%p)->()\n", This);
464 return E_NOTIMPL;
467 static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
469 HTMLImgElement *This = HTMLIMG_THIS(iface);
470 FIXME("(%p)->(%p)\n", This, p);
471 return E_NOTIMPL;
474 #undef HTMLIMG_THIS
476 static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
477 HTMLImgElement_QueryInterface,
478 HTMLImgElement_AddRef,
479 HTMLImgElement_Release,
480 HTMLImgElement_GetTypeInfoCount,
481 HTMLImgElement_GetTypeInfo,
482 HTMLImgElement_GetIDsOfNames,
483 HTMLImgElement_Invoke,
484 HTMLImgElement_put_isMap,
485 HTMLImgElement_get_isMap,
486 HTMLImgElement_put_useMap,
487 HTMLImgElement_get_useMap,
488 HTMLImgElement_get_mimeType,
489 HTMLImgElement_get_fileSize,
490 HTMLImgElement_get_fileCreatedDate,
491 HTMLImgElement_get_fileModifiedDate,
492 HTMLImgElement_get_fileUpdatedDate,
493 HTMLImgElement_get_protocol,
494 HTMLImgElement_get_href,
495 HTMLImgElement_get_nameProp,
496 HTMLImgElement_put_border,
497 HTMLImgElement_get_border,
498 HTMLImgElement_put_vspace,
499 HTMLImgElement_get_vspace,
500 HTMLImgElement_put_hspace,
501 HTMLImgElement_get_hspace,
502 HTMLImgElement_put_alt,
503 HTMLImgElement_get_alt,
504 HTMLImgElement_put_src,
505 HTMLImgElement_get_src,
506 HTMLImgElement_put_lowsrc,
507 HTMLImgElement_get_lowsrc,
508 HTMLImgElement_put_vrml,
509 HTMLImgElement_get_vrml,
510 HTMLImgElement_put_dynsrc,
511 HTMLImgElement_get_dynsrc,
512 HTMLImgElement_get_readyState,
513 HTMLImgElement_get_complete,
514 HTMLImgElement_put_loop,
515 HTMLImgElement_get_loop,
516 HTMLImgElement_put_align,
517 HTMLImgElement_get_align,
518 HTMLImgElement_put_onload,
519 HTMLImgElement_get_onload,
520 HTMLImgElement_put_onerror,
521 HTMLImgElement_get_onerror,
522 HTMLImgElement_put_onabort,
523 HTMLImgElement_get_onabort,
524 HTMLImgElement_put_name,
525 HTMLImgElement_get_name,
526 HTMLImgElement_put_width,
527 HTMLImgElement_get_width,
528 HTMLImgElement_put_height,
529 HTMLImgElement_get_height,
530 HTMLImgElement_put_start,
531 HTMLImgElement_get_start
534 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
536 static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
538 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
540 *ppv = NULL;
542 if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
543 TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
544 *ppv = HTMLIMG(This);
545 }else {
546 return HTMLElement_QI(&This->element.node, riid, ppv);
549 IUnknown_AddRef((IUnknown*)*ppv);
550 return S_OK;
553 static void HTMLImgElement_destructor(HTMLDOMNode *iface)
555 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
557 if(This->nsimg)
558 nsIDOMHTMLImageElement_Release(This->nsimg);
560 HTMLElement_destructor(&This->element.node);
563 #undef HTMLIMG_NODE_THIS
565 static const NodeImplVtbl HTMLImgElementImplVtbl = {
566 HTMLImgElement_QI,
567 HTMLImgElement_destructor
570 static const tid_t HTMLImgElement_iface_tids[] = {
571 IHTMLDOMNode_tid,
572 IHTMLDOMNode2_tid,
573 IHTMLElement_tid,
574 IHTMLElement2_tid,
575 IHTMLImgElement_tid,
578 static dispex_static_data_t HTMLImgElement_dispex = {
579 NULL,
580 DispHTMLImg_tid,
581 NULL,
582 HTMLImgElement_iface_tids
585 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
587 HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
588 nsresult nsres;
590 ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
591 ret->element.node.vtbl = &HTMLImgElementImplVtbl;
593 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
594 if(NS_FAILED(nsres))
595 ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
597 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
598 HTMLElement_Init(&ret->element);
600 return &ret->element;