push abf7776878978b0406e974646c5bcfcf789b045c
[wine/hacks.git] / dlls / mshtml / htmlimg.c
bloba2494dfb0fb96d0ee1f0125f06a6cd8bc85db01b
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 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
232 return E_NOTIMPL;
235 static HRESULT WINAPI HTMLImgElement_get_alt(IHTMLImgElement *iface, BSTR *p)
237 HTMLImgElement *This = HTMLIMG_THIS(iface);
238 FIXME("(%p)->(%p)\n", This, p);
239 return E_NOTIMPL;
242 static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
244 HTMLImgElement *This = HTMLIMG_THIS(iface);
245 nsAString src_str;
246 nsresult nsres;
248 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
250 nsAString_Init(&src_str, v);
251 nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
252 nsAString_Finish(&src_str);
253 if(NS_FAILED(nsres))
254 ERR("SetSrc failed: %08x\n", nsres);
256 return NS_OK;
259 static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
261 HTMLImgElement *This = HTMLIMG_THIS(iface);
262 FIXME("(%p)->(%p)\n", This, p);
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLImgElement_put_lowsrc(IHTMLImgElement *iface, BSTR v)
268 HTMLImgElement *This = HTMLIMG_THIS(iface);
269 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
270 return E_NOTIMPL;
273 static HRESULT WINAPI HTMLImgElement_get_lowsrc(IHTMLImgElement *iface, BSTR *p)
275 HTMLImgElement *This = HTMLIMG_THIS(iface);
276 FIXME("(%p)->(%p)\n", This, p);
277 return E_NOTIMPL;
280 static HRESULT WINAPI HTMLImgElement_put_vrml(IHTMLImgElement *iface, BSTR v)
282 HTMLImgElement *This = HTMLIMG_THIS(iface);
283 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
284 return E_NOTIMPL;
287 static HRESULT WINAPI HTMLImgElement_get_vrml(IHTMLImgElement *iface, BSTR *p)
289 HTMLImgElement *This = HTMLIMG_THIS(iface);
290 FIXME("(%p)->(%p)\n", This, p);
291 return E_NOTIMPL;
294 static HRESULT WINAPI HTMLImgElement_put_dynsrc(IHTMLImgElement *iface, BSTR v)
296 HTMLImgElement *This = HTMLIMG_THIS(iface);
297 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
298 return E_NOTIMPL;
301 static HRESULT WINAPI HTMLImgElement_get_dynsrc(IHTMLImgElement *iface, BSTR *p)
303 HTMLImgElement *This = HTMLIMG_THIS(iface);
304 FIXME("(%p)->(%p)\n", This, p);
305 return E_NOTIMPL;
308 static HRESULT WINAPI HTMLImgElement_get_readyState(IHTMLImgElement *iface, BSTR *p)
310 HTMLImgElement *This = HTMLIMG_THIS(iface);
311 FIXME("(%p)->(%p)\n", This, p);
312 return E_NOTIMPL;
315 static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIANT_BOOL *p)
317 HTMLImgElement *This = HTMLIMG_THIS(iface);
318 FIXME("(%p)->(%p)\n", This, p);
319 return E_NOTIMPL;
322 static HRESULT WINAPI HTMLImgElement_put_loop(IHTMLImgElement *iface, VARIANT v)
324 HTMLImgElement *This = HTMLIMG_THIS(iface);
325 FIXME("(%p)->()\n", This);
326 return E_NOTIMPL;
329 static HRESULT WINAPI HTMLImgElement_get_loop(IHTMLImgElement *iface, VARIANT *p)
331 HTMLImgElement *This = HTMLIMG_THIS(iface);
332 FIXME("(%p)->(%p)\n", This, p);
333 return E_NOTIMPL;
336 static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
338 HTMLImgElement *This = HTMLIMG_THIS(iface);
339 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
340 return E_NOTIMPL;
343 static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p)
345 HTMLImgElement *This = HTMLIMG_THIS(iface);
346 FIXME("(%p)->(%p)\n", This, p);
347 return E_NOTIMPL;
350 static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v)
352 HTMLImgElement *This = HTMLIMG_THIS(iface);
353 FIXME("(%p)->()\n", This);
354 return E_NOTIMPL;
357 static HRESULT WINAPI HTMLImgElement_get_onload(IHTMLImgElement *iface, VARIANT *p)
359 HTMLImgElement *This = HTMLIMG_THIS(iface);
360 FIXME("(%p)->(%p)\n", This, p);
361 return E_NOTIMPL;
364 static HRESULT WINAPI HTMLImgElement_put_onerror(IHTMLImgElement *iface, VARIANT v)
366 HTMLImgElement *This = HTMLIMG_THIS(iface);
367 FIXME("(%p)->()\n", This);
368 return E_NOTIMPL;
371 static HRESULT WINAPI HTMLImgElement_get_onerror(IHTMLImgElement *iface, VARIANT *p)
373 HTMLImgElement *This = HTMLIMG_THIS(iface);
374 FIXME("(%p)->(%p)\n", This, p);
375 return E_NOTIMPL;
378 static HRESULT WINAPI HTMLImgElement_put_onabort(IHTMLImgElement *iface, VARIANT v)
380 HTMLImgElement *This = HTMLIMG_THIS(iface);
381 FIXME("(%p)->()\n", This);
382 return E_NOTIMPL;
385 static HRESULT WINAPI HTMLImgElement_get_onabort(IHTMLImgElement *iface, VARIANT *p)
387 HTMLImgElement *This = HTMLIMG_THIS(iface);
388 FIXME("(%p)->(%p)\n", This, p);
389 return E_NOTIMPL;
392 static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
394 HTMLImgElement *This = HTMLIMG_THIS(iface);
395 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
396 return E_NOTIMPL;
399 static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
401 HTMLImgElement *This = HTMLIMG_THIS(iface);
402 FIXME("(%p)->(%p)\n", This, p);
403 return E_NOTIMPL;
406 static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, long v)
408 HTMLImgElement *This = HTMLIMG_THIS(iface);
409 FIXME("(%p)->(%ld)\n", This, v);
410 return E_NOTIMPL;
413 static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, long *p)
415 HTMLImgElement *This = HTMLIMG_THIS(iface);
416 FIXME("(%p)->(%p)\n", This, p);
417 return E_NOTIMPL;
420 static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, long v)
422 HTMLImgElement *This = HTMLIMG_THIS(iface);
423 FIXME("(%p)->(%ld)\n", This, v);
424 return E_NOTIMPL;
427 static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, long *p)
429 HTMLImgElement *This = HTMLIMG_THIS(iface);
430 FIXME("(%p)->(%p)\n", This, p);
431 return E_NOTIMPL;
434 static HRESULT WINAPI HTMLImgElement_put_start(IHTMLImgElement *iface, BSTR v)
436 HTMLImgElement *This = HTMLIMG_THIS(iface);
437 FIXME("(%p)->()\n", This);
438 return E_NOTIMPL;
441 static HRESULT WINAPI HTMLImgElement_get_start(IHTMLImgElement *iface, BSTR *p)
443 HTMLImgElement *This = HTMLIMG_THIS(iface);
444 FIXME("(%p)->(%p)\n", This, p);
445 return E_NOTIMPL;
448 #undef HTMLIMG_THIS
450 static const IHTMLImgElementVtbl HTMLImgElementVtbl = {
451 HTMLImgElement_QueryInterface,
452 HTMLImgElement_AddRef,
453 HTMLImgElement_Release,
454 HTMLImgElement_GetTypeInfoCount,
455 HTMLImgElement_GetTypeInfo,
456 HTMLImgElement_GetIDsOfNames,
457 HTMLImgElement_Invoke,
458 HTMLImgElement_put_isMap,
459 HTMLImgElement_get_isMap,
460 HTMLImgElement_put_useMap,
461 HTMLImgElement_get_useMap,
462 HTMLImgElement_get_mimeType,
463 HTMLImgElement_get_fileSize,
464 HTMLImgElement_get_fileCreatedDate,
465 HTMLImgElement_get_fileModifiedDate,
466 HTMLImgElement_get_fileUpdatedDate,
467 HTMLImgElement_get_protocol,
468 HTMLImgElement_get_href,
469 HTMLImgElement_get_nameProp,
470 HTMLImgElement_put_border,
471 HTMLImgElement_get_border,
472 HTMLImgElement_put_vspace,
473 HTMLImgElement_get_vspace,
474 HTMLImgElement_put_hspace,
475 HTMLImgElement_get_hspace,
476 HTMLImgElement_put_alt,
477 HTMLImgElement_get_alt,
478 HTMLImgElement_put_src,
479 HTMLImgElement_get_src,
480 HTMLImgElement_put_lowsrc,
481 HTMLImgElement_get_lowsrc,
482 HTMLImgElement_put_vrml,
483 HTMLImgElement_get_vrml,
484 HTMLImgElement_put_dynsrc,
485 HTMLImgElement_get_dynsrc,
486 HTMLImgElement_get_readyState,
487 HTMLImgElement_get_complete,
488 HTMLImgElement_put_loop,
489 HTMLImgElement_get_loop,
490 HTMLImgElement_put_align,
491 HTMLImgElement_get_align,
492 HTMLImgElement_put_onload,
493 HTMLImgElement_get_onload,
494 HTMLImgElement_put_onerror,
495 HTMLImgElement_get_onerror,
496 HTMLImgElement_put_onabort,
497 HTMLImgElement_get_onabort,
498 HTMLImgElement_put_name,
499 HTMLImgElement_get_name,
500 HTMLImgElement_put_width,
501 HTMLImgElement_get_width,
502 HTMLImgElement_put_height,
503 HTMLImgElement_get_height,
504 HTMLImgElement_put_start,
505 HTMLImgElement_get_start
508 #define HTMLIMG_NODE_THIS(iface) DEFINE_THIS2(HTMLImgElement, element.node, iface)
510 static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
512 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
514 *ppv = NULL;
516 if(IsEqualGUID(&IID_IHTMLImgElement, riid)) {
517 TRACE("(%p)->(IID_IHTMLImgElement %p)\n", This, ppv);
518 *ppv = HTMLIMG(This);
519 }else {
520 return HTMLElement_QI(&This->element.node, riid, ppv);
523 IUnknown_AddRef((IUnknown*)*ppv);
524 return S_OK;
527 static void HTMLImgElement_destructor(HTMLDOMNode *iface)
529 HTMLImgElement *This = HTMLIMG_NODE_THIS(iface);
531 if(This->nsimg)
532 nsIDOMHTMLImageElement_Release(This->nsimg);
534 HTMLElement_destructor(&This->element.node);
537 #undef HTMLIMG_NODE_THIS
539 static const NodeImplVtbl HTMLImgElementImplVtbl = {
540 HTMLImgElement_QI,
541 HTMLImgElement_destructor
544 static const tid_t HTMLImgElement_iface_tids[] = {
545 IHTMLDOMNode_tid,
546 IHTMLDOMNode2_tid,
547 IHTMLElement_tid,
548 IHTMLElement2_tid,
549 IHTMLImgElement_tid,
552 static dispex_static_data_t HTMLImgElement_dispex = {
553 NULL,
554 DispHTMLImg_tid,
555 NULL,
556 HTMLImgElement_iface_tids
559 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem)
561 HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement));
562 nsresult nsres;
564 ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
565 ret->element.node.vtbl = &HTMLImgElementImplVtbl;
567 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
568 if(NS_FAILED(nsres))
569 ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
571 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex);
572 HTMLElement_Init(&ret->element);
574 return &ret->element;