2008-10-09 22:36:01 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
2009-09-08 22:30:14 +02:00
|
|
|
EVENTID_BEFOREUNLOAD,
|
2008-10-10 22:49:09 +02:00
|
|
|
EVENTID_BLUR,
|
2008-10-09 22:36:01 +02:00
|
|
|
EVENTID_CHANGE,
|
|
|
|
EVENTID_CLICK,
|
2010-05-07 15:20:33 +02:00
|
|
|
EVENTID_CONTEXTMENU,
|
2009-09-08 22:32:47 +02:00
|
|
|
EVENTID_DBLCLICK,
|
2008-10-10 22:49:09 +02:00
|
|
|
EVENTID_DRAG,
|
2008-10-10 22:49:25 +02:00
|
|
|
EVENTID_DRAGSTART,
|
2008-10-10 22:49:09 +02:00
|
|
|
EVENTID_FOCUS,
|
2008-10-10 22:49:16 +02:00
|
|
|
EVENTID_KEYDOWN,
|
2008-10-09 22:36:01 +02:00
|
|
|
EVENTID_KEYUP,
|
|
|
|
EVENTID_LOAD,
|
2008-10-10 22:49:16 +02:00
|
|
|
EVENTID_MOUSEDOWN,
|
2011-02-21 10:23:48 +01:00
|
|
|
EVENTID_MOUSEMOVE,
|
2008-10-10 22:49:33 +02:00
|
|
|
EVENTID_MOUSEOUT,
|
2008-10-10 22:46:08 +02:00
|
|
|
EVENTID_MOUSEOVER,
|
2008-10-10 22:49:16 +02:00
|
|
|
EVENTID_MOUSEUP,
|
2008-10-10 22:49:09 +02:00
|
|
|
EVENTID_PASTE,
|
2009-09-14 00:35:40 +02:00
|
|
|
EVENTID_READYSTATECHANGE,
|
2009-12-07 23:28:10 +01:00
|
|
|
EVENTID_RESIZE,
|
2008-10-10 22:49:25 +02:00
|
|
|
EVENTID_SELECTSTART,
|
2011-02-28 13:13:49 +01:00
|
|
|
EVENTID_SUBMIT,
|
2008-10-09 22:36:01 +02:00
|
|
|
EVENTID_LAST
|
|
|
|
} eventid_t;
|
|
|
|
|
|
|
|
eventid_t str_to_eid(LPCWSTR);
|
2009-09-16 22:13:31 +02:00
|
|
|
void check_event_attr(HTMLDocumentNode*,nsIDOMElement*);
|
2008-10-09 22:36:01 +02:00
|
|
|
void release_event_target(event_target_t*);
|
2010-03-18 01:04:45 +01:00
|
|
|
void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*);
|
2010-03-18 01:05:38 +01:00
|
|
|
HRESULT set_event_handler(event_target_t**,nsIDOMNode*,HTMLDocumentNode*,eventid_t,VARIANT*);
|
2008-10-10 22:46:32 +02:00
|
|
|
HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*);
|
2010-03-18 01:05:38 +01:00
|
|
|
HRESULT attach_event(event_target_t**,nsIDOMNode*,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
|
2010-02-08 21:49:37 +01:00
|
|
|
HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*);
|
2009-10-13 00:42:02 +02:00
|
|
|
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*);
|
2009-10-13 00:42:22 +02:00
|
|
|
HRESULT call_event(HTMLDOMNode*,eventid_t);
|
2010-03-18 01:05:38 +01:00
|
|
|
void update_cp_events(HTMLWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*);
|
2008-10-10 22:46:20 +02:00
|
|
|
|
2009-09-08 22:29:39 +02:00
|
|
|
static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
|
|
|
|
{
|
|
|
|
return node->vtbl->get_event_target ? node->vtbl->get_event_target(node) : &node->event_target;
|
|
|
|
}
|
|
|
|
|
2008-10-10 22:46:20 +02:00
|
|
|
static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
|
|
|
{
|
2010-03-18 01:05:38 +01:00
|
|
|
return set_event_handler(get_node_event_target(node), node->nsnode, node->doc, eid, var);
|
2008-10-10 22:46:20 +02:00
|
|
|
}
|
|
|
|
|
2008-10-10 22:46:32 +02:00
|
|
|
static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
|
|
|
{
|
2009-09-08 22:29:39 +02:00
|
|
|
return get_event_handler(get_node_event_target(node), eid, var);
|
2008-10-10 22:46:32 +02:00
|
|
|
}
|
|
|
|
|
2008-10-10 22:46:20 +02:00
|
|
|
static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
|
|
|
|
{
|
2009-09-16 22:14:55 +02:00
|
|
|
return set_node_event(&doc->doc_node->node, eid, var);
|
2008-10-10 22:46:20 +02:00
|
|
|
}
|
2008-10-10 22:46:32 +02:00
|
|
|
|
|
|
|
static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
|
|
|
|
{
|
2009-09-16 22:14:55 +02:00
|
|
|
return get_node_event(&doc->doc_node->node, eid, var);
|
2008-10-10 22:46:32 +02:00
|
|
|
}
|