xref: /reactos/dll/win32/mshtml/htmlevent.h (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * Copyright 2008 Jacek Caban for CodeWeavers
3*c2c66affSColin Finck  *
4*c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
5*c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
6*c2c66affSColin Finck  * License as published by the Free Software Foundation; either
7*c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
8*c2c66affSColin Finck  *
9*c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
10*c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*c2c66affSColin Finck  * Lesser General Public License for more details.
13*c2c66affSColin Finck  *
14*c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
15*c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
16*c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17*c2c66affSColin Finck  */
18*c2c66affSColin Finck 
19*c2c66affSColin Finck #pragma once
20*c2c66affSColin Finck 
21*c2c66affSColin Finck typedef enum {
22*c2c66affSColin Finck     EVENTID_ABORT,
23*c2c66affSColin Finck     EVENTID_BEFOREUNLOAD,
24*c2c66affSColin Finck     EVENTID_BLUR,
25*c2c66affSColin Finck     EVENTID_CHANGE,
26*c2c66affSColin Finck     EVENTID_CLICK,
27*c2c66affSColin Finck     EVENTID_CONTEXTMENU,
28*c2c66affSColin Finck     EVENTID_DATAAVAILABLE,
29*c2c66affSColin Finck     EVENTID_DBLCLICK,
30*c2c66affSColin Finck     EVENTID_DRAG,
31*c2c66affSColin Finck     EVENTID_DRAGSTART,
32*c2c66affSColin Finck     EVENTID_ERROR,
33*c2c66affSColin Finck     EVENTID_FOCUS,
34*c2c66affSColin Finck     EVENTID_FOCUSIN,
35*c2c66affSColin Finck     EVENTID_HELP,
36*c2c66affSColin Finck     EVENTID_KEYDOWN,
37*c2c66affSColin Finck     EVENTID_KEYPRESS,
38*c2c66affSColin Finck     EVENTID_KEYUP,
39*c2c66affSColin Finck     EVENTID_LOAD,
40*c2c66affSColin Finck     EVENTID_MOUSEDOWN,
41*c2c66affSColin Finck     EVENTID_MOUSEMOVE,
42*c2c66affSColin Finck     EVENTID_MOUSEOUT,
43*c2c66affSColin Finck     EVENTID_MOUSEOVER,
44*c2c66affSColin Finck     EVENTID_MOUSEUP,
45*c2c66affSColin Finck     EVENTID_MOUSEWHEEL,
46*c2c66affSColin Finck     EVENTID_PASTE,
47*c2c66affSColin Finck     EVENTID_READYSTATECHANGE,
48*c2c66affSColin Finck     EVENTID_RESIZE,
49*c2c66affSColin Finck     EVENTID_SCROLL,
50*c2c66affSColin Finck     EVENTID_SELECTSTART,
51*c2c66affSColin Finck     EVENTID_SUBMIT,
52*c2c66affSColin Finck     EVENTID_LAST
53*c2c66affSColin Finck } eventid_t;
54*c2c66affSColin Finck 
55*c2c66affSColin Finck eventid_t str_to_eid(LPCWSTR) DECLSPEC_HIDDEN;
56*c2c66affSColin Finck void check_event_attr(HTMLDocumentNode*,nsIDOMHTMLElement*) DECLSPEC_HIDDEN;
57*c2c66affSColin Finck void release_event_target(event_target_t*) DECLSPEC_HIDDEN;
58*c2c66affSColin Finck void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN;
59*c2c66affSColin Finck HRESULT set_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
60*c2c66affSColin Finck HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
61*c2c66affSColin Finck HRESULT attach_event(EventTarget*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
62*c2c66affSColin Finck HRESULT detach_event(EventTarget*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
63*c2c66affSColin Finck HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
64*c2c66affSColin Finck HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
65*c2c66affSColin Finck void update_doc_cp_events(HTMLDocumentNode*,cp_static_data_t*) DECLSPEC_HIDDEN;
66*c2c66affSColin Finck HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
67*c2c66affSColin Finck void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN;
68*c2c66affSColin Finck HRESULT create_event_obj(IHTMLEventObj**) DECLSPEC_HIDDEN;
69*c2c66affSColin Finck void bind_target_event(HTMLDocumentNode*,EventTarget*,const WCHAR*,IDispatch*) DECLSPEC_HIDDEN;
70*c2c66affSColin Finck HRESULT ensure_doc_nsevent_handler(HTMLDocumentNode*,eventid_t) DECLSPEC_HIDDEN;
71*c2c66affSColin Finck 
72*c2c66affSColin Finck typedef struct HTMLEventObj HTMLEventObj;
73*c2c66affSColin Finck void call_event_handlers(HTMLDocumentNode*,HTMLEventObj*,EventTarget*,ConnectionPointContainer*,eventid_t,IDispatch*);
74*c2c66affSColin Finck 
75*c2c66affSColin Finck void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
76*c2c66affSColin Finck void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
77*c2c66affSColin Finck void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR) DECLSPEC_HIDDEN;
78*c2c66affSColin Finck void detach_nsevent(HTMLDocumentNode*,const WCHAR*) DECLSPEC_HIDDEN;
79*c2c66affSColin Finck 
set_node_event(HTMLDOMNode * node,eventid_t eid,VARIANT * var)80*c2c66affSColin Finck static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
81*c2c66affSColin Finck {
82*c2c66affSColin Finck     return set_event_handler(&node->event_target, eid, var);
83*c2c66affSColin Finck }
84*c2c66affSColin Finck 
get_node_event(HTMLDOMNode * node,eventid_t eid,VARIANT * var)85*c2c66affSColin Finck static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
86*c2c66affSColin Finck {
87*c2c66affSColin Finck     return get_event_handler(&node->event_target, eid, var);
88*c2c66affSColin Finck }
89*c2c66affSColin Finck 
set_doc_event(HTMLDocument * doc,eventid_t eid,VARIANT * var)90*c2c66affSColin Finck static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
91*c2c66affSColin Finck {
92*c2c66affSColin Finck     return set_node_event(&doc->doc_node->node, eid, var);
93*c2c66affSColin Finck }
94*c2c66affSColin Finck 
get_doc_event(HTMLDocument * doc,eventid_t eid,VARIANT * var)95*c2c66affSColin Finck static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
96*c2c66affSColin Finck {
97*c2c66affSColin Finck     return get_node_event(&doc->doc_node->node, eid, var);
98*c2c66affSColin Finck }
99