Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/WebFrame.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 30a762abda2a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | |
11 * Port to the D programming language: | |
12 * Jacob Carlborg <doob@me.com> | |
10 *******************************************************************************/ | 13 *******************************************************************************/ |
11 module dwt.internal.cocoa; | 14 module dwt.internal.cocoa.WebFrame; |
15 | |
16 import dwt.dwthelper.utils; | |
17 import cocoa = dwt.internal.cocoa.id; | |
18 import dwt.internal.cocoa.DOMDocument; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.NSURL; | |
22 import dwt.internal.cocoa.NSURLRequest; | |
23 import dwt.internal.cocoa.OS; | |
24 import dwt.internal.cocoa.WebDataSource; | |
25 import objc = dwt.internal.objc.runtime; | |
12 | 26 |
13 public class WebFrame : NSObject { | 27 public class WebFrame : NSObject { |
14 | 28 |
15 public WebFrame() { | 29 public this() { |
16 super(); | 30 super(); |
17 } | 31 } |
18 | 32 |
19 public WebFrame(int id) { | 33 public this(objc.id id) { |
20 super(id); | 34 super(id); |
21 } | 35 } |
22 | 36 |
23 public DOMDocument DOMDocument() { | 37 public this(cocoa.id id) { |
24 int result = OS.objc_msgSend(this.id, OS.sel_DOMDocument); | 38 super(id); |
25 return result !is 0 ? new DOMDocument(result) : null; | |
26 } | 39 } |
27 | 40 |
28 public NSArray childFrames() { | 41 public DOMDocument DOMDocument_() { |
29 int result = OS.objc_msgSend(this.id, OS.sel_childFrames); | 42 objc.id result = OS.objc_msgSend(this.id, OS.sel_DOMDocument); |
30 return result !is 0 ? new NSArray(result) : null; | 43 return result !is null ? new DOMDocument(result) : null; |
31 } | 44 } |
32 | 45 |
33 public WebDataSource dataSource() { | 46 public WebDataSource dataSource() { |
34 int result = OS.objc_msgSend(this.id, OS.sel_dataSource); | 47 objc.id result = OS.objc_msgSend(this.id, OS.sel_dataSource); |
35 return result !is 0 ? new WebDataSource(result) : null; | 48 return result !is null ? new WebDataSource(result) : null; |
36 } | 49 } |
37 | 50 |
38 public WebFrame findFrameNamed(NSString name) { | 51 public void loadHTMLString(NSString string, NSURL URL) { |
39 int result = OS.objc_msgSend(this.id, OS.sel_findFrameNamed_1, name !is null ? name.id : 0); | 52 OS.objc_msgSend(this.id, OS.sel_loadHTMLString_baseURL_, string !is null ? string.id : null, URL !is null ? URL.id : null); |
40 return result is this.id ? this : (result !is 0 ? new WebFrame(result) : null); | |
41 } | |
42 | |
43 //public DOMHTMLElement frameElement() { | |
44 // int result = OS.objc_msgSend(this.id, OS.sel_frameElement); | |
45 // return result !is 0 ? new DOMHTMLElement(result) : null; | |
46 //} | |
47 | |
48 //public WebFrameView frameView() { | |
49 // int result = OS.objc_msgSend(this.id, OS.sel_frameView); | |
50 // return result !is 0 ? new WebFrameView(result) : null; | |
51 //} | |
52 | |
53 public int globalContext() { | |
54 return OS.objc_msgSend(this.id, OS.sel_globalContext); | |
55 } | |
56 | |
57 //public id initWithName(NSString name, WebFrameView view, WebView webView) { | |
58 // int result = OS.objc_msgSend(this.id, OS.sel_initWithName_1webFrameView_1webView_1, name !is null ? name.id : 0, view !is null ? view.id : 0, webView !is null ? webView.id : 0); | |
59 // return result !is 0 ? new id(result) : null; | |
60 //} | |
61 | |
62 public void loadAlternateHTMLString(NSString String, NSURL baseURL, NSURL unreachableURL) { | |
63 OS.objc_msgSend(this.id, OS.sel_loadAlternateHTMLString_1baseURL_1forUnreachableURL_1, String !is null ? String.id : 0, baseURL !is null ? baseURL.id : 0, unreachableURL !is null ? unreachableURL.id : 0); | |
64 } | |
65 // | |
66 //public void loadArchive(WebArchive archive) { | |
67 // OS.objc_msgSend(this.id, OS.sel_loadArchive_1, archive !is null ? archive.id : 0); | |
68 //} | |
69 | |
70 public void loadData(NSData data, NSString MIMEType, NSString encodingName, NSURL URL) { | |
71 OS.objc_msgSend(this.id, OS.sel_loadData_1MIMEType_1textEncodingName_1baseURL_1, data !is null ? data.id : 0, MIMEType !is null ? MIMEType.id : 0, encodingName !is null ? encodingName.id : 0, URL !is null ? URL.id : 0); | |
72 } | |
73 | |
74 public void loadHTMLString(NSString String, NSURL URL) { | |
75 OS.objc_msgSend(this.id, OS.sel_loadHTMLString_1baseURL_1, String !is null ? String.id : 0, URL !is null ? URL.id : 0); | |
76 } | 53 } |
77 | 54 |
78 public void loadRequest(NSURLRequest request) { | 55 public void loadRequest(NSURLRequest request) { |
79 OS.objc_msgSend(this.id, OS.sel_loadRequest_1, request !is null ? request.id : 0); | 56 OS.objc_msgSend(this.id, OS.sel_loadRequest_, request !is null ? request.id : null); |
80 } | 57 } |
81 | 58 |
82 public NSString name() { | |
83 int result = OS.objc_msgSend(this.id, OS.sel_name); | |
84 return result !is 0 ? new NSString(result) : null; | |
85 } | 59 } |
86 | |
87 public WebFrame parentFrame() { | |
88 int result = OS.objc_msgSend(this.id, OS.sel_parentFrame); | |
89 return result is this.id ? this : (result !is 0 ? new WebFrame(result) : null); | |
90 } | |
91 | |
92 public WebDataSource provisionalDataSource() { | |
93 int result = OS.objc_msgSend(this.id, OS.sel_provisionalDataSource); | |
94 return result !is 0 ? new WebDataSource(result) : null; | |
95 } | |
96 | |
97 public void reload() { | |
98 OS.objc_msgSend(this.id, OS.sel_reload); | |
99 } | |
100 | |
101 public void stopLoading() { | |
102 OS.objc_msgSend(this.id, OS.sel_stopLoading); | |
103 } | |
104 | |
105 public WebView webView() { | |
106 int result = OS.objc_msgSend(this.id, OS.sel_webView); | |
107 return result !is 0 ? new WebView(result) : null; | |
108 } | |
109 | |
110 //public WebScriptObject windowObject() { | |
111 // int result = OS.objc_msgSend(this.id, OS.sel_windowObject); | |
112 // return result !is 0 ? new WebScriptObject(result) : null; | |
113 //} | |
114 | |
115 } |