Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorCore/Events/IEventTarget.cs @ 12762

Last change on this file since 12762 was 12762, checked in by aballeit, 9 years ago

#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)

File size: 12.7 KB
Line 
1using System;
2
3namespace SharpVectors.Dom.Events
4{
5  /// <summary>
6  /// The <see cref="IEventTarget">IEventTarget</see> interface is
7  /// implemented by all the objects which could be
8  /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-event-target">event targets</see>
9  /// in an implementation which supports the
10  /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flows">Event flows</see>.
11  /// </summary>
12  /// <remarks>
13  /// <para>
14  /// The interface allows registration, removal or query of event
15  /// listeners, and dispatch of events to an event target.
16  /// </para>
17  /// <para>
18  /// When used with
19  /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-flow">DOM event flow</see>,
20  /// this interface is implemented by all
21  /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-target-node">target nodes</see>
22  /// and target ancestors, i.e. all DOM <see cref="INode">INode</see>s of
23  /// the tree support this interface when the implementation conforms to
24  /// DOM Level 3 Events and, therefore, this interface can be obtained by
25  /// using binding-specific casting methods on an instance of the
26  /// <see cref="INode">Node</see> interface.
27  /// </para>
28  /// <para>
29  /// Invoking multiple times
30  /// <see cref="AddEventListener">AddEventListener</see> or
31  /// <see cref="AddEventListenerNs">AddEventListenerNs</see> on the same
32  /// <see cref="IEventTarget">IEventTarget</see> with the same parameters
33  /// (<c>namespaceUri</c>, <c>type</c>, <c>listener</c>, and
34  /// <c>useCapture</c>) is considered to be a no-op and thus independently
35  /// of the event group. They do not cause the
36  /// <see cref="EventListener">EventListener</see> to be called more
37  /// than once and do not cause a change in the triggering order. In order
38  /// to guarantee that an event listener will be added to the event target
39  /// for the specified event group, one needs to invoke
40  /// <see cref="RemoveEventListener">RemoveEventListener</see> or
41  /// <see cref="RemoveEventListenerNs">RemoveEventListenerNs</see> first.
42  /// </para>
43  /// </remarks>
44  public interface IEventTarget
45  {
46    #region Methods
47   
48    #region DOM Level 2
49   
50    /// <summary>
51    /// This method allows the registration of an event listener in the
52    /// default group and, depending on the <c>useCapture</c> parameter,
53    /// on the capture phase of the DOM event flow or its target and
54    /// bubbling phases. <see cref=" http://www.w3.org/TR/SVG/interact.html#SVGEvents"/>
55    /// </summary>
56    /// <param name="type">
57    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see> associated
58    /// with the event for which the user is registering.
59    /// </param>
60    /// <param name="listener">
61    /// The listener parameter takes an object implemented by the user
62    /// which implements the
63    /// <see cref="EventListener">EventListener</see> interface and
64    /// contains the method to be called when the event occurs.
65    /// </param>
66    /// <param name="useCapture">
67    /// If <c>true</c>, <c>useCapture</c> indicates that the user wishes
68    /// to add the event listener for the
69    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-capture-phase">capture phase</see>
70    /// only, i.e. this event listener will not be triggered during the
71    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-target-phase">target</see>
72    /// and
73    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-bubbling-phase">bubbling phases</see>.
74    /// If <c>false</c>, the event listener will only be triggered during the target and bubbling phases.
75    /// </param>
76    void AddEventListener(
77      string type,
78      EventListener listener,
79      bool useCapture);
80   
81    /// <summary>
82    /// This method allows the removal of event listeners from the default
83    /// group.
84    /// </summary>
85    /// <remarks>
86    /// Calling <see cref="RemoveEventListener">RemoveEventListener</see>
87    /// with arguments which do not identify any currently registered
88    /// <see cref="EventListener">EventListener</see> on the
89    /// <see cref="IEventTarget">IEventTarget</see> has no effect.
90    /// </remarks>
91    /// <param name="type">
92    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see> for which
93    /// the user registered the event listener.
94    /// </param>
95    /// <param name="listener">
96    /// The <see cref="EventListener">EventListener</see> to be removed.
97    /// </param>
98    /// <param name="useCapture">
99    /// Specifies whether the
100    /// <see cref="EventListener">EventListener</see> being removed was
101    /// registered for the capture phase or not. If a listener was
102    /// registered twice, once for the capture phase and once for the
103    /// target and bubbling phases, each must be removed separately.
104    /// Removal of an event listener registered for the capture phase does
105    /// not affect the same event listener registered for the target and
106    /// bubbling phases, and vice versa.
107    /// </param>
108    void RemoveEventListener(
109      string type,
110      EventListener listener,
111      bool useCapture);
112   
113    /// <summary>
114    /// This method allows the dispatch of events into the
115    /// implementation's event model.
116    /// </summary>
117    /// <remarks>
118    /// The
119    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-event-target">event target</see>
120    /// of the event is the <see cref="IEventTarget">IEventTarget</see>
121    /// object on which <see cref="DispatchEvent">DispatchEvent</see>
122    /// is called.
123    /// </remarks>
124    /// <param name="evt">
125    /// The event to be dispatched.
126    /// </param>
127    /// <returns>
128    /// Indicates whether any of the listeners which handled the event
129    /// called
130    /// <see cref="IEvent.PreventDefault">IEvent.PreventDefault</see>.
131    /// If <see cref="IEvent.PreventDefault">IEvent.PreventDefault</see>
132    /// was called the returned value is <c>false</c>, else it is
133    /// <c>true</c>.
134    /// </returns>
135    /// <exception cref="EventException">
136    /// <para>
137    /// UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event.type was not
138    /// specified by initializing the event before dispatchEvent was
139    /// called. Specification of the Event.type as null or an empty
140    /// string will also trigger this exception.
141    /// </para>
142    /// <para>
143    /// DISPATCH_REQUEST_ERR: Raised if the Event object is already being
144    /// dispatched in the tree.
145    /// </para>
146    /// <para>
147    /// NOT_SUPPORTED_ERR: Raised if the Event object has not been
148    /// created using DocumentEvent.createEvent or does not support the
149    /// interface CustomEvent.
150    /// </para>
151    /// </exception>
152    bool DispatchEvent(
153      IEvent evt);
154   
155    #endregion
156   
157    #region DOM Level 3 Experimental
158   
159    /// <summary>
160    /// This method allows the registration of an event listener in a
161    /// specified group or the default group and, depending on the
162    /// <c>useCapture</c> parameter, on the capture phase of the DOM
163    /// event flow or its target and bubbling phases.
164    /// </summary>
165    /// <param name="namespaceUri">
166    /// Specifies the
167    /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
168    /// associated with the event for which the user is registering.
169    /// </param>
170    /// <param name="type">
171    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see>
172    /// associated with the event for which the user is registering.
173    /// </param>
174    /// <param name="listener">
175    /// The <c>listener</c> parameter takes an object implemented by
176    /// the user which implements the
177    /// <see cref="EventListener">EventListener</see> interface and
178    /// contains the method to be called when the event occurs.
179    /// </param>
180    /// <param name="useCapture">
181    /// If <c>true</c>, <c>useCapture</c> indicates that the user wishes
182    /// to add the event listener for the
183    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-capture-phase">capture phase only</see>,
184    /// i.e. this event listener will not be triggered during the
185    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-target-phase">target</see>
186    /// and
187    /// <see href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/glossary.html#dt-bubbling-phase">bubbling phases</see>.
188    /// If <c>false</c>, the event listener will only be triggered
189    /// during the target and bubbling phases.
190    /// </param>
191    /// <param name="evtGroup">
192    /// The object that represents the event group to associate with the
193    /// <see cref="EventListener">EventListener</see>. Use <c>null</c> to
194    /// attach the event listener to the default group.
195    /// </param>
196    /// <seealso href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-propagation-and-groups">
197    /// Event propagation and event groups
198    /// </seealso>
199    void AddEventListenerNs(
200      string namespaceUri,
201      string type,
202      EventListener listener,
203      bool useCapture,
204      object evtGroup);
205   
206    /// <summary>
207    /// This method allows the removal of event listeners from a specified
208    /// group or the default group.
209    /// </summary>
210    /// <remarks>
211    /// Calling
212    /// <see cref="RemoveEventListenerNs">RemoveEventListenerNs</see> with
213    /// arguments which do not identify any currently registered
214    /// <see cref="EventListener">EventListener</see> on the EventTarget
215    /// has no effect.
216    /// </remarks>
217    /// <param name="namespaceUri">
218    /// Specifies the
219    /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
220    /// associated with the event for which the user registered the event
221    /// listener.
222    /// </param>
223    /// <param name="type">
224    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see> associated
225    /// with the event for which the user registered the event listener.
226    /// </param>
227    /// <param name="listener">
228    /// The <see cref="EventListener">EventListener</see> parameter
229    /// indicates the <see cref="EventListener">EventListener</see> to
230    /// be removed.
231    /// </param>
232    /// <param name="useCapture">
233    /// Specifies whether the
234    /// <see cref="EventListener">EventListener</see> being removed was
235    /// registered for the capture phase or not. If a listener was
236    /// registered twice, once for the capture phase and once for the
237    /// target and bubbling phases, each must be removed separately.
238    /// Removal of an event listener registered for the capture phase
239    /// does not affect the same event listener registered for the target
240    /// and bubbling phases, and vice versa.
241    /// </param>
242    void RemoveEventListenerNs(
243      string namespaceUri,
244      string type,
245      EventListener listener,
246      bool useCapture);
247   
248    /// <summary>
249    /// This method allows the DOM application to know if an event
250    /// listener, attached to this
251    /// <see cref="IEventTarget">IEventTarget</see> or one of its
252    /// ancestors, will be triggered by the specified event type during
253    /// the dispatch of the event to this event target or one of its
254    /// descendants.
255    /// </summary>
256    /// <param name="namespaceUri">
257    /// Specifies the
258    /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
259    /// associated with the event.
260    /// </param>
261    /// <param name="type">
262    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see>
263    /// associated with the event.
264    /// </param>
265    /// <returns>
266    /// <c>true</c> if an event listener will be triggered on the
267    /// <see cref="IEventTarget">IEventTarget</see> with the specified
268    /// event type, <c>false</c> otherwise.
269    /// </returns>
270    bool WillTriggerNs(
271      string namespaceUri,
272      string type);
273   
274    /// <summary>
275    /// This method allows the DOM application to know if this
276    /// <see cref="IEventTarget">IEventTarget</see> contains an event
277    /// listener registered for the specified event type.
278    /// </summary>
279    /// <remarks>
280    /// This is useful for determining at which nodes within a hierarchy
281    /// altered handling of specific event types has been introduced, but
282    /// should not be used to determine whether the specified event type
283    /// triggers an event listener.
284    /// </remarks>
285    /// <param name="namespaceUri">
286    /// Specifies the
287    /// <see cref="IEvent.NamespaceUri">IEvent.NamespaceUri</see>
288    /// associated with the event.
289    /// </param>
290    /// <param name="type">
291    /// Specifies the <see cref="IEvent.Type">IEvent.Type</see>
292    /// associated with the event.
293    /// </param>
294    /// <returns>
295    /// <c>true</c> if an event listener is registered on this
296    /// <see cref="IEventTarget">IEventTarget</see> for the specified
297    /// event type, <c>false</c> otherwise.
298    /// </returns>
299    /// <seealso cref="WillTriggerNs">WillTriggerNs</seealso>
300    bool HasEventListenerNs(
301      string namespaceUri,
302      string type);
303   
304    #endregion
305   
306    #endregion
307  }
308}
Note: See TracBrowser for help on using the repository browser.