Mercurial > projects > dwt-mac
diff 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 |
line wrap: on
line diff
--- a/dwt/internal/cocoa/WebFrame.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/WebFrame.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,115 +1,59 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <doob@me.com> *******************************************************************************/ -module dwt.internal.cocoa; +module dwt.internal.cocoa.WebFrame; + +import dwt.dwthelper.utils; +import cocoa = dwt.internal.cocoa.id; +import dwt.internal.cocoa.DOMDocument; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSURL; +import dwt.internal.cocoa.NSURLRequest; +import dwt.internal.cocoa.OS; +import dwt.internal.cocoa.WebDataSource; +import objc = dwt.internal.objc.runtime; public class WebFrame : NSObject { -public WebFrame() { +public this() { super(); } -public WebFrame(int id) { +public this(objc.id id) { super(id); } -public DOMDocument DOMDocument() { - int result = OS.objc_msgSend(this.id, OS.sel_DOMDocument); - return result !is 0 ? new DOMDocument(result) : null; +public this(cocoa.id id) { + super(id); } -public NSArray childFrames() { - int result = OS.objc_msgSend(this.id, OS.sel_childFrames); - return result !is 0 ? new NSArray(result) : null; +public DOMDocument DOMDocument_() { + objc.id result = OS.objc_msgSend(this.id, OS.sel_DOMDocument); + return result !is null ? new DOMDocument(result) : null; } public WebDataSource dataSource() { - int result = OS.objc_msgSend(this.id, OS.sel_dataSource); - return result !is 0 ? new WebDataSource(result) : null; -} - -public WebFrame findFrameNamed(NSString name) { - int result = OS.objc_msgSend(this.id, OS.sel_findFrameNamed_1, name !is null ? name.id : 0); - return result is this.id ? this : (result !is 0 ? new WebFrame(result) : null); + objc.id result = OS.objc_msgSend(this.id, OS.sel_dataSource); + return result !is null ? new WebDataSource(result) : null; } -//public DOMHTMLElement frameElement() { -// int result = OS.objc_msgSend(this.id, OS.sel_frameElement); -// return result !is 0 ? new DOMHTMLElement(result) : null; -//} - -//public WebFrameView frameView() { -// int result = OS.objc_msgSend(this.id, OS.sel_frameView); -// return result !is 0 ? new WebFrameView(result) : null; -//} - -public int globalContext() { - return OS.objc_msgSend(this.id, OS.sel_globalContext); -} - -//public id initWithName(NSString name, WebFrameView view, WebView webView) { -// 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); -// return result !is 0 ? new id(result) : null; -//} - -public void loadAlternateHTMLString(NSString String, NSURL baseURL, NSURL unreachableURL) { - 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); -} -// -//public void loadArchive(WebArchive archive) { -// OS.objc_msgSend(this.id, OS.sel_loadArchive_1, archive !is null ? archive.id : 0); -//} - -public void loadData(NSData data, NSString MIMEType, NSString encodingName, NSURL URL) { - 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); -} - -public void loadHTMLString(NSString String, NSURL URL) { - OS.objc_msgSend(this.id, OS.sel_loadHTMLString_1baseURL_1, String !is null ? String.id : 0, URL !is null ? URL.id : 0); +public void loadHTMLString(NSString string, NSURL URL) { + OS.objc_msgSend(this.id, OS.sel_loadHTMLString_baseURL_, string !is null ? string.id : null, URL !is null ? URL.id : null); } public void loadRequest(NSURLRequest request) { - OS.objc_msgSend(this.id, OS.sel_loadRequest_1, request !is null ? request.id : 0); -} - -public NSString name() { - int result = OS.objc_msgSend(this.id, OS.sel_name); - return result !is 0 ? new NSString(result) : null; -} - -public WebFrame parentFrame() { - int result = OS.objc_msgSend(this.id, OS.sel_parentFrame); - return result is this.id ? this : (result !is 0 ? new WebFrame(result) : null); -} - -public WebDataSource provisionalDataSource() { - int result = OS.objc_msgSend(this.id, OS.sel_provisionalDataSource); - return result !is 0 ? new WebDataSource(result) : null; + OS.objc_msgSend(this.id, OS.sel_loadRequest_, request !is null ? request.id : null); } -public void reload() { - OS.objc_msgSend(this.id, OS.sel_reload); } - -public void stopLoading() { - OS.objc_msgSend(this.id, OS.sel_stopLoading); -} - -public WebView webView() { - int result = OS.objc_msgSend(this.id, OS.sel_webView); - return result !is 0 ? new WebView(result) : null; -} - -//public WebScriptObject windowObject() { -// int result = OS.objc_msgSend(this.id, OS.sel_windowObject); -// return result !is 0 ? new WebScriptObject(result) : null; -//} - -}