1 | | Entity and e.g. projectile classes derive from this and use it for sending/receiving events. |
2 | | |
3 | | = IEventTarget Methods = |
4 | | |
5 | | |
6 | | == !SetPriorObject == |
7 | | * '''Overview:''' |
8 | | * Set target that will receive each event before it is processed. |
9 | | * '''Syntax:''' |
10 | | * !SetPriorObject(event_target); |
11 | | * '''Parameters:''' |
12 | | * target object [IEventTarget*] |
13 | | * '''Returns:''' |
14 | | * |
15 | | * '''Notes:''' |
16 | | * Unused. |
17 | | |
18 | | |
19 | | == !SetNextObject == |
20 | | * '''Overview:''' |
21 | | * Set target that will receive each event after it is processed. |
22 | | * '''Syntax:''' |
23 | | * !SetNextObject(event_target); |
24 | | * '''Parameters:''' |
25 | | * target object [IEventTarget*] |
26 | | * '''Returns:''' |
27 | | * |
28 | | * '''Notes:''' |
29 | | * Used by Entity and !BaseEntity. |
30 | | |
31 | | |
32 | | == !AddHandler == |
33 | | * '''Overview:''' |
34 | | * Register a handler for the given event type. |
35 | | * '''Syntax:''' |
36 | | * added = !AddHandler(type, handler); |
37 | | * '''Parameters:''' |
38 | | * type [int or CStrW], handler [DOMEventHandler] |
39 | | * '''Returns:''' |
40 | | * whether it was actually newly registered [bool] |
41 | | * '''Notes:''' |
42 | | * |
43 | | |
44 | | |
45 | | == !RemoveHandler == |
46 | | * '''Overview:''' |
47 | | * Remove a previously registered handler for the specified event. |
48 | | * '''Syntax:''' |
49 | | * removed = !RemoveHandler(type, handler); |
50 | | * '''Parameters:''' |
51 | | * type [int or CStrW], handler [DOMEventHandler] |
52 | | * '''Returns:''' |
53 | | * whether it was successfully removed [bool] |
54 | | * '''Notes:''' |
55 | | * |
56 | | |
57 | | |
58 | | == !AddHandlerJS == |
59 | | == !RemoveHandlerJS == |
60 | | Perform the same function as Add|!RemoveHandler above; called by !ScriptGlue.cpp for add|!RemoveGlobalHandler |
61 | | |
62 | | |
63 | | == !GetScriptExecContext == |
64 | | * '''Overview:''' |
65 | | * Return the JSObject* we'd like to be the 'this' object when executing the handler. |
66 | | * '''Syntax:''' |
67 | | * _this = !GetScriptExecContext(target); |
68 | | * '''Parameters:''' |
69 | | * target of the current event [IEventTarget*] |
70 | | * '''Returns:''' |
71 | | * JS 'this' [JSObject*] |
72 | | * '''Notes:''' |
73 | | * Passed to CScriptObject::!DispatchEvent. |
74 | | |
75 | | |
76 | | == !DispatchEvent == |
77 | | * '''Overview:''' |
78 | | * Dispatch an event to its handler. |
79 | | * '''Syntax:''' |
80 | | * !DispatchEvent( &evt ); |
81 | | * '''Parameters:''' |
82 | | * Event [CScriptEvent*] |
83 | | * '''Returns:''' |
84 | | * whether the event arrived (i.e. wasn't cancelled) [bool] |
85 | | * '''Notes:''' |
86 | | * |