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"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 static struct list window_list = LIST_INIT(window_list);
38 #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
40 static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
42 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
46 if(IsEqualGUID(&IID_IUnknown, riid)) {
47 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
48 *ppv = HTMLWINDOW2(This);
49 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
50 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
51 *ppv = HTMLWINDOW2(This);
52 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
53 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
54 *ppv = DISPATCHEX(This);
55 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2, riid)) {
56 TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This, ppv);
57 *ppv = HTMLWINDOW2(This);
58 }else if(IsEqualGUID(&IID_IHTMLWindow2, riid)) {
59 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv);
60 *ppv = HTMLWINDOW2(This);
61 }else if(IsEqualGUID(&IID_IHTMLWindow3, riid)) {
62 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv);
63 *ppv = HTMLWINDOW3(This);
64 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
65 return *ppv ? S_OK : E_NOINTERFACE;
69 IUnknown_AddRef((IUnknown*)*ppv);
73 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
77 static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface)
79 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
80 LONG ref = InterlockedIncrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, ref);
87 static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
89 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
90 LONG ref = InterlockedDecrement(&This->ref);
92 TRACE("(%p) ref=%d\n", This, ref);
95 list_remove(&This->entry);
102 static HRESULT WINAPI HTMLWindow2_GetTypeInfoCount(IHTMLWindow2 *iface, UINT *pctinfo)
104 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
106 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
109 static HRESULT WINAPI HTMLWindow2_GetTypeInfo(IHTMLWindow2 *iface, UINT iTInfo,
110 LCID lcid, ITypeInfo **ppTInfo)
112 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
114 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
117 static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid,
118 LPOLESTR *rgszNames, UINT cNames,
119 LCID lcid, DISPID *rgDispId)
121 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
123 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
126 static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMember,
127 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
128 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
130 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
132 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
133 pVarResult, pExcepInfo, puArgErr);
136 static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
138 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
139 FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
143 static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, long *p)
145 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
146 FIXME("(%p)->(%p)\n", This, p);
150 static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
152 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
153 FIXME("(%p)->(%p)\n", This, p);
157 static HRESULT WINAPI HTMLWindow2_put_defaultStatus(IHTMLWindow2 *iface, BSTR v)
159 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
160 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
164 static HRESULT WINAPI HTMLWindow2_get_defaultStatus(IHTMLWindow2 *iface, BSTR *p)
166 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
167 FIXME("(%p)->(%p)\n", This, p);
171 static HRESULT WINAPI HTMLWindow2_put_status(IHTMLWindow2 *iface, BSTR v)
173 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
174 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
178 static HRESULT WINAPI HTMLWindow2_get_status(IHTMLWindow2 *iface, BSTR *p)
180 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
181 FIXME("(%p)->(%p)\n", This, p);
185 static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expression,
186 long msec, VARIANT *language, long *timerID)
188 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
191 TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
193 V_VT(&expr_var) = VT_BSTR;
194 V_BSTR(&expr_var) = expression;
196 return IHTMLWindow3_setTimeout(HTMLWINDOW3(This), &expr_var, msec, language, timerID);
199 static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, long timerID)
201 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
203 TRACE("(%p)->(%ld)\n", This, timerID);
205 return clear_task_timer(This->doc, FALSE, timerID);
208 static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
210 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
213 TRACE("(%p)->(%s)\n", This, debugstr_w(message));
215 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
216 sizeof(wszTitle)/sizeof(WCHAR))) {
217 WARN("Could not load message box title: %d\n", GetLastError());
221 MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING);
225 static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
226 VARIANT_BOOL *confirmed)
228 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
229 FIXME("(%p)->(%s %p)\n", This, debugstr_w(message), confirmed);
233 static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
234 BSTR dststr, VARIANT *textdata)
236 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
237 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata);
241 static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p)
243 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
244 FIXME("(%p)->(%p)\n", This, p);
248 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
250 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
252 TRACE("(%p)->(%p)\n", This, p);
255 FIXME("This->doc is NULL\n");
259 return IHTMLDocument2_get_location(HTMLDOC(This->doc), p);
262 static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p)
264 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
265 FIXME("(%p)->(%p)\n", This, p);
269 static HRESULT WINAPI HTMLWindow2_close(IHTMLWindow2 *iface)
271 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
272 FIXME("(%p)->()\n", This);
276 static HRESULT WINAPI HTMLWindow2_put_opener(IHTMLWindow2 *iface, VARIANT v)
278 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
279 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
283 static HRESULT WINAPI HTMLWindow2_get_opener(IHTMLWindow2 *iface, VARIANT *p)
285 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
286 FIXME("(%p)->(%p)\n", This, p);
290 static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigator **p)
292 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
294 TRACE("(%p)->(%p)\n", This, p);
296 *p = OmNavigator_Create();
300 static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
302 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
303 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
307 static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
309 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
310 FIXME("(%p)->(%p)\n", This, p);
314 static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
316 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
317 FIXME("(%p)->(%p)\n", This, p);
321 static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
322 BSTR features, VARIANT_BOOL replace, IHTMLWindow2 **pomWindowResult)
324 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
325 FIXME("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
326 debugstr_w(features), replace, pomWindowResult);
330 static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p)
332 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
334 TRACE("(%p)->(%p)\n", This, p);
336 /* FIXME: We should return kind of proxy window here. */
337 IHTMLWindow2_AddRef(HTMLWINDOW2(This));
338 *p = HTMLWINDOW2(This);
342 static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p)
344 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
345 FIXME("(%p)->(%p)\n", This, p);
349 static HRESULT WINAPI HTMLWindow2_get_window(IHTMLWindow2 *iface, IHTMLWindow2 **p)
351 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
353 TRACE("(%p)->(%p)\n", This, p);
355 /* FIXME: We should return kind of proxy window here. */
356 IHTMLWindow2_AddRef(HTMLWINDOW2(This));
357 *p = HTMLWINDOW2(This);
361 static HRESULT WINAPI HTMLWindow2_navigate(IHTMLWindow2 *iface, BSTR url)
363 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
364 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
368 static HRESULT WINAPI HTMLWindow2_put_onfocus(IHTMLWindow2 *iface, VARIANT v)
370 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
371 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
375 static HRESULT WINAPI HTMLWindow2_get_onfocus(IHTMLWindow2 *iface, VARIANT *p)
377 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
378 FIXME("(%p)->(%p)\n", This, p);
382 static HRESULT WINAPI HTMLWindow2_put_onblur(IHTMLWindow2 *iface, VARIANT v)
384 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
385 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
389 static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p)
391 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
392 FIXME("(%p)->(%p)\n", This, p);
396 static HRESULT WINAPI HTMLWindow2_put_onload(IHTMLWindow2 *iface, VARIANT v)
398 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
399 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
403 static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
405 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
406 FIXME("(%p)->(%p)\n", This, p);
410 static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
412 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
413 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
417 static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
419 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
420 FIXME("(%p)->(%p)\n", This, p);
424 static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)
426 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
427 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
431 static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
433 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
434 FIXME("(%p)->(%p)\n", This, p);
438 static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v)
440 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
441 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
445 static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p)
447 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
448 FIXME("(%p)->(%p)\n", This, p);
452 static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v)
454 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
455 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
459 static HRESULT WINAPI HTMLWindow2_get_onerror(IHTMLWindow2 *iface, VARIANT *p)
461 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
462 FIXME("(%p)->(%p)\n", This, p);
466 static HRESULT WINAPI HTMLWindow2_put_onresize(IHTMLWindow2 *iface, VARIANT v)
468 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
469 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
473 static HRESULT WINAPI HTMLWindow2_get_onresize(IHTMLWindow2 *iface, VARIANT *p)
475 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
476 FIXME("(%p)->(%p)\n", This, p);
480 static HRESULT WINAPI HTMLWindow2_put_onscroll(IHTMLWindow2 *iface, VARIANT v)
482 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
483 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
487 static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p)
489 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
490 FIXME("(%p)->(%p)\n", This, p);
494 static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p)
496 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
498 TRACE("(%p)->(%p)\n", This, p);
501 /* FIXME: We should return a wrapper object here */
502 *p = HTMLDOC(This->doc);
503 IHTMLDocument2_AddRef(*p);
511 static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p)
513 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
515 TRACE("(%p)->(%p)\n", This, p);
518 IHTMLEventObj_AddRef(This->event);
523 static HRESULT WINAPI HTMLWindow2_get__newEnum(IHTMLWindow2 *iface, IUnknown **p)
525 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
526 FIXME("(%p)->(%p)\n", This, p);
530 static HRESULT WINAPI HTMLWindow2_showModalDialog(IHTMLWindow2 *iface, BSTR dialog,
531 VARIANT *varArgIn, VARIANT *varOptions, VARIANT *varArgOut)
533 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
534 FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(dialog), varArgIn, varOptions, varArgOut);
538 static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VARIANT helpArg,
541 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
542 FIXME("(%p)->(%s v(%d) %s)\n", This, debugstr_w(helpURL), V_VT(&helpArg), debugstr_w(features));
546 static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p)
548 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
549 FIXME("(%p)->(%p)\n", This, p);
553 static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p)
555 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
557 TRACE("(%p)->(%p)\n", This, p);
559 if(!This->doc->option_factory)
560 This->doc->option_factory = HTMLOptionElementFactory_Create(This->doc);
562 *p = HTMLOPTFACTORY(This->doc->option_factory);
563 IHTMLOptionElementFactory_AddRef(*p);
568 static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface)
570 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
571 FIXME("(%p)->()\n", This);
575 static HRESULT WINAPI HTMLWindow2_get_closed(IHTMLWindow2 *iface, VARIANT_BOOL *p)
577 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
578 FIXME("(%p)->(%p)\n", This, p);
582 static HRESULT WINAPI HTMLWindow2_blur(IHTMLWindow2 *iface)
584 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
585 FIXME("(%p)->()\n", This);
589 static HRESULT WINAPI HTMLWindow2_scroll(IHTMLWindow2 *iface, long x, long y)
591 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
592 FIXME("(%p)->(%ld %ld)\n", This, x, y);
596 static HRESULT WINAPI HTMLWindow2_get_clientInformation(IHTMLWindow2 *iface, IOmNavigator **p)
598 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
599 FIXME("(%p)->(%p)\n", This, p);
603 static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expression,
604 long msec, VARIANT *language, long *timerID)
606 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
609 TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
611 V_VT(&expr) = VT_BSTR;
612 V_BSTR(&expr) = expression;
613 return IHTMLWindow3_setInterval(HTMLWINDOW3(This), &expr, msec, language, timerID);
616 static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, long timerID)
618 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
620 TRACE("(%p)->(%ld)\n", This, timerID);
622 return clear_task_timer(This->doc, TRUE, timerID);
625 static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
627 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
628 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
632 static HRESULT WINAPI HTMLWindow2_get_offscreenBuffering(IHTMLWindow2 *iface, VARIANT *p)
634 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
635 FIXME("(%p)->(%p)\n", This, p);
639 static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BSTR language,
642 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
643 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
647 static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
649 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
650 FIXME("(%p)->(%p)\n", This, String);
654 static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, long x, long y)
656 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
659 TRACE("(%p)->(%ld %ld)\n", This, x, y);
661 nsres = nsIDOMWindow_ScrollBy(This->nswindow, x, y);
663 ERR("ScrollBy failed: %08x\n", nsres);
668 static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, long x, long y)
670 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
673 TRACE("(%p)->(%ld %ld)\n", This, x, y);
675 nsres = nsIDOMWindow_ScrollTo(This->nswindow, x, y);
677 ERR("ScrollTo failed: %08x\n", nsres);
682 static HRESULT WINAPI HTMLWindow2_moveTo(IHTMLWindow2 *iface, long x, long y)
684 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
685 FIXME("(%p)->(%ld %ld)\n", This, x, y);
689 static HRESULT WINAPI HTMLWindow2_moveBy(IHTMLWindow2 *iface, long x, long y)
691 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
692 FIXME("(%p)->(%ld %ld)\n", This, x, y);
696 static HRESULT WINAPI HTMLWindow2_resizeTo(IHTMLWindow2 *iface, long x, long y)
698 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
699 FIXME("(%p)->(%ld %ld)\n", This, x, y);
703 static HRESULT WINAPI HTMLWindow2_resizeBy(IHTMLWindow2 *iface, long x, long y)
705 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
706 FIXME("(%p)->(%ld %ld)\n", This, x, y);
710 static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **p)
712 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
714 TRACE("(%p)->(%p)\n", This, p);
718 if(!This->doc->hostui)
721 return IDocHostUIHandler_GetExternal(This->doc->hostui, p);
724 #undef HTMLWINDOW2_THIS
726 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = {
727 HTMLWindow2_QueryInterface,
730 HTMLWindow2_GetTypeInfoCount,
731 HTMLWindow2_GetTypeInfo,
732 HTMLWindow2_GetIDsOfNames,
735 HTMLWindow2_get_length,
736 HTMLWindow2_get_frames,
737 HTMLWindow2_put_defaultStatus,
738 HTMLWindow2_get_defaultStatus,
739 HTMLWindow2_put_status,
740 HTMLWindow2_get_status,
741 HTMLWindow2_setTimeout,
742 HTMLWindow2_clearTimeout,
746 HTMLWindow2_get_Image,
747 HTMLWindow2_get_location,
748 HTMLWindow2_get_history,
750 HTMLWindow2_put_opener,
751 HTMLWindow2_get_opener,
752 HTMLWindow2_get_navigator,
753 HTMLWindow2_put_name,
754 HTMLWindow2_get_name,
755 HTMLWindow2_get_parent,
757 HTMLWindow2_get_self,
759 HTMLWindow2_get_window,
760 HTMLWindow2_navigate,
761 HTMLWindow2_put_onfocus,
762 HTMLWindow2_get_onfocus,
763 HTMLWindow2_put_onblur,
764 HTMLWindow2_get_onblur,
765 HTMLWindow2_put_onload,
766 HTMLWindow2_get_onload,
767 HTMLWindow2_put_onbeforeunload,
768 HTMLWindow2_get_onbeforeunload,
769 HTMLWindow2_put_onunload,
770 HTMLWindow2_get_onunload,
771 HTMLWindow2_put_onhelp,
772 HTMLWindow2_get_onhelp,
773 HTMLWindow2_put_onerror,
774 HTMLWindow2_get_onerror,
775 HTMLWindow2_put_onresize,
776 HTMLWindow2_get_onresize,
777 HTMLWindow2_put_onscroll,
778 HTMLWindow2_get_onscroll,
779 HTMLWindow2_get_document,
780 HTMLWindow2_get_event,
781 HTMLWindow2_get__newEnum,
782 HTMLWindow2_showModalDialog,
783 HTMLWindow2_showHelp,
784 HTMLWindow2_get_screen,
785 HTMLWindow2_get_Option,
787 HTMLWindow2_get_closed,
790 HTMLWindow2_get_clientInformation,
791 HTMLWindow2_setInterval,
792 HTMLWindow2_clearInterval,
793 HTMLWindow2_put_offscreenBuffering,
794 HTMLWindow2_get_offscreenBuffering,
795 HTMLWindow2_execScript,
796 HTMLWindow2_toString,
797 HTMLWindow2_scrollBy,
798 HTMLWindow2_scrollTo,
801 HTMLWindow2_resizeTo,
802 HTMLWindow2_resizeBy,
803 HTMLWindow2_get_external
806 #define HTMLWINDOW3_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow3, iface)
808 static HRESULT WINAPI HTMLWindow3_QueryInterface(IHTMLWindow3 *iface, REFIID riid, void **ppv)
810 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
812 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv);
815 static ULONG WINAPI HTMLWindow3_AddRef(IHTMLWindow3 *iface)
817 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
819 return IHTMLWindow2_AddRef(HTMLWINDOW2(This));
822 static ULONG WINAPI HTMLWindow3_Release(IHTMLWindow3 *iface)
824 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
826 return IHTMLWindow2_Release(HTMLWINDOW2(This));
829 static HRESULT WINAPI HTMLWindow3_GetTypeInfoCount(IHTMLWindow3 *iface, UINT *pctinfo)
831 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
833 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
836 static HRESULT WINAPI HTMLWindow3_GetTypeInfo(IHTMLWindow3 *iface, UINT iTInfo,
837 LCID lcid, ITypeInfo **ppTInfo)
839 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
841 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
844 static HRESULT WINAPI HTMLWindow3_GetIDsOfNames(IHTMLWindow3 *iface, REFIID riid,
845 LPOLESTR *rgszNames, UINT cNames,
846 LCID lcid, DISPID *rgDispId)
848 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
850 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
853 static HRESULT WINAPI HTMLWindow3_Invoke(IHTMLWindow3 *iface, DISPID dispIdMember,
854 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
855 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
857 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
859 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
860 pVarResult, pExcepInfo, puArgErr);
863 static HRESULT WINAPI HTMLWindow3_get_screenLeft(IHTMLWindow3 *iface, long *p)
865 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
866 FIXME("(%p)->(%p)\n", This, p);
870 static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, long *p)
872 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
873 FIXME("(%p)->(%p)\n", This, p);
877 static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult)
879 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
880 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
884 static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
886 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
887 FIXME("(%p)->()\n", This);
891 static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, long msec, VARIANT *language,
892 BOOL interval, long *timer_id)
894 IDispatch *disp = NULL;
898 disp = V_DISPATCH(expr);
899 IDispatch_AddRef(disp);
903 disp = script_parse_event(This->doc, V_BSTR(expr));
907 FIXME("unimplemented vt=%d\n", V_VT(expr));
914 *timer_id = set_task_timer(This->doc, msec, interval, disp);
915 IDispatch_Release(disp);
920 static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expression, long msec,
921 VARIANT *language, long *timerID)
923 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
925 TRACE("(%p)->(%p(%d) %ld %p %p)\n", This, expression, V_VT(expression), msec, language, timerID);
927 return window_set_timer(This, expression, msec, language, FALSE, timerID);
930 static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, long msec,
931 VARIANT *language, long *timerID)
933 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
935 TRACE("(%p)->(%p %ld %p %p)\n", This, expression, msec, language, timerID);
937 return window_set_timer(This, expression, msec, language, TRUE, timerID);
940 static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface)
942 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
943 FIXME("(%p)\n", This);
947 static HRESULT WINAPI HTMLWindow3_put_onbeforeprint(IHTMLWindow3 *iface, VARIANT v)
949 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
950 FIXME("(%p)->()\n", This);
954 static HRESULT WINAPI HTMLWindow3_get_onbeforeprint(IHTMLWindow3 *iface, VARIANT *p)
956 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
957 FIXME("(%p)->(%p)\n", This, p);
961 static HRESULT WINAPI HTMLWindow3_put_onafterprint(IHTMLWindow3 *iface, VARIANT v)
963 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
964 FIXME("(%p)->()\n", This);
968 static HRESULT WINAPI HTMLWindow3_get_onafterprint(IHTMLWindow3 *iface, VARIANT *p)
970 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
971 FIXME("(%p)->(%p)\n", This, p);
975 static HRESULT WINAPI HTMLWindow3_get_clipboardData(IHTMLWindow3 *iface, IHTMLDataTransfer **p)
977 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
978 FIXME("(%p)->(%p)\n", This, p);
982 static HRESULT WINAPI HTMLWindow3_showModelessDialog(IHTMLWindow3 *iface, BSTR url,
983 VARIANT *varArgIn, VARIANT *options, IHTMLWindow2 **pDialog)
985 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
986 FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(url), varArgIn, options, pDialog);
990 #undef HTMLWINDOW3_THIS
992 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl = {
993 HTMLWindow3_QueryInterface,
996 HTMLWindow3_GetTypeInfoCount,
997 HTMLWindow3_GetTypeInfo,
998 HTMLWindow3_GetIDsOfNames,
1000 HTMLWindow3_get_screenLeft,
1001 HTMLWindow3_get_screenTop,
1002 HTMLWindow3_attachEvent,
1003 HTMLWindow3_detachEvent,
1004 HTMLWindow3_setTimeout,
1005 HTMLWindow3_setInterval,
1007 HTMLWindow3_put_onbeforeprint,
1008 HTMLWindow3_get_onbeforeprint,
1009 HTMLWindow3_put_onafterprint,
1010 HTMLWindow3_get_onafterprint,
1011 HTMLWindow3_get_clipboardData,
1012 HTMLWindow3_showModelessDialog
1015 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLWindow, IDispatchEx, iface)
1017 static HRESULT WINAPI WindowDispEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
1019 HTMLWindow *This = DISPEX_THIS(iface);
1021 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv);
1024 static ULONG WINAPI WindowDispEx_AddRef(IDispatchEx *iface)
1026 HTMLWindow *This = DISPEX_THIS(iface);
1028 return IHTMLWindow2_AddRef(HTMLWINDOW2(This));
1031 static ULONG WINAPI WindowDispEx_Release(IDispatchEx *iface)
1033 HTMLWindow *This = DISPEX_THIS(iface);
1035 return IHTMLWindow2_Release(HTMLWINDOW2(This));
1038 static HRESULT WINAPI WindowDispEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
1040 HTMLWindow *This = DISPEX_THIS(iface);
1042 TRACE("(%p)->(%p)\n", This, pctinfo);
1044 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
1047 static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
1048 LCID lcid, ITypeInfo **ppTInfo)
1050 HTMLWindow *This = DISPEX_THIS(iface);
1052 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1054 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
1057 static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
1058 LPOLESTR *rgszNames, UINT cNames,
1059 LCID lcid, DISPID *rgDispId)
1061 HTMLWindow *This = DISPEX_THIS(iface);
1063 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1066 /* FIXME: Use script dispatch */
1068 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
1071 static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
1072 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1073 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1075 HTMLWindow *This = DISPEX_THIS(iface);
1077 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1078 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1080 /* FIXME: Use script dispatch */
1082 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
1083 pVarResult, pExcepInfo, puArgErr);
1086 static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
1088 HTMLWindow *This = DISPEX_THIS(iface);
1090 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
1092 return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
1095 static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1096 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1098 HTMLWindow *This = DISPEX_THIS(iface);
1100 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1102 return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1105 static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
1107 HTMLWindow *This = DISPEX_THIS(iface);
1109 TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
1111 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
1114 static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
1116 HTMLWindow *This = DISPEX_THIS(iface);
1118 TRACE("(%p)->(%x)\n", This, id);
1120 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
1123 static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
1125 HTMLWindow *This = DISPEX_THIS(iface);
1127 TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
1129 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
1132 static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
1134 HTMLWindow *This = DISPEX_THIS(iface);
1136 TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
1138 return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
1141 static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
1143 HTMLWindow *This = DISPEX_THIS(iface);
1145 TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
1147 return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
1150 static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
1152 HTMLWindow *This = DISPEX_THIS(iface);
1154 TRACE("(%p)->(%p)\n", This, ppunk);
1162 static const IDispatchExVtbl WindowDispExVtbl = {
1163 WindowDispEx_QueryInterface,
1164 WindowDispEx_AddRef,
1165 WindowDispEx_Release,
1166 WindowDispEx_GetTypeInfoCount,
1167 WindowDispEx_GetTypeInfo,
1168 WindowDispEx_GetIDsOfNames,
1169 WindowDispEx_Invoke,
1170 WindowDispEx_GetDispID,
1171 WindowDispEx_InvokeEx,
1172 WindowDispEx_DeleteMemberByName,
1173 WindowDispEx_DeleteMemberByDispID,
1174 WindowDispEx_GetMemberProperties,
1175 WindowDispEx_GetMemberName,
1176 WindowDispEx_GetNextDispID,
1177 WindowDispEx_GetNameSpaceParent
1180 static const tid_t HTMLWindow_iface_tids[] = {
1185 static dispex_static_data_t HTMLWindow_dispex = {
1187 DispHTMLWindow2_tid,
1189 HTMLWindow_iface_tids
1192 HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
1196 window = heap_alloc_zero(sizeof(HTMLWindow));
1198 return E_OUTOFMEMORY;
1200 window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
1201 window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
1202 window->lpIDispatchExVtbl = &WindowDispExVtbl;
1206 init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
1209 nsIDOMWindow_AddRef(nswindow);
1210 window->nswindow = nswindow;
1213 list_add_head(&window_list, &window->entry);
1219 HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
1223 LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) {
1224 if(iter->nswindow == nswindow)