1 | using System;
|
---|
2 |
|
---|
3 | namespace SharpVectors.Dom.Events
|
---|
4 | {
|
---|
5 | /// <summary>
|
---|
6 | /// The <see cref="IDocumentEvent">IDocumentEvent</see> interface provides
|
---|
7 | /// a mechanism by which the user can create an
|
---|
8 | /// <see cref="IEvent">IEvent</see> object of a type supported by the
|
---|
9 | /// implementation. It is expected that the
|
---|
10 | /// <see cref="IDocumentEvent">IDocumentEvent</see> interface will be
|
---|
11 | /// implemented on the same object which implements the
|
---|
12 | /// <see cref="IDocument">IDocument</see> interface in an implementation
|
---|
13 | /// which supports the <see cref="IEvent">IEvent</see> model.
|
---|
14 | /// </summary>
|
---|
15 | public interface IDocumentEvent
|
---|
16 | {
|
---|
17 | #region Methods
|
---|
18 |
|
---|
19 | #region DOM Level 2
|
---|
20 |
|
---|
21 | /// <summary>
|
---|
22 | /// The <see cref="CreateEvent">CreateEvent</see> method is used in
|
---|
23 | /// creating <see cref="IEvent">IEvent</see>s when it is either
|
---|
24 | /// inconvenient or unnecessary for the user to create an
|
---|
25 | /// <see cref="IEvent">IEvent</see> themselves.
|
---|
26 | /// </summary>
|
---|
27 | /// <remarks>
|
---|
28 | /// <para>
|
---|
29 | /// In cases where the implementation provided
|
---|
30 | /// <see cref="IEvent">IEvent</see> is insufficient, users may supply
|
---|
31 | /// their own <see cref="IEvent">IEvent</see> implementations for use
|
---|
32 | /// with the
|
---|
33 | /// <see cref="IEventTarget.DispatchEvent">IEventTarget.DispatchEvent</see>
|
---|
34 | /// method. However, the DOM implementation needs access to the
|
---|
35 | /// attributes
|
---|
36 | /// <see cref="IEvent.CurrentTarget">IEvent.CurrentTarget</see> and
|
---|
37 | /// <see cref="IEvent.EventPhase">IEvent.EventPhase</see> to propagate
|
---|
38 | /// appropriately the event in the DOM tree. Therefore users'
|
---|
39 | /// <see cref="IEvent">IEvent</see> implementations might need to
|
---|
40 | /// support the <see cref="ICustomEvent">ICustomEvent</see> interface
|
---|
41 | /// for that effect.
|
---|
42 | /// </para>
|
---|
43 | /// <para>
|
---|
44 | /// Note: For backward compatibility reason, <c>"UIEvents"</c>,
|
---|
45 | /// <c>"MouseEvents"</c>, <c>"MutationEvents"</c>, and
|
---|
46 | /// <c>"HTMLEvents"</c> feature names are valid values for the
|
---|
47 | /// parameter <c>eventType</c> and represent respectively the
|
---|
48 | /// interfaces <c>"UIEvent"</c>, <c>"MouseEvent"</c>,
|
---|
49 | /// <c>"MutationEvent"</c>, and <c>"Event"</c>.
|
---|
50 | /// </para>
|
---|
51 | /// </remarks>
|
---|
52 | /// <param name="eventType">
|
---|
53 | /// The <c>eventType</c> parameter specifies the name of the DOM
|
---|
54 | /// Events interface to be supported by the created event object, e.g.
|
---|
55 | /// <c>"Event"</c>, <c>"MouseEvent"</c>, <c>"MutationEvent"</c> ...
|
---|
56 | /// If the <see cref="IEvent">IEvent</see> is to be dispatched via the
|
---|
57 | /// <see cref="IEventTarget.DispatchEvent">IEventTarget.DispatchEvent</see>
|
---|
58 | /// method the appropriate event init method must be called after
|
---|
59 | /// creation in order to initialize the <see cref="IEvent">IEvent</see>'s
|
---|
60 | /// values. As an example, a user wishing to synthesize some kind of
|
---|
61 | /// <see cref="IUiEvent">IUiEvent</see> would call
|
---|
62 | /// <see cref="IDocumentEvent.CreateEvent">IDocumentEvent.CreateEvent</see>
|
---|
63 | /// with the parameter <c>"UIEvent"</c>. The
|
---|
64 | /// <see cref="IUiEvent.InitUiEventNs">IUiEvent.InitUiEventNs</see>
|
---|
65 | /// method could then be called on the newly created
|
---|
66 | /// <see cref="IUiEvent">IUiEvent</see> object to set the specific
|
---|
67 | /// type of user interface event to be dispatched,
|
---|
68 | /// {<c>"http://www.w3.org/2001/xml-events"</c>,
|
---|
69 | /// <c>"DOMActivate"</c>} for example, and set its context
|
---|
70 | /// information, e.g.
|
---|
71 | /// <see cref="IUiEvent.Detail">IUiEvent.Detail</see> in this example.
|
---|
72 | /// </param>
|
---|
73 | /// <returns>
|
---|
74 | /// The newly created event object.
|
---|
75 | /// </returns>
|
---|
76 | /// <exception cref="DomException">
|
---|
77 | /// NOT_SUPPORTED_ERR: Raised if the implementation does not support
|
---|
78 | /// the <see cref="IEvent">Event</see> interface requested.
|
---|
79 | /// </exception>
|
---|
80 | IEvent CreateEvent(
|
---|
81 | string eventType);
|
---|
82 |
|
---|
83 | #endregion
|
---|
84 |
|
---|
85 | #region DOM Level 3 Experimental
|
---|
86 |
|
---|
87 | /// <summary>
|
---|
88 | /// Test if the implementation can generate events of a specified type.
|
---|
89 | /// </summary>
|
---|
90 | /// <param name="namespaceUri">
|
---|
91 | /// Specifies the
|
---|
92 | /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see> of the
|
---|
93 | /// event.
|
---|
94 | /// </param>
|
---|
95 | /// <param name="type">
|
---|
96 | /// Specifies the <see cref="IEvent.Type">IEvent.Type</see> of the
|
---|
97 | /// event.
|
---|
98 | /// </param>
|
---|
99 | /// <returns>
|
---|
100 | /// <c>true</c> if the implementation can generate and dispatch this
|
---|
101 | /// event type, <c>false</c> otherwise.
|
---|
102 | /// </returns>
|
---|
103 | bool CanDispatch(
|
---|
104 | string namespaceUri,
|
---|
105 | string type);
|
---|
106 |
|
---|
107 | #endregion
|
---|
108 |
|
---|
109 | #endregion
|
---|
110 | }
|
---|
111 | }
|
---|