1 11 package org.eclipse.swt.browser; 12 13 import org.eclipse.swt.internal.*; 14 15 class WebKit { 16 17 static { 18 Library.loadLibrary("swt-webkit"); WebInitForCarbon(); 20 } 21 22 23 static final int C_NSNotificationCenter = WebKit.objc_getClass("NSNotificationCenter"); static final int C_NSNumber = WebKit.objc_getClass("NSNumber"); static final int C_NSURL = WebKit.objc_getClass("NSURL"); static final int C_NSURLRequest = WebKit.objc_getClass("NSURLRequest"); static final int C_WebKitDelegate = WebKit.objc_getClass("WebKitDelegate"); 29 30 static final int S_absoluteString = WebKit.sel_registerName("absoluteString"); static final int S_addObserver_selector_name_object = WebKit.sel_registerName("addObserver:selector:name:object:"); static final int S_alloc = WebKit.sel_registerName("alloc"); static final int S_autorelease = WebKit.sel_registerName("autorelease"); static final int S_canGoBack = WebKit.sel_registerName("canGoBack"); static final int S_canGoForward = WebKit.sel_registerName("canGoForward"); static final int S_dataSource = WebKit.sel_registerName("dataSource"); static final int S_defaultCenter = WebKit.sel_registerName("defaultCenter"); static final int S_goBack = WebKit.sel_registerName("goBack:"); static final int S_goForward = WebKit.sel_registerName("goForward:"); static final int S_handleNotification = WebKit.sel_registerName("handleNotification:"); static final int S_ignore = WebKit.sel_registerName("ignore"); static final int S_initialRequest = WebKit.sel_registerName("initialRequest"); static final int S_initWithProc = WebKit.sel_registerName("initWithProc:user_data:"); static final int S_loadHTMLStringbaseURL = WebKit.sel_registerName("loadHTMLString:baseURL:"); static final int S_loadRequest = WebKit.sel_registerName("loadRequest:"); static final int S_mainFrame = WebKit.sel_registerName("mainFrame"); static final int S_name = WebKit.sel_registerName("name"); static final int S_numberWithInt = WebKit.sel_registerName("numberWithInt:"); static final int S_provisionalDataSource = WebKit.sel_registerName("provisionalDataSource"); static final int S_release = WebKit.sel_registerName("release"); static final int S_reload = WebKit.sel_registerName("reload:"); static final int S_retain = WebKit.sel_registerName("retain"); static final int S_removeObserver_name_object = WebKit.sel_registerName("removeObserver:name:object:"); static final int S_removeObserver = WebKit.sel_registerName("removeObserver:"); static final int S_requestWithURL = WebKit.sel_registerName("requestWithURL:"); static final int S_request = WebKit.sel_registerName("request"); static final int S_retainCount = WebKit.sel_registerName("retainCount"); static final int S_setFrameLoadDelegate = WebKit.sel_registerName("setFrameLoadDelegate:"); static final int S_setGroupName = WebKit.sel_registerName("setGroupName:"); static final int S_setPolicyDelegate = WebKit.sel_registerName("setPolicyDelegate:"); static final int S_setResourceLoadDelegate = WebKit.sel_registerName("setResourceLoadDelegate:"); static final int S_setStatusText = WebKit.sel_registerName("setStatusText:"); static final int S_setUIDelegate = WebKit.sel_registerName("setUIDelegate:"); static final int S_stopLoading = WebKit.sel_registerName("stopLoading:"); static final int S_stringByEvaluatingJavaScriptFromString = WebKit.sel_registerName("stringByEvaluatingJavaScriptFromString:"); static final int S_takeStringURLFrom = WebKit.sel_registerName("takeStringURLFrom:"); static final int S_use = WebKit.sel_registerName("use"); static final int S_webFrame = WebKit.sel_registerName("webFrame"); static final int S_URL = WebKit.sel_registerName("URL"); static final int S_URLWithString = WebKit.sel_registerName("URLWithString:"); 72 73 static final native int HIWebViewCreate(int[] outView); 74 static final native int HIWebViewGetWebView(int inView); 75 static final native void WebInitForCarbon(); 76 77 78 static final native int objc_getClass(byte[] className); 79 static final native int objc_msgSend(int object, int selector); 80 static final native int objc_msgSend(int object, int selector, int arg0); 81 static final native int objc_msgSend(int object, int selector, int arg0, int arg1); 82 static final native int objc_msgSend(int object, int selector, int arg0, int arg1, int arg2); 83 static final native int objc_msgSend(int object, int selector, int arg0, int arg1, int arg2, int arg3); 84 static final native int sel_registerName(byte[] selectorName); 85 86 static byte [] ascii (String name) { 87 int length = name.length (); 88 char [] chars = new char [length]; 89 name.getChars (0, length, chars, 0); 90 byte [] buffer = new byte [length + 1]; 91 for (int i=0; i<length; i++) { 92 buffer [i] = (byte) chars [i]; 93 } 94 return buffer; 95 } 96 97 static int sel_registerName(String selector) { 98 return WebKit.sel_registerName(ascii(selector)); 99 } 100 101 static int objc_getClass(String className) { 102 return WebKit.objc_getClass(ascii(className)); 103 } 104 } 105 | Popular Tags |