1 | using System;
|
---|
2 |
|
---|
3 | namespace SharpVectors.Dom.Events
|
---|
4 | {
|
---|
5 | /// <summary>
|
---|
6 | /// Summary description for Event.
|
---|
7 | /// </summary>
|
---|
8 | public class Event : IEvent
|
---|
9 | {
|
---|
10 | #region Private Fields
|
---|
11 |
|
---|
12 | internal bool stopped = false;
|
---|
13 | internal IEventTarget eventTarget = null;
|
---|
14 | internal IEventTarget currentTarget = null;
|
---|
15 | internal EventPhase eventPhase = EventPhase.AtTarget;
|
---|
16 |
|
---|
17 | private bool bubbles;
|
---|
18 | private DateTime timeStamp = DateTime.Now;
|
---|
19 | private bool cancelable;
|
---|
20 | private string namespaceUri;
|
---|
21 | protected string eventType;
|
---|
22 |
|
---|
23 | #endregion
|
---|
24 |
|
---|
25 | #region Constructors
|
---|
26 |
|
---|
27 | public Event()
|
---|
28 | {
|
---|
29 | }
|
---|
30 |
|
---|
31 | public Event(
|
---|
32 | string eventType,
|
---|
33 | bool bubbles,
|
---|
34 | bool cancelable)
|
---|
35 | {
|
---|
36 | InitEvent(eventType, bubbles, cancelable);
|
---|
37 | }
|
---|
38 |
|
---|
39 | public Event(
|
---|
40 | string namespaceUri,
|
---|
41 | string eventType,
|
---|
42 | bool bubbles,
|
---|
43 | bool cancelable)
|
---|
44 | {
|
---|
45 | InitEventNs(namespaceUri, eventType, bubbles, cancelable);
|
---|
46 | }
|
---|
47 |
|
---|
48 | #endregion
|
---|
49 |
|
---|
50 | #region Properties
|
---|
51 |
|
---|
52 | #region DOM Level 2
|
---|
53 |
|
---|
54 | public string Type
|
---|
55 | {
|
---|
56 | get
|
---|
57 | {
|
---|
58 | return eventType;
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | public IEventTarget Target
|
---|
63 | {
|
---|
64 | get
|
---|
65 | {
|
---|
66 | return eventTarget;
|
---|
67 | }
|
---|
68 | }
|
---|
69 |
|
---|
70 | public IEventTarget CurrentTarget
|
---|
71 | {
|
---|
72 | get
|
---|
73 | {
|
---|
74 | return currentTarget;
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | public EventPhase EventPhase
|
---|
79 | {
|
---|
80 | get
|
---|
81 | {
|
---|
82 | return eventPhase;
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | public bool Bubbles
|
---|
87 | {
|
---|
88 | get
|
---|
89 | {
|
---|
90 | return bubbles;
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | public bool Cancelable
|
---|
95 | {
|
---|
96 | get
|
---|
97 | {
|
---|
98 | return cancelable;
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | public DateTime TimeStamp
|
---|
103 | {
|
---|
104 | get
|
---|
105 | {
|
---|
106 | return timeStamp;
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | #endregion
|
---|
111 |
|
---|
112 | #region DOM Level 3 Experimental
|
---|
113 |
|
---|
114 | public string NamespaceUri
|
---|
115 | {
|
---|
116 | get
|
---|
117 | {
|
---|
118 | return namespaceUri;
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | public bool IsCustom
|
---|
123 | {
|
---|
124 | get
|
---|
125 | {
|
---|
126 | throw new NotImplementedException();
|
---|
127 | }
|
---|
128 | }
|
---|
129 |
|
---|
130 | public bool IsDefaultPrevented
|
---|
131 | {
|
---|
132 | get
|
---|
133 | {
|
---|
134 | throw new NotImplementedException();
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | #endregion
|
---|
139 |
|
---|
140 | #endregion
|
---|
141 |
|
---|
142 | #region Methods
|
---|
143 |
|
---|
144 | #region DOM Level 2
|
---|
145 |
|
---|
146 | public void StopPropagation()
|
---|
147 | {
|
---|
148 | throw new NotImplementedException();
|
---|
149 | }
|
---|
150 |
|
---|
151 | public void PreventDefault()
|
---|
152 | {
|
---|
153 | throw new NotImplementedException();
|
---|
154 | }
|
---|
155 |
|
---|
156 | public void InitEvent(
|
---|
157 | string eventType,
|
---|
158 | bool bubbles,
|
---|
159 | bool cancelable)
|
---|
160 | {
|
---|
161 | this.namespaceUri = null;
|
---|
162 | this.eventType = eventType;
|
---|
163 | this.bubbles = bubbles;
|
---|
164 | this.cancelable = cancelable;
|
---|
165 | }
|
---|
166 |
|
---|
167 | #endregion
|
---|
168 |
|
---|
169 | #region DOM Level 3 Experimental
|
---|
170 |
|
---|
171 | public void InitEventNs(
|
---|
172 | string namespaceUri,
|
---|
173 | string eventType,
|
---|
174 | bool bubbles,
|
---|
175 | bool cancelable)
|
---|
176 | {
|
---|
177 | this.namespaceUri = namespaceUri == "" ? null : namespaceUri;
|
---|
178 | this.eventType = eventType;
|
---|
179 | this.bubbles = bubbles;
|
---|
180 | this.cancelable = cancelable;
|
---|
181 | }
|
---|
182 |
|
---|
183 | public void StopImmediatePropagation()
|
---|
184 | {
|
---|
185 | throw new NotImplementedException();
|
---|
186 | }
|
---|
187 |
|
---|
188 | #endregion
|
---|
189 |
|
---|
190 | #endregion
|
---|
191 | }
|
---|
192 | }
|
---|