Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/DOMDocument.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2008 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
2 * Port to the D programming language: | 11 * Port to the D programming language: |
3 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
4 *******************************************************************************/ | 13 *******************************************************************************/ |
5 module dwt.internal.cocoa.DOMDocument; | 14 module dwt.internal.cocoa.DOMDocument; |
6 | 15 |
16 import dwt.dwthelper.utils; | |
17 import cocoa = dwt.internal.cocoa.id; | |
7 import dwt.internal.cocoa.NSObject; | 18 import dwt.internal.cocoa.NSObject; |
8 import dwt.internal.cocoa.NSString; | 19 import dwt.internal.cocoa.OS; |
9 import dwt.internal.cocoa.WebFrame; | 20 import dwt.internal.cocoa.WebFrame; |
10 import dwt.internal.cocoa.OS; | 21 import objc = dwt.internal.objc.runtime; |
11 import objc = dwt.internal.objc.objc : id; | |
12 | 22 |
13 public class DOMDocument : NSObject { | 23 public class DOMDocument : NSObject { |
14 | 24 |
15 public this () { | 25 public this() { |
16 super(); | 26 super(); |
17 } | 27 } |
18 | 28 |
19 public this (objc.id id) { | 29 public this(objc.id id) { |
20 super(id); | 30 super(id); |
21 } | 31 } |
22 | 32 |
23 // public NSURL URLWithAttributeString(NSString String) { | 33 public this(cocoa.id id) { |
24 // int result = OS.objc_msgSend(this.id, OS.sel_URLWithAttributeString_1, String !is null ? String.id : 0); | 34 super(id); |
25 // return result !is 0 ? new NSURL(result) : null; | 35 } |
26 // } | |
27 | 36 |
28 // public DOMNode adoptNode(DOMNode source) { | 37 public WebFrame webFrame() { |
29 // int result = OS.objc_msgSend(this.id, OS.sel_adoptNode_1, source !is null ? source.id : 0); | 38 objc.id result = OS.objc_msgSend(this.id, OS.sel_webFrame); |
30 // return result !is 0 ? new DOMNode(result) : null; | 39 return result !is null ? new WebFrame(result) : null; |
31 // } | 40 } |
32 | 41 |
33 // public DOMAttr createAttribute(NSString name) { | |
34 // int result = OS.objc_msgSend(this.id, OS.sel_createAttribute_1, name !is null ? name.id : 0); | |
35 // return result !is 0 ? new DOMAttr(result) : null; | |
36 // } | |
37 | |
38 // public DOMAttr createAttributeNS__(NSString createAttributeNS, NSString ) { | |
39 // int result = OS.objc_msgSend(this.id, OS.sel_createAttributeNS_1_1, createAttributeNS !is null ? createAttributeNS.id : 0, !is null ? .id : 0); | |
40 // return result !is 0 ? new DOMAttr(result) : null; | |
41 // } | |
42 | |
43 // public DOMAttr createAttributeNS_qualifiedName_(NSString namespaceURI, NSString qualifiedName) { | |
44 // int result = OS.objc_msgSend(this.id, OS.sel_createAttributeNS_1qualifiedName_1, namespaceURI !is null ? namespaceURI.id : 0, qualifiedName !is null ? qualifiedName.id : 0); | |
45 // return result !is 0 ? new DOMAttr(result) : null; | |
46 // } | |
47 | |
48 // public DOMCDATASection createCDATASection(NSString data) { | |
49 // int result = OS.objc_msgSend(this.id, OS.sel_createCDATASection_1, data !is null ? data.id : 0); | |
50 // return result !is 0 ? new DOMCDATASection(result) : null; | |
51 // } | |
52 | |
53 // public DOMCSSStyleDeclaration createCSSStyleDeclaration() { | |
54 // int result = OS.objc_msgSend(this.id, OS.sel_createCSSStyleDeclaration); | |
55 // return result !is 0 ? new DOMCSSStyleDeclaration(result) : null; | |
56 // } | |
57 | |
58 // public DOMComment createComment(NSString data) { | |
59 // int result = OS.objc_msgSend(this.id, OS.sel_createComment_1, data !is null ? data.id : 0); | |
60 // return result !is 0 ? new DOMComment(result) : null; | |
61 // } | |
62 | |
63 // public DOMDocumentFragment createDocumentFragment() { | |
64 // int result = OS.objc_msgSend(this.id, OS.sel_createDocumentFragment); | |
65 // return result !is 0 ? new DOMDocumentFragment(result) : null; | |
66 // } | |
67 | |
68 // public DOMElement createElement(NSString tagName) { | |
69 // int result = OS.objc_msgSend(this.id, OS.sel_createElement_1, tagName !is null ? tagName.id : 0); | |
70 // return result !is 0 ? new DOMElement(result) : null; | |
71 // } | |
72 | |
73 // public DOMElement createElementNS__(NSString createElementNS, NSString ) { | |
74 // int result = OS.objc_msgSend(this.id, OS.sel_createElementNS_1_1, createElementNS !is null ? createElementNS.id : 0, !is null ? .id : 0); | |
75 // return result !is 0 ? new DOMElement(result) : null; | |
76 // } | |
77 | |
78 // public DOMElement createElementNS_qualifiedName_(NSString namespaceURI, NSString qualifiedName) { | |
79 // int result = OS.objc_msgSend(this.id, OS.sel_createElementNS_1qualifiedName_1, namespaceURI !is null ? namespaceURI.id : 0, qualifiedName !is null ? qualifiedName.id : 0); | |
80 // return result !is 0 ? new DOMElement(result) : null; | |
81 // } | |
82 | |
83 // public DOMEntityReference createEntityReference(NSString name) { | |
84 // int result = OS.objc_msgSend(this.id, OS.sel_createEntityReference_1, name !is null ? name.id : 0); | |
85 // return result !is 0 ? new DOMEntityReference(result) : null; | |
86 // } | |
87 | |
88 // public DOMEvent createEvent(NSString eventType) { | |
89 // int result = OS.objc_msgSend(this.id, OS.sel_createEvent_1, eventType !is null ? eventType.id : 0); | |
90 // return result !is 0 ? new DOMEvent(result) : null; | |
91 // } | |
92 | |
93 // public DOMXPathExpression createExpression__(NSString createExpression, id ) { | |
94 // int result = OS.objc_msgSend(this.id, OS.sel_createExpression_1_1, createExpression !is null ? createExpression.id : 0, !is null ? .id : 0); | |
95 // return result !is 0 ? new DOMXPathExpression(result) : null; | |
96 // } | |
97 | |
98 // public DOMXPathExpression createExpression_resolver_(NSString expression, id resolver) { | |
99 // int result = OS.objc_msgSend(this.id, OS.sel_createExpression_1resolver_1, expression !is null ? expression.id : 0, resolver !is null ? resolver.id : 0); | |
100 // return result !is 0 ? new DOMXPathExpression(result) : null; | |
101 // } | |
102 | |
103 // public id createNSResolver(DOMNode nodeResolver) { | |
104 // int result = OS.objc_msgSend(this.id, OS.sel_createNSResolver_1, nodeResolver !is null ? nodeResolver.id : 0); | |
105 // return result !is 0 ? new id (result) : null; | |
106 // } | |
107 | |
108 // public DOMNodeIterator createNodeIterator____(DOMNode createNodeIterator, int , id , bool ) { | |
109 // int result = OS.objc_msgSend(this.id, OS.sel_createNodeIterator_1_1_1_1, createNodeIterator !is null ? createNodeIterator.id : 0, , !is null ? .id : 0, ); | |
110 // return result !is 0 ? new DOMNodeIterator(result) : null; | |
111 // } | |
112 | |
113 // public DOMNodeIterator createNodeIterator_whatToShow_filter_expandEntityReferences_(DOMNode root, int whatToShow, id filter, bool expandEntityReferences) { | |
114 // int result = OS.objc_msgSend(this.id, OS.sel_createNodeIterator_1whatToShow_1filter_1expandEntityReferences_1, root !is null ? root.id : 0, whatToShow, filter !is null ? filter.id : 0, expandEntityReferences); | |
115 // return result !is 0 ? new DOMNodeIterator(result) : null; | |
116 // } | |
117 | |
118 // public DOMProcessingInstruction createProcessingInstruction__(NSString createProcessingInstruction, NSString ) { | |
119 // int result = OS.objc_msgSend(this.id, OS.sel_createProcessingInstruction_1_1, createProcessingInstruction !is null ? createProcessingInstruction.id : 0, !is null ? .id : 0); | |
120 // return result !is 0 ? new DOMProcessingInstruction(result) : null; | |
121 // } | |
122 | |
123 // public DOMProcessingInstruction createProcessingInstruction_data_(NSString target, NSString data) { | |
124 // int result = OS.objc_msgSend(this.id, OS.sel_createProcessingInstruction_1data_1, target !is null ? target.id : 0, data !is null ? data.id : 0); | |
125 // return result !is 0 ? new DOMProcessingInstruction(result) : null; | |
126 // } | |
127 | |
128 // public DOMRange createRange() { | |
129 // int result = OS.objc_msgSend(this.id, OS.sel_createRange); | |
130 // return result !is 0 ? new DOMRange(result) : null; | |
131 // } | |
132 | |
133 // public DOMText createTextNode(NSString data) { | |
134 // int result = OS.objc_msgSend(this.id, OS.sel_createTextNode_1, data !is null ? data.id : 0); | |
135 // return result !is 0 ? new DOMText(result) : null; | |
136 // } | |
137 | |
138 // public DOMTreeWalker createTreeWalker____(DOMNode createTreeWalker, int , id , bool ) { | |
139 // int result = OS.objc_msgSend(this.id, OS.sel_createTreeWalker_1_1_1_1, createTreeWalker !is null ? createTreeWalker.id : 0, , !is null ? .id : 0, ); | |
140 // return result !is 0 ? new DOMTreeWalker(result) : null; | |
141 // } | |
142 | |
143 // public DOMTreeWalker createTreeWalker_whatToShow_filter_expandEntityReferences_(DOMNode root, int whatToShow, id filter, bool expandEntityReferences) { | |
144 // int result = OS.objc_msgSend(this.id, OS.sel_createTreeWalker_1whatToShow_1filter_1expandEntityReferences_1, root !is null ? root.id : 0, whatToShow, filter !is null ? filter.id : 0, expandEntityReferences); | |
145 // return result !is 0 ? new DOMTreeWalker(result) : null; | |
146 // } | |
147 | |
148 // public DOMXPathResult evaluate_____(NSString evaluate, DOMNode , id , short , DOMXPathResult ) { | |
149 // int result = OS.objc_msgSend(this.id, OS.sel_evaluate_1_1_1_1_1, evaluate !is null ? evaluate.id : 0, !is null ? .id : 0, !is null ? .id : 0, , !is null ? .id : 0); | |
150 // return result !is 0 ? new DOMXPathResult(result) : null; | |
151 // } | |
152 | |
153 // public DOMXPathResult evaluate_contextNode_resolver_type_inResult_(NSString expression, DOMNode contextNode, id resolver, short type, DOMXPathResult inResult) { | |
154 // int result = OS.objc_msgSend(this.id, OS.sel_evaluate_1contextNode_1resolver_1type_1inResult_1, expression !is null ? expression.id : 0, contextNode !is null ? contextNode.id : 0, resolver !is null ? resolver.id : 0, type, inResult !is null ? inResult.id : 0); | |
155 // return result !is 0 ? new DOMXPathResult(result) : null; | |
156 // } | |
157 | |
158 // public DOMCSSStyleDeclaration getComputedStyle__(DOMElement getComputedStyle, NSString ) { | |
159 // int result = OS.objc_msgSend(this.id, OS.sel_getComputedStyle_1_1, getComputedStyle !is null ? getComputedStyle.id : 0, !is null ? .id : 0); | |
160 // return result !is 0 ? new DOMCSSStyleDeclaration(result) : null; | |
161 // } | |
162 | |
163 // public DOMCSSStyleDeclaration getComputedStyle_pseudoElement_(DOMElement element, NSString pseudoElement) { | |
164 // int result = OS.objc_msgSend(this.id, OS.sel_getComputedStyle_1pseudoElement_1, element !is null ? element.id : 0, pseudoElement !is null ? pseudoElement.id : 0); | |
165 // return result !is 0 ? new DOMCSSStyleDeclaration(result) : null; | |
166 // } | |
167 | |
168 // public DOMElement getElementById(NSString elementId) { | |
169 // int result = OS.objc_msgSend(this.id, OS.sel_getElementById_1, elementId !is null ? elementId.id : 0); | |
170 // return result !is 0 ? new DOMElement(result) : null; | |
171 // } | |
172 | |
173 // public DOMNodeList getElementsByTagName(NSString tagname) { | |
174 // int result = OS.objc_msgSend(this.id, OS.sel_getElementsByTagName_1, tagname !is null ? tagname.id : 0); | |
175 // return result !is 0 ? new DOMNodeList(result) : null; | |
176 // } | |
177 | |
178 // public DOMNodeList getElementsByTagNameNS__(NSString getElementsByTagNameNS, NSString ) { | |
179 // int result = OS.objc_msgSend(this.id, OS.sel_getElementsByTagNameNS_1_1, getElementsByTagNameNS !is null ? getElementsByTagNameNS.id : 0, !is null ? .id : 0); | |
180 // return result !is 0 ? new DOMNodeList(result) : null; | |
181 // } | |
182 | |
183 // public DOMNodeList getElementsByTagNameNS_localName_(NSString namespaceURI, NSString localName) { | |
184 // int result = OS.objc_msgSend(this.id, OS.sel_getElementsByTagNameNS_1localName_1, namespaceURI !is null ? namespaceURI.id : 0, localName !is null ? localName.id : 0); | |
185 // return result !is 0 ? new DOMNodeList(result) : null; | |
186 // } | |
187 | |
188 // public DOMCSSRuleList getMatchedCSSRules_pseudoElement_(DOMElement element, NSString pseudoElement) { | |
189 // int result = OS.objc_msgSend(this.id, OS.sel_getMatchedCSSRules_1pseudoElement_1, element !is null ? element.id : 0, pseudoElement !is null ? pseudoElement.id : 0); | |
190 // return result !is 0 ? new DOMCSSRuleList(result) : null; | |
191 // } | |
192 | |
193 // public DOMCSSRuleList getMatchedCSSRules_pseudoElement_authorOnly_(DOMElement element, NSString pseudoElement, bool authorOnly) { | |
194 // int result = OS.objc_msgSend(this.id, OS.sel_getMatchedCSSRules_1pseudoElement_1authorOnly_1, element !is null ? element.id : 0, pseudoElement !is null ? pseudoElement.id : 0, authorOnly); | |
195 // return result !is 0 ? new DOMCSSRuleList(result) : null; | |
196 // } | |
197 | |
198 // public DOMCSSStyleDeclaration getOverrideStyle__(DOMElement getOverrideStyle, NSString ) { | |
199 // int result = OS.objc_msgSend(this.id, OS.sel_getOverrideStyle_1_1, getOverrideStyle !is null ? getOverrideStyle.id : 0, !is null ? .id : 0); | |
200 // return result !is 0 ? new DOMCSSStyleDeclaration(result) : null; | |
201 // } | |
202 | |
203 // public DOMCSSStyleDeclaration getOverrideStyle_pseudoElement_(DOMElement element, NSString pseudoElement) { | |
204 // int result = OS.objc_msgSend(this.id, OS.sel_getOverrideStyle_1pseudoElement_1, element !is null ? element.id : 0, pseudoElement !is null ? pseudoElement.id : 0); | |
205 // return result !is 0 ? new DOMCSSStyleDeclaration(result) : null; | |
206 // } | |
207 | |
208 // public DOMNode importNode__(DOMNode importNode, bool ) { | |
209 // int result = OS.objc_msgSend(this.id, OS.sel_importNode_1_1, importNode !is null ? importNode.id : 0, ); | |
210 // return result !is 0 ? new DOMNode(result) : null; | |
211 // } | |
212 | |
213 // public DOMNode importNode_deep_(DOMNode importedNode, bool deep) { | |
214 // int result = OS.objc_msgSend(this.id, OS.sel_importNode_1deep_1, importedNode !is null ? importedNode.id : 0, deep); | |
215 // return result !is 0 ? new DOMNode(result) : null; | |
216 // } | |
217 | |
218 public WebFrame webFrame () { | |
219 objc.id result = OS.objc_msgSend(this.id, OS.sel_webFrame); | |
220 return result !is null ? new WebFrame(result) : null; | |
221 } | |
222 | |
223 /* DOMEventTarget */ | |
224 | |
225 public void addEventListener_listener_useCapture (NSString type, id listener, bool useCapture) { | |
226 OS.objc_msgSend(this.id, OS.sel_addEventListener_1listener_1useCapture_1, type !is null ? type.id : null, | |
227 listener !is null ? listener.id : null, useCapture); | |
228 } | |
229 } | 42 } |