* Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs,
[mono.git] / mcs / class / Mono.WebBrowser / Mono.WebBrowser / DOM / INode.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2007, 2008 Novell, Inc.
21 //
22 // Authors:
23 //      Andreia Gaita (avidigal@novell.com)
24 //
25
26 using System;
27
28 namespace Mono.WebBrowser.DOM
29 {
30         public interface INode
31         {
32                 IAttributeCollection Attributes { get; }
33                 INodeList       ChildNodes { get; }
34                 INode           FirstChild { get; }
35                 INode           InsertBefore (INode newChild, INode refChild);
36                 INode           ReplaceChild (INode newChild, INode oldChild);
37                 INode           RemoveChild (INode child);
38                 INode           AppendChild (INode child);
39                 INode           LastChild { get; }
40                 string          LocalName { get; }
41                 INode           Next { get; }
42                 IDocument       Owner { get; }
43                 INode           Parent {get;}
44                 INode           Previous { get; }
45                 NodeType        Type { get;}
46                 string          Value {get; set;}
47                 IntPtr          AccessibleObject {get;}
48                 
49                 void FireEvent  (string eventName);
50                 int             GetHashCode ();
51                 bool                            Equals (object obj);
52                 
53                 void AttachEventHandler (string eventName, EventHandler handler);
54                 void DetachEventHandler (string eventName, EventHandler handler);
55                 
56                 /// <summary>
57                 /// Attach a generic handler for events. The delegate needs to conform to the EventHandler signature, 
58                 /// i.e., be in the form (object sender, EventArgs e)
59                 /// </summary>
60                 /// <param name="eventName">
61                 /// A <see cref="System.String"/> with the name of the event to listen for.
62                 /// </param>
63                 /// <param name="handler">
64                 /// A <see cref="System.Delegate"/> conforming to the EventHandler signature. 
65                 /// It will throw an exception if the delegate is not of the format (object sender, EventArgs e).
66                 /// </param>
67                 void AttachEventHandler (string eventName, System.Delegate handler);
68                 void DetachEventHandler (string eventName, System.Delegate handler);
69
70                 event NodeEventHandler Click;
71                 event NodeEventHandler DoubleClick;
72                 event NodeEventHandler KeyDown;
73                 event NodeEventHandler KeyPress;
74                 event NodeEventHandler KeyUp;
75                 event NodeEventHandler MouseDown;
76                 event NodeEventHandler MouseEnter;
77                 event NodeEventHandler MouseLeave;
78                 event NodeEventHandler MouseMove;
79                 event NodeEventHandler MouseOver;
80                 event NodeEventHandler MouseUp;
81                 event NodeEventHandler OnFocus;
82                 event NodeEventHandler OnBlur;
83         }
84         
85         public enum NodeType
86         {
87                 Element       = 1,
88                 Attribute     = 2,
89                 Text          = 3,
90                 CDataSection  = 4,
91                 EntityReference = 5,
92                 Entity       = 6,
93                 ProcessingInstruction = 7,
94                 Comment       = 8,
95                 Document      = 9,
96                 DocumentType = 10,
97                 DocumentFragment = 11,
98                 Notation      = 12
99         }
100 }