diff dwt/browser/Mozilla.d @ 126:38807a925e24

Fixed compile errors, support for SWT language files
author Jacob Carlborg <doob@me.com>
date Fri, 16 Jan 2009 23:35:40 +0100
parents 5583f8eeee6c
children 07399639c0c8
line wrap: on
line diff
--- a/dwt/browser/Mozilla.d	Fri Jan 16 12:49:08 2009 +0100
+++ b/dwt/browser/Mozilla.d	Fri Jan 16 23:35:40 2009 +0100
@@ -21,7 +21,11 @@
 import tango.sys.Environment;
 import tango.stdc.string;
 
-import dwt.internal.c.gtk;
+version (linux)
+    import dwt.internal.c.gtk;
+
+else version (darwin)
+    import objc = dwt.internal.objc.runtime;
 
 import dwt.DWT;
 import dwt.DWTError;
@@ -121,6 +125,8 @@
 import dwt.widgets.Shell;
 import dwt.widgets.Control;
 
+import dwt.dwthelper.array;
+
 class Mozilla : WebBrowser, 
                 nsIWeakReference, 
                 nsIWebProgressListener, 
@@ -134,7 +140,11 @@
                 nsITooltipListener, 
                 nsIDOMEventListener {
                     
-    GtkWidget* embedHandle;
+    version (linux)
+        GtkWidget* embedHandle;
+    else version (darwin)
+        objc.id embedHandle;
+
     nsIWebBrowser webBrowser;
     Object webBrowserObject;
     MozillaDelegate mozDelegate;
@@ -155,43 +165,43 @@
     static bool Initialized, IsPre_1_8, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued;
 
     /* XULRunner detect constants */
-    static final String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$
-    static final String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$
-    static final bool LowerRangeInclusive = true;
-    static final String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$
-    static final bool UpperRangeInclusive = true;
+    static const String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$
+    static const String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$
+    static const bool LowerRangeInclusive = true;
+    static const String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$
+    static const bool UpperRangeInclusive = true;
 
-    static final int MAX_PORT = 65535;
-    static final String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$
-    static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
-    static final String DISPOSE_LISTENER_HOOKED = "dwt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$
-    static final String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$
-    static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
-    static final String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$
-    static final String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$
-    static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYHOST_FTP = "network.proxy.ftp"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYPORT_FTP = "network.proxy.ftp_port"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYHOST_HTTP = "network.proxy.http"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYPORT_HTTP = "network.proxy.http_port"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$
-    static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
-    static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
-    static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
+    static const int MAX_PORT = 65535;
+    static const String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$
+    static const String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
+    static const String DISPOSE_LISTENER_HOOKED = "dwt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$
+    static const String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$
+    static const String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
+    static const String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$
+    static const String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$
+    static const String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYHOST_FTP = "network.proxy.ftp"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYPORT_FTP = "network.proxy.ftp_port"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYHOST_HTTP = "network.proxy.http"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYPORT_HTTP = "network.proxy.http_port"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$
+    static const String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
+    static const String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
+    static const String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
     static       String PROFILE_DIR; //= SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$
-    static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
-    static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$
-    static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
-    static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
-    static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
-    static final String STARTUP = "startup"; //$NON-NLS-1$
-    static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
-    static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
-    static final String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$
+    static const String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
+    static const String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$
+    static const String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
+    static const String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
+    static const String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
+    static const String STARTUP = "startup"; //$NON-NLS-1$
+    static const String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
+    static const String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
+    static const String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$
 
-    // TEMPORARY CODE
-    static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$
+// TEMPORARY CODE
+static const String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$
 
     this () {
         PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS;
@@ -1243,7 +1253,8 @@
 
 extern(D)
 static Browser findBrowser (void* handle) {
-    return MozillaDelegate.findBrowser (cast(GtkWidget*)handle);
+    version (linux) return MozillaDelegate.findBrowser (cast(GtkWidget*)handle);
+    version (darwin) return MozillaDelegate.findBrowser (cast(objc.id)handle);
 }
 
 extern(D)