1 | using System;
|
---|
2 |
|
---|
3 | namespace SharpVectors.Dom.Events
|
---|
4 | {
|
---|
5 | /// <summary>
|
---|
6 | /// (DOM Level 2)
|
---|
7 | /// The Event interface is used to provide contextual information about an
|
---|
8 | /// event to the listener processing the event.
|
---|
9 | /// </summary>
|
---|
10 | /// <remarks>
|
---|
11 | /// An object which implements the <c>IEvent</c> interface is passed as
|
---|
12 | /// the parameter to an <see cref="EventListener">EventListener</see>.
|
---|
13 | /// More specific context information is passed to event listeners by
|
---|
14 | /// deriving additional interfaces from <see cref="IEvent">IEvent</see>
|
---|
15 | /// which contain information directly relating to the type of event
|
---|
16 | /// they represent. These derived interfaces are also implemented by
|
---|
17 | /// the object passed to the event listener.
|
---|
18 | /// </remarks>
|
---|
19 | public interface IEvent
|
---|
20 | {
|
---|
21 | #region Properties
|
---|
22 |
|
---|
23 | #region DOM Level 2
|
---|
24 |
|
---|
25 | /// <summary>
|
---|
26 | /// (DOM Level 2)
|
---|
27 | /// The name must be an
|
---|
28 | /// <see href="http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName">NCName</see>
|
---|
29 | /// as defined in
|
---|
30 | /// [<see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/references.html#Namespaces">XML Namespaces</see>]
|
---|
31 | /// and is case-sensitive.
|
---|
32 | /// </summary>
|
---|
33 | /// <remarks>
|
---|
34 | /// The character ":" (colon) should not be used in this attribute.
|
---|
35 | /// If the attribute <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
|
---|
36 | /// is different from <c>null</c>, this attribute represents a
|
---|
37 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-localname">local name</see>.
|
---|
38 | /// </remarks>
|
---|
39 | string Type
|
---|
40 | {
|
---|
41 | get;
|
---|
42 | }
|
---|
43 |
|
---|
44 | /// <summary>
|
---|
45 | /// (DOM Level 2)
|
---|
46 | /// Used to indicate the
|
---|
47 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-event-target">event target</see>.
|
---|
48 | /// </summary>
|
---|
49 | /// <remarks>
|
---|
50 | /// This attribute contains the
|
---|
51 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-target-node">target node</see>
|
---|
52 | /// when used with the
|
---|
53 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flow">DOM event flow</see>.
|
---|
54 | /// </remarks>
|
---|
55 | IEventTarget Target
|
---|
56 | {
|
---|
57 | get;
|
---|
58 | }
|
---|
59 |
|
---|
60 | /// <summary>
|
---|
61 | /// (DOM Level 2)
|
---|
62 | /// Used to indicate the <see cref="IEventTarget">IEventTarget</see>
|
---|
63 | /// whose <see cref="EventListener">EventListener</see>s are
|
---|
64 | /// currently being processed.
|
---|
65 | /// </summary>
|
---|
66 | /// <remarks>
|
---|
67 | /// This is particularly useful during the capture and bubbling
|
---|
68 | /// phases. This attribute could contain the
|
---|
69 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-target-node">target node</see>
|
---|
70 | /// or a target ancestor when used with the
|
---|
71 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flow">DOM event flow</see>.
|
---|
72 | /// </remarks>
|
---|
73 | IEventTarget CurrentTarget
|
---|
74 | {
|
---|
75 | get;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /// <summary>
|
---|
79 | /// (DOM Level 2)
|
---|
80 | /// Used to indicate which phase of event flow is currently being
|
---|
81 | /// accomplished.
|
---|
82 | /// </summary>
|
---|
83 | EventPhase EventPhase
|
---|
84 | {
|
---|
85 | get;
|
---|
86 | }
|
---|
87 |
|
---|
88 | /// <summary>
|
---|
89 | /// (DOM Level 2)
|
---|
90 | /// Used to indicate whether or not an event is a bubbling event.
|
---|
91 | /// </summary>
|
---|
92 | /// <remarks>
|
---|
93 | /// If the event can bubble the value is <c>true</c>, otherwise the
|
---|
94 | /// value is <c>false</c>.
|
---|
95 | /// </remarks>
|
---|
96 | bool Bubbles
|
---|
97 | {
|
---|
98 | get;
|
---|
99 | }
|
---|
100 |
|
---|
101 | /// <summary>
|
---|
102 | /// (DOM Level 2)
|
---|
103 | /// Used to indicate whether or not an event can have its default
|
---|
104 | /// action prevented.
|
---|
105 | /// </summary>
|
---|
106 | /// <remarks>
|
---|
107 | /// If the default action can be prevented the value is <c>true</c>,
|
---|
108 | /// otherwise the value is <c>false</c>.
|
---|
109 | /// </remarks>
|
---|
110 | /// <seealso href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flow-cancelation">Default actions and cancelable events</seealso>
|
---|
111 | bool Cancelable
|
---|
112 | {
|
---|
113 | get;
|
---|
114 | }
|
---|
115 |
|
---|
116 | /// <summary>
|
---|
117 | /// (DOM Level 2)
|
---|
118 | /// Used to specify the time at which the event was created.
|
---|
119 | /// </summary>
|
---|
120 | /// <remarks>
|
---|
121 | /// Due to the fact that some systems may not provide this information
|
---|
122 | /// the value of <see cref="TimeStamp">TimeStamp</see> may be not
|
---|
123 | /// available for all events. When not available, a value of <c>0</c>
|
---|
124 | /// will be returned. Examples of epoch time are the time of the
|
---|
125 | /// system start or 0:0:0 UTC 1st January 1970.
|
---|
126 | /// </remarks>
|
---|
127 | DateTime TimeStamp
|
---|
128 | {
|
---|
129 | get;
|
---|
130 | }
|
---|
131 |
|
---|
132 | #endregion
|
---|
133 |
|
---|
134 | #region DOM Level 3 Experimental
|
---|
135 |
|
---|
136 | /// <summary>
|
---|
137 | /// (DOM Level 3 Experimental)
|
---|
138 | /// The
|
---|
139 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-namespaceURI">namespace URI</see>
|
---|
140 | /// associated with this event at creation time, or <c>null</c> if it
|
---|
141 | /// is unspecified.
|
---|
142 | /// </summary>
|
---|
143 | /// <remarks>
|
---|
144 | /// For events initialized with a DOM Level 2 Events method, such as
|
---|
145 | /// <see cref="InitEvent">InitEvent</see>, this is always <c>null</c>.
|
---|
146 | /// </remarks>
|
---|
147 | string NamespaceUri
|
---|
148 | {
|
---|
149 | get;
|
---|
150 | }
|
---|
151 |
|
---|
152 | /// <summary>
|
---|
153 | /// (DOM Level 3 Experimental)
|
---|
154 | /// This method will always return <c>false</c>, unless the event
|
---|
155 | /// implements the <see cref="ICustomEvent">ICustomEvent</see>
|
---|
156 | /// interface.
|
---|
157 | /// </summary>
|
---|
158 | /// <value>
|
---|
159 | /// <c>true</c> if the event implements the
|
---|
160 | /// <see cref="ICustomEvent">ICustomEvent</see> interface.
|
---|
161 | /// <c>false</c> otherwise.
|
---|
162 | /// </value>
|
---|
163 | bool IsCustom
|
---|
164 | {
|
---|
165 | get;
|
---|
166 | }
|
---|
167 |
|
---|
168 | /// <summary>
|
---|
169 | /// (DOM Level 3 Experimental)
|
---|
170 | /// This method will return true if the method
|
---|
171 | /// <see cref="PreventDefault">PreventDefault</see> has been called
|
---|
172 | /// for this event, <c>false</c> otherwise.
|
---|
173 | /// </summary>
|
---|
174 | /// <value>
|
---|
175 | /// <c>true</c> if <see cref="PreventDefault">PreventDefault</see>
|
---|
176 | /// has been called for this event.
|
---|
177 | /// </value>
|
---|
178 | bool IsDefaultPrevented
|
---|
179 | {
|
---|
180 | get;
|
---|
181 | }
|
---|
182 |
|
---|
183 | #endregion
|
---|
184 |
|
---|
185 | #endregion
|
---|
186 |
|
---|
187 | #region Methods
|
---|
188 |
|
---|
189 | #region DOM Level 2
|
---|
190 |
|
---|
191 | /// <summary>
|
---|
192 | /// (DOM Level 2)
|
---|
193 | /// Prevent event listeners of the same group to be triggered.
|
---|
194 | /// </summary>
|
---|
195 | /// <remarks>
|
---|
196 | /// <para>
|
---|
197 | /// This method is used to prevent event listeners of the same group
|
---|
198 | /// to be triggered but its effect is differed until all event
|
---|
199 | /// listeners attached on the currentTarget have been triggered.
|
---|
200 | /// Once it has been called, further calls to that method
|
---|
201 | /// have no additional effect.
|
---|
202 | /// </para>
|
---|
203 | /// <para>
|
---|
204 | /// Note: This method does not prevent the default action
|
---|
205 | /// from being invoked; use preventDefault for that effect.
|
---|
206 | /// </para>
|
---|
207 | /// </remarks>
|
---|
208 | /// <seealso href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-propagation-and-groups">
|
---|
209 | /// Event propagation and event groups
|
---|
210 | /// </seealso>
|
---|
211 | void StopPropagation();
|
---|
212 |
|
---|
213 | /// <summary>
|
---|
214 | /// (DOM Level 2)
|
---|
215 | /// Signify that the event is to be canceled.
|
---|
216 | /// </summary>
|
---|
217 | /// <remarks>
|
---|
218 | /// <para>
|
---|
219 | /// If an event is cancelable, the
|
---|
220 | /// <see cref="PreventDefault">PreventDefault</see> method is used to
|
---|
221 | /// signify that the event is to be canceled, meaning any default
|
---|
222 | /// action normally taken by the implementation as a result of the
|
---|
223 | /// event will not occur and thus independently of event groups.
|
---|
224 | /// Calling this method for a non-cancelable event has no effect.
|
---|
225 | /// </para>
|
---|
226 | /// <para>
|
---|
227 | /// Note: This method does not stop the event propagation; use
|
---|
228 | /// <see cref="StopPropagation">StopPropagation</see> or
|
---|
229 | /// <see cref="StopImmediatePropagation">StopImmediatePropagation</see>
|
---|
230 | /// for that effect.
|
---|
231 | /// </para>
|
---|
232 | /// </remarks>
|
---|
233 | /// <seealso href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flow-cancelation">Default actions and cancelable events</seealso>
|
---|
234 | void PreventDefault();
|
---|
235 |
|
---|
236 | /// <summary>
|
---|
237 | /// (DOM Level 2)
|
---|
238 | /// The <see cref="InitEvent">InitEvent</see> method is used to initialize
|
---|
239 | /// the value of an <see cref="IEvent">IEvent</see> created through the
|
---|
240 | /// <see cref="IDocumentEvent.CreateEvent">IDocumentEvent.CreateEvent</see>
|
---|
241 | /// method.
|
---|
242 | /// </summary>
|
---|
243 | /// <remarks>
|
---|
244 | /// This method may only be called before the
|
---|
245 | /// <see cref="IEvent">IEvent</see> has been dispatched via the
|
---|
246 | /// <see cref="IEventTarget.DispatchEvent">IEventTarget.DispatchEvent</see>
|
---|
247 | /// method. If the method is called several times before invoking
|
---|
248 | /// <see cref="IEventTarget.DispatchEvent">IEventTarget.DispatchEvent</see>,
|
---|
249 | /// only the final invocation takes precedence. If called from a
|
---|
250 | /// subclass of <see cref="IEvent">Event</see> interface only the
|
---|
251 | /// values specified in this method are modified, all other
|
---|
252 | /// attributes are left unchanged. This method sets the
|
---|
253 | /// <see cref="IEvent.Type">IEvent.Type</see> attribute to
|
---|
254 | /// <c>eventTypeArg</c>, and
|
---|
255 | /// <see cref="IEvent.LocalName">IEvent.LocalName</see> and
|
---|
256 | /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
|
---|
257 | /// to <c>null</c>. To initialize an event with a local name and
|
---|
258 | /// namespace URI, use the
|
---|
259 | /// <see cref="InitEventNs">InitEventNs</see> method.
|
---|
260 | /// </remarks>
|
---|
261 | /// <param name="eventTypeArg">
|
---|
262 | /// Specifies the event type.
|
---|
263 | /// </param>
|
---|
264 | /// <param name="canBubbleArg">
|
---|
265 | /// Specifies whether or not the event can bubble. This parameter
|
---|
266 | /// overrides the intrinsic bubbling behavior of the event.
|
---|
267 | /// </param>
|
---|
268 | /// <param name="cancelableArg">
|
---|
269 | /// Specifies whether or not the event's default action can be
|
---|
270 | /// prevented. This parameter overrides the intrinsic cancelable
|
---|
271 | /// behavior of the event.
|
---|
272 | /// </param>
|
---|
273 | void InitEvent(
|
---|
274 | string eventTypeArg,
|
---|
275 | bool canBubbleArg,
|
---|
276 | bool cancelableArg);
|
---|
277 |
|
---|
278 | #endregion
|
---|
279 |
|
---|
280 | #region DOM Level 3 Experimental
|
---|
281 |
|
---|
282 | /// <summary>
|
---|
283 | /// (DOM Level 3 Experimental)
|
---|
284 | /// The <see>InitEventNs</see> method is used to initialize the value
|
---|
285 | /// of an <see cref="IEvent">IEvent</see> created through the
|
---|
286 | /// <see cref="IDocumentEvent">IDocumentEvent</see> interface.
|
---|
287 | /// </summary>
|
---|
288 | /// <remarks>
|
---|
289 | /// This method may only be called before the
|
---|
290 | /// <see cref="IEvent">IEvent</see> has been dispatched via the
|
---|
291 | /// <see cref="IEventTarget.DispatchEvent">IEventTarget.DispatchEvent</see>
|
---|
292 | /// method, though it may be called multiple times the event has been
|
---|
293 | /// dispatched. If called multiple times the final invocation takes
|
---|
294 | /// precedence. If a call to <see cref="InitEvent">InitEventNs</see>
|
---|
295 | /// is made after one of the <see cref="IEvent">IEvent</see> derived
|
---|
296 | /// interfaces' init methods has been called, only the values
|
---|
297 | /// specified in the <see cref="InitEvent">InitEventNs</see> method
|
---|
298 | /// are modified, all other attributes are left unchanged.
|
---|
299 | /// This method sets the <see cref="IEvent.Type">IEvent.Type</see>
|
---|
300 | /// attribute to <c>eventTypeArg</c>, and
|
---|
301 | /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see> to
|
---|
302 | /// <c>namespaceUriArg</c>.
|
---|
303 | /// </remarks>
|
---|
304 | /// <param name="namespaceUriArg">
|
---|
305 | /// Specifies the
|
---|
306 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-namespaceURI">namespace URI</see>
|
---|
307 | /// associated with this event, or <c>null</c> if no namespace.
|
---|
308 | /// </param>
|
---|
309 | /// <param name="eventTypeArg">
|
---|
310 | /// Specifies the
|
---|
311 | /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-localname">local name</see>
|
---|
312 | /// of the event type (see also the description of
|
---|
313 | /// <see cref="IEvent.Type">IEvent.Type</see>).
|
---|
314 | /// </param>
|
---|
315 | /// <param name="canBubbleArg">
|
---|
316 | /// Specifies whether or not the event can bubble.
|
---|
317 | /// </param>
|
---|
318 | /// <param name="cancelableArg">
|
---|
319 | /// Specifies whether or not the event's default action can be prevented.
|
---|
320 | /// </param>
|
---|
321 | void InitEventNs(
|
---|
322 | string namespaceUriArg,
|
---|
323 | string eventTypeArg,
|
---|
324 | bool canBubbleArg,
|
---|
325 | bool cancelableArg);
|
---|
326 |
|
---|
327 | /// <summary>
|
---|
328 | /// (DOM Level 3 Experimental)
|
---|
329 | /// Immediately prevent event listeners of the same group
|
---|
330 | /// to be triggered.
|
---|
331 | /// </summary>
|
---|
332 | /// <remarks>
|
---|
333 | /// <para>
|
---|
334 | /// This method is used to prevent event listeners of the same group
|
---|
335 | /// to be triggered and, unlike
|
---|
336 | /// <see cref="StopPropagation">StopPropagation</see> its effect is
|
---|
337 | /// immediate. Once it has been called, further calls to that method
|
---|
338 | /// have no additional effect.
|
---|
339 | /// </para>
|
---|
340 | /// <para>
|
---|
341 | /// Note: This method does not prevent the default action from being
|
---|
342 | /// invoked; use <see cref="PreventDefault">PreventDefault</see> for
|
---|
343 | /// that effect.
|
---|
344 | /// </para>
|
---|
345 | /// </remarks>
|
---|
346 | /// <seealso href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-propagation-and-groups">Event propagation and event groups</seealso>
|
---|
347 | void StopImmediatePropagation();
|
---|
348 |
|
---|
349 | #endregion
|
---|
350 |
|
---|
351 | #endregion
|
---|
352 | }
|
---|
353 | }
|
---|