Commit | Line | Data |
---|---|---|
fb4980d6 JC |
1 | /* |
2 | * Copyright 2006 Jacek Caban for CodeWeavers | |
3 | * | |
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. | |
8 | * | |
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. | |
13 | * | |
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 | |
17 | */ | |
18 | ||
fb4980d6 | 19 | #include <stdarg.h> |
fb4980d6 JC |
20 | |
21 | #define COBJMACROS | |
22 | ||
23 | #include "windef.h" | |
24 | #include "winbase.h" | |
25 | #include "winuser.h" | |
fb4980d6 JC |
26 | #include "ole2.h" |
27 | ||
28 | #include "wine/debug.h" | |
29 | #include "wine/unicode.h" | |
30 | ||
31 | #include "mshtml_private.h" | |
32 | #include "resource.h" | |
33 | ||
34 | WINE_DEFAULT_DEBUG_CHANNEL(mshtml); | |
35 | ||
13f77846 JC |
36 | static struct list window_list = LIST_INIT(window_list); |
37 | ||
a5843056 JC |
38 | #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface) |
39 | ||
fb4980d6 JC |
40 | static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv) |
41 | { | |
42 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
43 | ||
44 | *ppv = NULL; | |
45 | ||
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); | |
a5843056 JC |
52 | }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { |
53 | TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv); | |
54 | *ppv = DISPATCHEX(This); | |
fb4980d6 JC |
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); | |
a0091573 JC |
61 | }else if(IsEqualGUID(&IID_IHTMLWindow3, riid)) { |
62 | TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv); | |
63 | *ppv = HTMLWINDOW3(This); | |
fe863e03 JC |
64 | }else if(dispex_query_interface(&This->dispex, riid, ppv)) { |
65 | return *ppv ? S_OK : E_NOINTERFACE; | |
fb4980d6 JC |
66 | } |
67 | ||
68 | if(*ppv) { | |
69 | IUnknown_AddRef((IUnknown*)*ppv); | |
70 | return S_OK; | |
71 | } | |
72 | ||
73 | WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); | |
74 | return E_NOINTERFACE; | |
75 | } | |
76 | ||
77 | static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface) | |
78 | { | |
79 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
80 | LONG ref = InterlockedIncrement(&This->ref); | |
81 | ||
82 | TRACE("(%p) ref=%d\n", This, ref); | |
83 | ||
84 | return ref; | |
85 | } | |
86 | ||
87 | static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) | |
88 | { | |
89 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
90 | LONG ref = InterlockedDecrement(&This->ref); | |
91 | ||
92 | TRACE("(%p) ref=%d\n", This, ref); | |
93 | ||
13f77846 JC |
94 | if(!ref) { |
95 | list_remove(&This->entry); | |
a084d1db | 96 | heap_free(This); |
13f77846 | 97 | } |
fb4980d6 JC |
98 | |
99 | return ref; | |
100 | } | |
101 | ||
102 | static HRESULT WINAPI HTMLWindow2_GetTypeInfoCount(IHTMLWindow2 *iface, UINT *pctinfo) | |
103 | { | |
104 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
4005cf72 | 105 | |
951084ab | 106 | return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo); |
fb4980d6 JC |
107 | } |
108 | ||
109 | static HRESULT WINAPI HTMLWindow2_GetTypeInfo(IHTMLWindow2 *iface, UINT iTInfo, | |
110 | LCID lcid, ITypeInfo **ppTInfo) | |
111 | { | |
112 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
4005cf72 | 113 | |
951084ab | 114 | return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo); |
fb4980d6 JC |
115 | } |
116 | ||
117 | static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid, | |
118 | LPOLESTR *rgszNames, UINT cNames, | |
119 | LCID lcid, DISPID *rgDispId) | |
120 | { | |
121 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
4005cf72 | 122 | |
951084ab | 123 | return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId); |
fb4980d6 JC |
124 | } |
125 | ||
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) | |
129 | { | |
130 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
4005cf72 | 131 | |
951084ab JC |
132 | return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams, |
133 | pVarResult, pExcepInfo, puArgErr); | |
fb4980d6 JC |
134 | } |
135 | ||
136 | static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, VARIANT *pvarResult) | |
137 | { | |
138 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
139 | FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult); | |
140 | return E_NOTIMPL; | |
141 | } | |
142 | ||
143 | static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, long *p) | |
144 | { | |
145 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
146 | FIXME("(%p)->(%p)\n", This, p); | |
147 | return E_NOTIMPL; | |
148 | } | |
149 | ||
150 | static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p) | |
151 | { | |
152 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
153 | FIXME("(%p)->(%p)\n", This, p); | |
154 | return E_NOTIMPL; | |
155 | } | |
156 | ||
157 | static HRESULT WINAPI HTMLWindow2_put_defaultStatus(IHTMLWindow2 *iface, BSTR v) | |
158 | { | |
159 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
160 | FIXME("(%p)->(%s)\n", This, debugstr_w(v)); | |
161 | return E_NOTIMPL; | |
162 | } | |
163 | ||
164 | static HRESULT WINAPI HTMLWindow2_get_defaultStatus(IHTMLWindow2 *iface, BSTR *p) | |
165 | { | |
166 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
167 | FIXME("(%p)->(%p)\n", This, p); | |
168 | return E_NOTIMPL; | |
169 | } | |
170 | ||
171 | static HRESULT WINAPI HTMLWindow2_put_status(IHTMLWindow2 *iface, BSTR v) | |
172 | { | |
173 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
174 | FIXME("(%p)->(%s)\n", This, debugstr_w(v)); | |
175 | return E_NOTIMPL; | |
176 | } | |
177 | ||
178 | static HRESULT WINAPI HTMLWindow2_get_status(IHTMLWindow2 *iface, BSTR *p) | |
179 | { | |
180 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
181 | FIXME("(%p)->(%p)\n", This, p); | |
182 | return E_NOTIMPL; | |
183 | } | |
184 | ||
185 | static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expression, | |
186 | long msec, VARIANT *language, long *timerID) | |
187 | { | |
188 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
86409551 JC |
189 | VARIANT expr_var; |
190 | ||
191 | TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID); | |
192 | ||
193 | V_VT(&expr_var) = VT_BSTR; | |
194 | V_BSTR(&expr_var) = expression; | |
195 | ||
196 | return IHTMLWindow3_setTimeout(HTMLWINDOW3(This), &expr_var, msec, language, timerID); | |
fb4980d6 JC |
197 | } |
198 | ||
199 | static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, long timerID) | |
200 | { | |
201 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
8d3aa679 JC |
202 | |
203 | TRACE("(%p)->(%ld)\n", This, timerID); | |
204 | ||
205 | return clear_task_timer(This->doc, FALSE, timerID); | |
fb4980d6 JC |
206 | } |
207 | ||
208 | static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message) | |
209 | { | |
210 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
62f1ef9d JC |
211 | WCHAR wszTitle[100]; |
212 | ||
213 | TRACE("(%p)->(%s)\n", This, debugstr_w(message)); | |
214 | ||
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()); | |
218 | return S_OK; | |
219 | } | |
220 | ||
221 | MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING); | |
222 | return S_OK; | |
fb4980d6 JC |
223 | } |
224 | ||
225 | static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message, | |
226 | VARIANT_BOOL *confirmed) | |
227 | { | |
228 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
229 | FIXME("(%p)->(%s %p)\n", This, debugstr_w(message), confirmed); | |
230 | return E_NOTIMPL; | |
231 | } | |
232 | ||
233 | static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message, | |
234 | BSTR dststr, VARIANT *textdata) | |
235 | { | |
236 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
237 | FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata); | |
238 | return E_NOTIMPL; | |
239 | } | |
240 | ||
241 | static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p) | |
242 | { | |
243 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
244 | FIXME("(%p)->(%p)\n", This, p); | |
245 | return E_NOTIMPL; | |
246 | } | |
247 | ||
248 | static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p) | |
249 | { | |
250 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
159cc19b JC |
251 | |
252 | TRACE("(%p)->(%p)\n", This, p); | |
253 | ||
254 | if(!This->doc) { | |
255 | FIXME("This->doc is NULL\n"); | |
256 | return E_FAIL; | |
257 | } | |
258 | ||
259 | return IHTMLDocument2_get_location(HTMLDOC(This->doc), p); | |
fb4980d6 JC |
260 | } |
261 | ||
262 | static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p) | |
263 | { | |
264 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
265 | FIXME("(%p)->(%p)\n", This, p); | |
266 | return E_NOTIMPL; | |
267 | } | |
268 | ||
269 | static HRESULT WINAPI HTMLWindow2_close(IHTMLWindow2 *iface) | |
270 | { | |
271 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
272 | FIXME("(%p)->()\n", This); | |
273 | return E_NOTIMPL; | |
274 | } | |
275 | ||
276 | static HRESULT WINAPI HTMLWindow2_put_opener(IHTMLWindow2 *iface, VARIANT v) | |
277 | { | |
278 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
279 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
280 | return E_NOTIMPL; | |
281 | } | |
282 | ||
283 | static HRESULT WINAPI HTMLWindow2_get_opener(IHTMLWindow2 *iface, VARIANT *p) | |
284 | { | |
285 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
286 | FIXME("(%p)->(%p)\n", This, p); | |
287 | return E_NOTIMPL; | |
288 | } | |
289 | ||
290 | static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigator **p) | |
291 | { | |
292 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
9c352a11 JC |
293 | |
294 | TRACE("(%p)->(%p)\n", This, p); | |
295 | ||
296 | *p = OmNavigator_Create(); | |
297 | return S_OK; | |
fb4980d6 JC |
298 | } |
299 | ||
300 | static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v) | |
301 | { | |
302 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
303 | FIXME("(%p)->(%s)\n", This, debugstr_w(v)); | |
304 | return E_NOTIMPL; | |
305 | } | |
306 | ||
307 | static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p) | |
308 | { | |
309 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
310 | FIXME("(%p)->(%p)\n", This, p); | |
311 | return E_NOTIMPL; | |
312 | } | |
313 | ||
314 | static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p) | |
315 | { | |
316 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
317 | FIXME("(%p)->(%p)\n", This, p); | |
318 | return E_NOTIMPL; | |
319 | } | |
320 | ||
321 | static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, | |
322 | BSTR features, VARIANT_BOOL replace, IHTMLWindow2 **pomWindowResult) | |
323 | { | |
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); | |
327 | return E_NOTIMPL; | |
328 | } | |
329 | ||
330 | static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p) | |
331 | { | |
332 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
f58b963f JC |
333 | |
334 | TRACE("(%p)->(%p)\n", This, p); | |
335 | ||
336 | /* FIXME: We should return kind of proxy window here. */ | |
337 | IHTMLWindow2_AddRef(HTMLWINDOW2(This)); | |
338 | *p = HTMLWINDOW2(This); | |
339 | return S_OK; | |
fb4980d6 JC |
340 | } |
341 | ||
342 | static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p) | |
343 | { | |
344 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
345 | FIXME("(%p)->(%p)\n", This, p); | |
346 | return E_NOTIMPL; | |
347 | } | |
348 | ||
349 | static HRESULT WINAPI HTMLWindow2_get_window(IHTMLWindow2 *iface, IHTMLWindow2 **p) | |
350 | { | |
351 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
ebb4a9b1 JC |
352 | |
353 | TRACE("(%p)->(%p)\n", This, p); | |
354 | ||
355 | /* FIXME: We should return kind of proxy window here. */ | |
356 | IHTMLWindow2_AddRef(HTMLWINDOW2(This)); | |
357 | *p = HTMLWINDOW2(This); | |
358 | return S_OK; | |
fb4980d6 JC |
359 | } |
360 | ||
361 | static HRESULT WINAPI HTMLWindow2_navigate(IHTMLWindow2 *iface, BSTR url) | |
362 | { | |
363 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
364 | FIXME("(%p)->(%s)\n", This, debugstr_w(url)); | |
365 | return E_NOTIMPL; | |
366 | } | |
367 | ||
368 | static HRESULT WINAPI HTMLWindow2_put_onfocus(IHTMLWindow2 *iface, VARIANT v) | |
369 | { | |
370 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
371 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
372 | return E_NOTIMPL; | |
373 | } | |
374 | ||
375 | static HRESULT WINAPI HTMLWindow2_get_onfocus(IHTMLWindow2 *iface, VARIANT *p) | |
376 | { | |
377 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
378 | FIXME("(%p)->(%p)\n", This, p); | |
379 | return E_NOTIMPL; | |
380 | } | |
381 | ||
382 | static HRESULT WINAPI HTMLWindow2_put_onblur(IHTMLWindow2 *iface, VARIANT v) | |
383 | { | |
384 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
385 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
386 | return E_NOTIMPL; | |
387 | } | |
388 | ||
389 | static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p) | |
390 | { | |
391 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
392 | FIXME("(%p)->(%p)\n", This, p); | |
393 | return E_NOTIMPL; | |
394 | } | |
395 | ||
396 | static HRESULT WINAPI HTMLWindow2_put_onload(IHTMLWindow2 *iface, VARIANT v) | |
397 | { | |
398 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
399 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
400 | return E_NOTIMPL; | |
401 | } | |
402 | ||
403 | static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p) | |
404 | { | |
405 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
406 | FIXME("(%p)->(%p)\n", This, p); | |
407 | return E_NOTIMPL; | |
408 | } | |
409 | ||
410 | static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v) | |
411 | { | |
412 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
413 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
414 | return E_NOTIMPL; | |
415 | } | |
416 | ||
417 | static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p) | |
418 | { | |
419 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
420 | FIXME("(%p)->(%p)\n", This, p); | |
421 | return E_NOTIMPL; | |
422 | } | |
423 | ||
424 | static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v) | |
425 | { | |
426 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
427 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
428 | return E_NOTIMPL; | |
429 | } | |
430 | ||
431 | static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p) | |
432 | { | |
433 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
434 | FIXME("(%p)->(%p)\n", This, p); | |
435 | return E_NOTIMPL; | |
436 | } | |
437 | ||
438 | static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v) | |
439 | { | |
440 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
441 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
442 | return E_NOTIMPL; | |
443 | } | |
444 | ||
445 | static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p) | |
446 | { | |
447 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
448 | FIXME("(%p)->(%p)\n", This, p); | |
449 | return E_NOTIMPL; | |
450 | } | |
451 | ||
452 | static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v) | |
453 | { | |
454 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
455 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
456 | return E_NOTIMPL; | |
457 | } | |
458 | ||
459 | static HRESULT WINAPI HTMLWindow2_get_onerror(IHTMLWindow2 *iface, VARIANT *p) | |
460 | { | |
461 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
462 | FIXME("(%p)->(%p)\n", This, p); | |
463 | return E_NOTIMPL; | |
464 | } | |
465 | ||
466 | static HRESULT WINAPI HTMLWindow2_put_onresize(IHTMLWindow2 *iface, VARIANT v) | |
467 | { | |
468 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
469 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
470 | return E_NOTIMPL; | |
471 | } | |
472 | ||
473 | static HRESULT WINAPI HTMLWindow2_get_onresize(IHTMLWindow2 *iface, VARIANT *p) | |
474 | { | |
475 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
476 | FIXME("(%p)->(%p)\n", This, p); | |
477 | return E_NOTIMPL; | |
478 | } | |
479 | ||
480 | static HRESULT WINAPI HTMLWindow2_put_onscroll(IHTMLWindow2 *iface, VARIANT v) | |
481 | { | |
482 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
483 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
484 | return E_NOTIMPL; | |
485 | } | |
486 | ||
487 | static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p) | |
488 | { | |
489 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
490 | FIXME("(%p)->(%p)\n", This, p); | |
491 | return E_NOTIMPL; | |
492 | } | |
493 | ||
494 | static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p) | |
495 | { | |
496 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
aeb1095b JC |
497 | |
498 | TRACE("(%p)->(%p)\n", This, p); | |
499 | ||
500 | if(This->doc) { | |
501 | /* FIXME: We should return a wrapper object here */ | |
502 | *p = HTMLDOC(This->doc); | |
503 | IHTMLDocument2_AddRef(*p); | |
504 | }else { | |
505 | *p = NULL; | |
506 | } | |
507 | ||
508 | return S_OK; | |
fb4980d6 JC |
509 | } |
510 | ||
511 | static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p) | |
512 | { | |
513 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
28d918f5 JC |
514 | |
515 | TRACE("(%p)->(%p)\n", This, p); | |
516 | ||
517 | if(This->event) | |
518 | IHTMLEventObj_AddRef(This->event); | |
519 | *p = This->event; | |
520 | return S_OK; | |
fb4980d6 JC |
521 | } |
522 | ||
523 | static HRESULT WINAPI HTMLWindow2_get__newEnum(IHTMLWindow2 *iface, IUnknown **p) | |
524 | { | |
525 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
526 | FIXME("(%p)->(%p)\n", This, p); | |
527 | return E_NOTIMPL; | |
528 | } | |
529 | ||
530 | static HRESULT WINAPI HTMLWindow2_showModalDialog(IHTMLWindow2 *iface, BSTR dialog, | |
531 | VARIANT *varArgIn, VARIANT *varOptions, VARIANT *varArgOut) | |
532 | { | |
533 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
534 | FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(dialog), varArgIn, varOptions, varArgOut); | |
535 | return E_NOTIMPL; | |
536 | } | |
537 | ||
538 | static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VARIANT helpArg, | |
539 | BSTR features) | |
540 | { | |
541 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
542 | FIXME("(%p)->(%s v(%d) %s)\n", This, debugstr_w(helpURL), V_VT(&helpArg), debugstr_w(features)); | |
543 | return E_NOTIMPL; | |
544 | } | |
545 | ||
546 | static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p) | |
547 | { | |
548 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
549 | FIXME("(%p)->(%p)\n", This, p); | |
550 | return E_NOTIMPL; | |
551 | } | |
552 | ||
553 | static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p) | |
554 | { | |
555 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
954d4477 JC |
556 | |
557 | TRACE("(%p)->(%p)\n", This, p); | |
558 | ||
559 | if(!This->doc->option_factory) | |
560 | This->doc->option_factory = HTMLOptionElementFactory_Create(This->doc); | |
561 | ||
562 | *p = HTMLOPTFACTORY(This->doc->option_factory); | |
563 | IHTMLOptionElementFactory_AddRef(*p); | |
564 | ||
565 | return S_OK; | |
fb4980d6 JC |
566 | } |
567 | ||
568 | static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface) | |
569 | { | |
570 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
571 | FIXME("(%p)->()\n", This); | |
572 | return E_NOTIMPL; | |
573 | } | |
574 | ||
575 | static HRESULT WINAPI HTMLWindow2_get_closed(IHTMLWindow2 *iface, VARIANT_BOOL *p) | |
576 | { | |
577 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
578 | FIXME("(%p)->(%p)\n", This, p); | |
579 | return E_NOTIMPL; | |
580 | } | |
581 | ||
582 | static HRESULT WINAPI HTMLWindow2_blur(IHTMLWindow2 *iface) | |
583 | { | |
584 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
585 | FIXME("(%p)->()\n", This); | |
586 | return E_NOTIMPL; | |
587 | } | |
588 | ||
589 | static HRESULT WINAPI HTMLWindow2_scroll(IHTMLWindow2 *iface, long x, long y) | |
590 | { | |
591 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
592 | FIXME("(%p)->(%ld %ld)\n", This, x, y); | |
593 | return E_NOTIMPL; | |
594 | } | |
595 | ||
596 | static HRESULT WINAPI HTMLWindow2_get_clientInformation(IHTMLWindow2 *iface, IOmNavigator **p) | |
597 | { | |
598 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
599 | FIXME("(%p)->(%p)\n", This, p); | |
600 | return E_NOTIMPL; | |
601 | } | |
602 | ||
603 | static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expression, | |
604 | long msec, VARIANT *language, long *timerID) | |
605 | { | |
606 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
0d56f105 JC |
607 | VARIANT expr; |
608 | ||
609 | TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID); | |
610 | ||
611 | V_VT(&expr) = VT_BSTR; | |
612 | V_BSTR(&expr) = expression; | |
613 | return IHTMLWindow3_setInterval(HTMLWINDOW3(This), &expr, msec, language, timerID); | |
fb4980d6 JC |
614 | } |
615 | ||
616 | static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, long timerID) | |
617 | { | |
618 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
87615397 JC |
619 | |
620 | TRACE("(%p)->(%ld)\n", This, timerID); | |
621 | ||
622 | return clear_task_timer(This->doc, TRUE, timerID); | |
fb4980d6 JC |
623 | } |
624 | ||
625 | static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v) | |
626 | { | |
627 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
628 | FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); | |
629 | return E_NOTIMPL; | |
630 | } | |
631 | ||
632 | static HRESULT WINAPI HTMLWindow2_get_offscreenBuffering(IHTMLWindow2 *iface, VARIANT *p) | |
633 | { | |
634 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
635 | FIXME("(%p)->(%p)\n", This, p); | |
636 | return E_NOTIMPL; | |
637 | } | |
638 | ||
639 | static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BSTR language, | |
640 | VARIANT *pvarRet) | |
641 | { | |
642 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
643 | FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet); | |
644 | return E_NOTIMPL; | |
645 | } | |
646 | ||
647 | static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String) | |
648 | { | |
649 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
650 | FIXME("(%p)->(%p)\n", This, String); | |
651 | return E_NOTIMPL; | |
652 | } | |
653 | ||
654 | static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, long x, long y) | |
655 | { | |
656 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
047e5aaa JC |
657 | nsresult nsres; |
658 | ||
2b4dcb25 | 659 | TRACE("(%p)->(%ld %ld)\n", This, x, y); |
047e5aaa JC |
660 | |
661 | nsres = nsIDOMWindow_ScrollBy(This->nswindow, x, y); | |
662 | if(NS_FAILED(nsres)) | |
663 | ERR("ScrollBy failed: %08x\n", nsres); | |
664 | ||
665 | return S_OK; | |
fb4980d6 JC |
666 | } |
667 | ||
668 | static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, long x, long y) | |
669 | { | |
670 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
047e5aaa JC |
671 | nsresult nsres; |
672 | ||
e731a42b | 673 | TRACE("(%p)->(%ld %ld)\n", This, x, y); |
047e5aaa JC |
674 | |
675 | nsres = nsIDOMWindow_ScrollTo(This->nswindow, x, y); | |
676 | if(NS_FAILED(nsres)) | |
677 | ERR("ScrollTo failed: %08x\n", nsres); | |
678 | ||
679 | return S_OK; | |
fb4980d6 JC |
680 | } |
681 | ||
682 | static HRESULT WINAPI HTMLWindow2_moveTo(IHTMLWindow2 *iface, long x, long y) | |
683 | { | |
684 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
685 | FIXME("(%p)->(%ld %ld)\n", This, x, y); | |
686 | return E_NOTIMPL; | |
687 | } | |
688 | ||
689 | static HRESULT WINAPI HTMLWindow2_moveBy(IHTMLWindow2 *iface, long x, long y) | |
690 | { | |
691 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
692 | FIXME("(%p)->(%ld %ld)\n", This, x, y); | |
693 | return E_NOTIMPL; | |
694 | } | |
695 | ||
696 | static HRESULT WINAPI HTMLWindow2_resizeTo(IHTMLWindow2 *iface, long x, long y) | |
697 | { | |
698 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
699 | FIXME("(%p)->(%ld %ld)\n", This, x, y); | |
700 | return E_NOTIMPL; | |
701 | } | |
702 | ||
703 | static HRESULT WINAPI HTMLWindow2_resizeBy(IHTMLWindow2 *iface, long x, long y) | |
704 | { | |
705 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
706 | FIXME("(%p)->(%ld %ld)\n", This, x, y); | |
707 | return E_NOTIMPL; | |
708 | } | |
709 | ||
710 | static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **p) | |
711 | { | |
712 | HTMLWindow *This = HTMLWINDOW2_THIS(iface); | |
a8452016 JC |
713 | |
714 | TRACE("(%p)->(%p)\n", This, p); | |
715 | ||
716 | *p = NULL; | |
717 | ||
718 | if(!This->doc->hostui) | |
719 | return S_OK; | |
720 | ||
721 | return IDocHostUIHandler_GetExternal(This->doc->hostui, p); | |
fb4980d6 JC |
722 | } |
723 | ||
724 | #undef HTMLWINDOW2_THIS | |
725 | ||
726 | static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = { | |
727 | HTMLWindow2_QueryInterface, | |
728 | HTMLWindow2_AddRef, | |
729 | HTMLWindow2_Release, | |
730 | HTMLWindow2_GetTypeInfoCount, | |
731 | HTMLWindow2_GetTypeInfo, | |
732 | HTMLWindow2_GetIDsOfNames, | |
733 | HTMLWindow2_Invoke, | |
734 | HTMLWindow2_item, | |
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, | |
743 | HTMLWindow2_alert, | |
744 | HTMLWindow2_confirm, | |
745 | HTMLWindow2_prompt, | |
746 | HTMLWindow2_get_Image, | |
747 | HTMLWindow2_get_location, | |
748 | HTMLWindow2_get_history, | |
749 | HTMLWindow2_close, | |
750 | HTMLWindow2_put_opener, | |
751 | HTMLWindow2_get_opener, | |
752 | HTMLWindow2_get_navigator, | |
753 | HTMLWindow2_put_name, | |
754 | HTMLWindow2_get_name, | |
755 | HTMLWindow2_get_parent, | |
756 | HTMLWindow2_open, | |
757 | HTMLWindow2_get_self, | |
758 | HTMLWindow2_get_top, | |
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, | |
786 | HTMLWindow2_focus, | |
787 | HTMLWindow2_get_closed, | |
788 | HTMLWindow2_blur, | |
789 | HTMLWindow2_scroll, | |
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, | |
799 | HTMLWindow2_moveTo, | |
800 | HTMLWindow2_moveBy, | |
801 | HTMLWindow2_resizeTo, | |
802 | HTMLWindow2_resizeBy, | |
803 | HTMLWindow2_get_external | |
804 | }; | |
805 | ||
a0091573 JC |
806 | #define HTMLWINDOW3_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow3, iface) |
807 | ||
808 | static HRESULT WINAPI HTMLWindow3_QueryInterface(IHTMLWindow3 *iface, REFIID riid, void **ppv) | |
809 | { | |
810 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
811 | ||
812 | return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv); | |
813 | } | |
814 | ||
815 | static ULONG WINAPI HTMLWindow3_AddRef(IHTMLWindow3 *iface) | |
816 | { | |
817 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
818 | ||
819 | return IHTMLWindow2_AddRef(HTMLWINDOW2(This)); | |
820 | } | |
821 | ||
822 | static ULONG WINAPI HTMLWindow3_Release(IHTMLWindow3 *iface) | |
823 | { | |
824 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
825 | ||
826 | return IHTMLWindow2_Release(HTMLWINDOW2(This)); | |
827 | } | |
828 | ||
829 | static HRESULT WINAPI HTMLWindow3_GetTypeInfoCount(IHTMLWindow3 *iface, UINT *pctinfo) | |
830 | { | |
831 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
951084ab JC |
832 | |
833 | return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo); | |
a0091573 JC |
834 | } |
835 | ||
836 | static HRESULT WINAPI HTMLWindow3_GetTypeInfo(IHTMLWindow3 *iface, UINT iTInfo, | |
837 | LCID lcid, ITypeInfo **ppTInfo) | |
838 | { | |
839 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
951084ab JC |
840 | |
841 | return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo); | |
a0091573 JC |
842 | } |
843 | ||
844 | static HRESULT WINAPI HTMLWindow3_GetIDsOfNames(IHTMLWindow3 *iface, REFIID riid, | |
845 | LPOLESTR *rgszNames, UINT cNames, | |
846 | LCID lcid, DISPID *rgDispId) | |
847 | { | |
848 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
951084ab JC |
849 | |
850 | return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId); | |
a0091573 JC |
851 | } |
852 | ||
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) | |
856 | { | |
857 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
951084ab JC |
858 | |
859 | return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams, | |
860 | pVarResult, pExcepInfo, puArgErr); | |
a0091573 JC |
861 | } |
862 | ||
863 | static HRESULT WINAPI HTMLWindow3_get_screenLeft(IHTMLWindow3 *iface, long *p) | |
864 | { | |
865 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
866 | FIXME("(%p)->(%p)\n", This, p); | |
867 | return E_NOTIMPL; | |
868 | } | |
869 | ||
870 | static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, long *p) | |
871 | { | |
872 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
873 | FIXME("(%p)->(%p)\n", This, p); | |
874 | return E_NOTIMPL; | |
875 | } | |
876 | ||
877 | static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult) | |
878 | { | |
879 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
880 | FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); | |
881 | return E_NOTIMPL; | |
882 | } | |
883 | ||
884 | static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp) | |
885 | { | |
886 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
887 | FIXME("(%p)->()\n", This); | |
888 | return E_NOTIMPL; | |
889 | } | |
890 | ||
74f29f10 JC |
891 | static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, long msec, VARIANT *language, |
892 | BOOL interval, long *timer_id) | |
a0091573 | 893 | { |
44223acc | 894 | IDispatch *disp = NULL; |
788432af | 895 | |
44223acc | 896 | switch(V_VT(expr)) { |
788432af | 897 | case VT_DISPATCH: |
44223acc JC |
898 | disp = V_DISPATCH(expr); |
899 | IDispatch_AddRef(disp); | |
900 | break; | |
901 | ||
902 | case VT_BSTR: | |
903 | disp = script_parse_event(This->doc, V_BSTR(expr)); | |
788432af JC |
904 | break; |
905 | ||
906 | default: | |
44223acc JC |
907 | FIXME("unimplemented vt=%d\n", V_VT(expr)); |
908 | return E_NOTIMPL; | |
788432af JC |
909 | } |
910 | ||
44223acc JC |
911 | if(!disp) |
912 | return E_FAIL; | |
913 | ||
74f29f10 | 914 | *timer_id = set_task_timer(This->doc, msec, interval, disp); |
44223acc JC |
915 | IDispatch_Release(disp); |
916 | ||
788432af | 917 | return S_OK; |
a0091573 JC |
918 | } |
919 | ||
44223acc JC |
920 | static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expression, long msec, |
921 | VARIANT *language, long *timerID) | |
922 | { | |
923 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
924 | ||
925 | TRACE("(%p)->(%p(%d) %ld %p %p)\n", This, expression, V_VT(expression), msec, language, timerID); | |
926 | ||
74f29f10 | 927 | return window_set_timer(This, expression, msec, language, FALSE, timerID); |
44223acc JC |
928 | } |
929 | ||
a0091573 JC |
930 | static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, long msec, |
931 | VARIANT *language, long *timerID) | |
932 | { | |
933 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
74f29f10 JC |
934 | |
935 | TRACE("(%p)->(%p %ld %p %p)\n", This, expression, msec, language, timerID); | |
936 | ||
937 | return window_set_timer(This, expression, msec, language, TRUE, timerID); | |
a0091573 JC |
938 | } |
939 | ||
940 | static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface) | |
941 | { | |
942 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
943 | FIXME("(%p)\n", This); | |
944 | return E_NOTIMPL; | |
945 | } | |
946 | ||
947 | static HRESULT WINAPI HTMLWindow3_put_onbeforeprint(IHTMLWindow3 *iface, VARIANT v) | |
948 | { | |
949 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
950 | FIXME("(%p)->()\n", This); | |
951 | return E_NOTIMPL; | |
952 | } | |
953 | ||
954 | static HRESULT WINAPI HTMLWindow3_get_onbeforeprint(IHTMLWindow3 *iface, VARIANT *p) | |
955 | { | |
956 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
957 | FIXME("(%p)->(%p)\n", This, p); | |
958 | return E_NOTIMPL; | |
959 | } | |
960 | ||
961 | static HRESULT WINAPI HTMLWindow3_put_onafterprint(IHTMLWindow3 *iface, VARIANT v) | |
962 | { | |
963 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
964 | FIXME("(%p)->()\n", This); | |
965 | return E_NOTIMPL; | |
966 | } | |
967 | ||
968 | static HRESULT WINAPI HTMLWindow3_get_onafterprint(IHTMLWindow3 *iface, VARIANT *p) | |
969 | { | |
970 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
971 | FIXME("(%p)->(%p)\n", This, p); | |
972 | return E_NOTIMPL; | |
973 | } | |
974 | ||
975 | static HRESULT WINAPI HTMLWindow3_get_clipboardData(IHTMLWindow3 *iface, IHTMLDataTransfer **p) | |
976 | { | |
977 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
978 | FIXME("(%p)->(%p)\n", This, p); | |
979 | return E_NOTIMPL; | |
980 | } | |
981 | ||
982 | static HRESULT WINAPI HTMLWindow3_showModelessDialog(IHTMLWindow3 *iface, BSTR url, | |
983 | VARIANT *varArgIn, VARIANT *options, IHTMLWindow2 **pDialog) | |
984 | { | |
985 | HTMLWindow *This = HTMLWINDOW3_THIS(iface); | |
986 | FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(url), varArgIn, options, pDialog); | |
987 | return E_NOTIMPL; | |
988 | } | |
989 | ||
990 | #undef HTMLWINDOW3_THIS | |
991 | ||
992 | static const IHTMLWindow3Vtbl HTMLWindow3Vtbl = { | |
993 | HTMLWindow3_QueryInterface, | |
994 | HTMLWindow3_AddRef, | |
995 | HTMLWindow3_Release, | |
996 | HTMLWindow3_GetTypeInfoCount, | |
997 | HTMLWindow3_GetTypeInfo, | |
998 | HTMLWindow3_GetIDsOfNames, | |
999 | HTMLWindow3_Invoke, | |
1000 | HTMLWindow3_get_screenLeft, | |
1001 | HTMLWindow3_get_screenTop, | |
1002 | HTMLWindow3_attachEvent, | |
1003 | HTMLWindow3_detachEvent, | |
1004 | HTMLWindow3_setTimeout, | |
1005 | HTMLWindow3_setInterval, | |
1006 | HTMLWindow3_print, | |
1007 | HTMLWindow3_put_onbeforeprint, | |
1008 | HTMLWindow3_get_onbeforeprint, | |
1009 | HTMLWindow3_put_onafterprint, | |
1010 | HTMLWindow3_get_onafterprint, | |
1011 | HTMLWindow3_get_clipboardData, | |
1012 | HTMLWindow3_showModelessDialog | |
1013 | }; | |
1014 | ||
a5843056 JC |
1015 | #define DISPEX_THIS(iface) DEFINE_THIS(HTMLWindow, IDispatchEx, iface) |
1016 | ||
1017 | static HRESULT WINAPI WindowDispEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) | |
1018 | { | |
1019 | HTMLWindow *This = DISPEX_THIS(iface); | |
1020 | ||
1021 | return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv); | |
1022 | } | |
1023 | ||
1024 | static ULONG WINAPI WindowDispEx_AddRef(IDispatchEx *iface) | |
1025 | { | |
1026 | HTMLWindow *This = DISPEX_THIS(iface); | |
1027 | ||
1028 | return IHTMLWindow2_AddRef(HTMLWINDOW2(This)); | |
1029 | } | |
1030 | ||
1031 | static ULONG WINAPI WindowDispEx_Release(IDispatchEx *iface) | |
1032 | { | |
1033 | HTMLWindow *This = DISPEX_THIS(iface); | |
1034 | ||
73bd6da2 | 1035 | return IHTMLWindow2_Release(HTMLWINDOW2(This)); |
a5843056 JC |
1036 | } |
1037 | ||
1038 | static HRESULT WINAPI WindowDispEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) | |
1039 | { | |
1040 | HTMLWindow *This = DISPEX_THIS(iface); | |
1041 | ||
1042 | TRACE("(%p)->(%p)\n", This, pctinfo); | |
1043 | ||
1044 | return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo); | |
1045 | } | |
1046 | ||
1047 | static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, | |
1048 | LCID lcid, ITypeInfo **ppTInfo) | |
1049 | { | |
1050 | HTMLWindow *This = DISPEX_THIS(iface); | |
1051 | ||
1052 | TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); | |
1053 | ||
1054 | return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo); | |
1055 | } | |
1056 | ||
1057 | static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, | |
1058 | LPOLESTR *rgszNames, UINT cNames, | |
1059 | LCID lcid, DISPID *rgDispId) | |
1060 | { | |
1061 | HTMLWindow *This = DISPEX_THIS(iface); | |
1062 | ||
1063 | TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, | |
1064 | lcid, rgDispId); | |
1065 | ||
1066 | /* FIXME: Use script dispatch */ | |
1067 | ||
1068 | return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId); | |
1069 | } | |
1070 | ||
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) | |
1074 | { | |
1075 | HTMLWindow *This = DISPEX_THIS(iface); | |
1076 | ||
1077 | TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), | |
1078 | lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); | |
1079 | ||
1080 | /* FIXME: Use script dispatch */ | |
1081 | ||
1082 | return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams, | |
1083 | pVarResult, pExcepInfo, puArgErr); | |
1084 | } | |
1085 | ||
1086 | static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) | |
1087 | { | |
1088 | HTMLWindow *This = DISPEX_THIS(iface); | |
1089 | ||
1090 | TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); | |
1091 | ||
1092 | return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid); | |
1093 | } | |
1094 | ||
1095 | static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, | |
1096 | VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) | |
1097 | { | |
1098 | HTMLWindow *This = DISPEX_THIS(iface); | |
1099 | ||
1100 | TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); | |
1101 | ||
1102 | return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); | |
1103 | } | |
1104 | ||
1105 | static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) | |
1106 | { | |
1107 | HTMLWindow *This = DISPEX_THIS(iface); | |
1108 | ||
1109 | TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex); | |
1110 | ||
1111 | return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex); | |
1112 | } | |
1113 | ||
1114 | static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) | |
1115 | { | |
1116 | HTMLWindow *This = DISPEX_THIS(iface); | |
1117 | ||
1118 | TRACE("(%p)->(%x)\n", This, id); | |
1119 | ||
1120 | return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id); | |
1121 | } | |
1122 | ||
1123 | static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) | |
1124 | { | |
1125 | HTMLWindow *This = DISPEX_THIS(iface); | |
1126 | ||
1127 | TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); | |
1128 | ||
1129 | return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex); | |
1130 | } | |
1131 | ||
1132 | static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) | |
1133 | { | |
1134 | HTMLWindow *This = DISPEX_THIS(iface); | |
1135 | ||
1136 | TRACE("(%p)->(%x %p)\n", This, id, pbstrName); | |
1137 | ||
1138 | return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName); | |
1139 | } | |
1140 | ||
1141 | static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) | |
1142 | { | |
1143 | HTMLWindow *This = DISPEX_THIS(iface); | |
1144 | ||
1145 | TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid); | |
1146 | ||
1147 | return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid); | |
1148 | } | |
1149 | ||
1150 | static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) | |
1151 | { | |
1152 | HTMLWindow *This = DISPEX_THIS(iface); | |
1153 | ||
1154 | TRACE("(%p)->(%p)\n", This, ppunk); | |
1155 | ||
9157c6d6 JC |
1156 | *ppunk = NULL; |
1157 | return S_OK; | |
a5843056 JC |
1158 | } |
1159 | ||
1160 | #undef DISPEX_THIS | |
1161 | ||
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 | |
1178 | }; | |
1179 | ||
53f2cb83 FG |
1180 | static const tid_t HTMLWindow_iface_tids[] = { |
1181 | IHTMLWindow2_tid, | |
1182 | IHTMLWindow3_tid, | |
1183 | 0 | |
1184 | }; | |
a5843056 | 1185 | static dispex_static_data_t HTMLWindow_dispex = { |
ef4200fc | 1186 | NULL, |
a5843056 JC |
1187 | DispHTMLWindow2_tid, |
1188 | NULL, | |
53f2cb83 | 1189 | HTMLWindow_iface_tids |
a5843056 JC |
1190 | }; |
1191 | ||
676d4af4 | 1192 | HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret) |
fb4980d6 | 1193 | { |
676d4af4 | 1194 | HTMLWindow *window; |
fb4980d6 | 1195 | |
676d4af4 JC |
1196 | window = heap_alloc_zero(sizeof(HTMLWindow)); |
1197 | if(!window) | |
1198 | return E_OUTOFMEMORY; | |
fb4980d6 | 1199 | |
676d4af4 JC |
1200 | window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl; |
1201 | window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl; | |
1202 | window->lpIDispatchExVtbl = &WindowDispExVtbl; | |
1203 | window->ref = 1; | |
1204 | window->doc = doc; | |
a5843056 | 1205 | |
676d4af4 | 1206 | init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex); |
fb4980d6 | 1207 | |
676d4af4 JC |
1208 | if(nswindow) { |
1209 | nsIDOMWindow_AddRef(nswindow); | |
1210 | window->nswindow = nswindow; | |
fb4980d6 JC |
1211 | } |
1212 | ||
676d4af4 | 1213 | list_add_head(&window_list, &window->entry); |
13f77846 | 1214 | |
676d4af4 JC |
1215 | *ret = window; |
1216 | return S_OK; | |
fb4980d6 JC |
1217 | } |
1218 | ||
0608054a | 1219 | HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow) |
fb4980d6 | 1220 | { |
13f77846 JC |
1221 | HTMLWindow *iter; |
1222 | ||
1223 | LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) { | |
1224 | if(iter->nswindow == nswindow) | |
1225 | return iter; | |
1226 | } | |
1227 | ||
fb4980d6 JC |
1228 | return NULL; |
1229 | } |