[winforms] Style
[mono.git] / mcs / class / Mono.WebBrowser / Mono.Mozilla / DOM / DocumentType.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) 2008 Novell, Inc.
21 //
22 // Authors:
23 //      Andreia Gaita (avidigal@novell.com)
24 //
25
26 using System;
27 using Mono.WebBrowser.DOM;
28
29 namespace Mono.Mozilla.DOM
30 {
31         internal class DocumentType : Node, IDocumentType
32         {
33                 internal nsIDOMDocumentType doctype;
34
35                 public DocumentType (WebBrowser control, nsIDOMDocumentType doctype)
36                         : base (control, doctype as nsIDOMNode)
37                 {
38                         if (control.platform != control.enginePlatform)
39                                 this.doctype = nsDOMDocumentType.GetProxy (control, doctype);
40                         else
41                                 this.doctype = doctype;
42                 }
43                 
44
45                 #region IDisposable Members
46                 protected override void Dispose (bool disposing)
47                 {
48                         if (!disposed) {
49                                 if (disposing) {
50                                         this.resources.Clear ();
51                                         this.doctype = null;
52                                 }
53                         }
54                         base.Dispose (disposing);
55                 }
56                 #endregion
57
58                 internal nsIDOMDocumentType ComObject
59                 {
60                         get { return doctype; }
61                 }
62                 
63                 #region IDocumentType
64                 public string Name {
65                         get {
66                                 doctype.getName (storage);
67                                 return Base.StringGet (storage);
68                         }
69                 }
70                 public INamedNodeMap Entities {
71                         get {
72                                 nsIDOMNamedNodeMap nodeMap;
73                                 doctype.getEntities (out nodeMap);
74                                 return new NamedNodeMap (this.control, nodeMap);
75                         }
76                 }
77                 public INamedNodeMap Notations {
78                         get {
79                                 nsIDOMNamedNodeMap nodeMap;
80                                 doctype.getNotations (out nodeMap);
81                                 return new NamedNodeMap (this.control, nodeMap);
82                         }
83                 }
84                 public string PublicId {
85                         get {
86                                 doctype.getPublicId (storage);
87                                 return Base.StringGet (storage);                                        
88                         }
89                 }
90                 public string SystemId {
91                         get {
92                                 doctype.getSystemId (storage);
93                                 return Base.StringGet (storage);                                        
94                         }
95                 }
96                 public string InternalSubset  {
97                         get {
98                                 doctype.getInternalSubset (storage);
99                                 return Base.StringGet (storage);                                        
100                         }
101                 }
102                 #endregion
103                 
104                 public override int GetHashCode () {
105                         return this.hashcode;
106                 }               
107
108         }
109 }