mshtml: Added IHTMLWindow2::onbeforeunload property implementation.

This commit is contained in:
Jacek Caban 2009-09-08 22:30:14 +02:00 committed by Alexandre Julliard
parent b481b09248
commit c7496aee8f
3 changed files with 23 additions and 4 deletions

View File

@ -42,6 +42,9 @@ struct event_target_t {
handler_vector_t *event_table[EVENTID_LAST];
};
static const WCHAR beforeunloadW[] = {'b','e','f','o','r','e','u','n','l','o','a','d',0};
static const WCHAR onbeforeunloadW[] = {'o','n','b','e','f','o','r','e','u','n','l','o','a','d',0};
static const WCHAR blurW[] = {'b','l','u','r',0};
static const WCHAR onblurW[] = {'o','n','b','l','u','r',0};
@ -97,6 +100,7 @@ typedef struct {
#define EVENT_BUBBLE 0x0002
static const event_info_t event_info[] = {
{beforeunloadW, onbeforeunloadW, EVENT_DEFAULTLISTENER},
{blurW, onblurW, EVENT_DEFAULTLISTENER},
{changeW, onchangeW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
{clickW, onclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},

View File

@ -17,6 +17,7 @@
*/
typedef enum {
EVENTID_BEFOREUNLOAD,
EVENTID_BLUR,
EVENTID_CHANGE,
EVENTID_CLICK,
@ -67,3 +68,13 @@ static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *v
{
return get_event_handler(&doc->event_target, eid, var);
}
static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
{
return set_event_handler(&window->event_target, window->doc, eid, var);
}
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
{
return get_event_handler(&window->event_target, eid, var);
}

View File

@ -512,15 +512,19 @@ static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
return E_NOTIMPL;
TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
return set_window_event(This, EVENTID_BEFOREUNLOAD, &v);
}
static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return get_window_event(This, EVENTID_BEFOREUNLOAD, p);
}
static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)