comparison 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
comparison
equal deleted inserted replaced
125:5583f8eeee6c 126:38807a925e24
19 import tango.text.convert.Format; 19 import tango.text.convert.Format;
20 import tango.io.Console; 20 import tango.io.Console;
21 import tango.sys.Environment; 21 import tango.sys.Environment;
22 import tango.stdc.string; 22 import tango.stdc.string;
23 23
24 import dwt.internal.c.gtk; 24 version (linux)
25 import dwt.internal.c.gtk;
26
27 else version (darwin)
28 import objc = dwt.internal.objc.runtime;
25 29
26 import dwt.DWT; 30 import dwt.DWT;
27 import dwt.DWTError; 31 import dwt.DWTError;
28 import dwt.graphics.Device; 32 import dwt.graphics.Device;
29 import dwt.graphics.Point; 33 import dwt.graphics.Point;
119 import dwt.widgets.Listener; 123 import dwt.widgets.Listener;
120 import dwt.widgets.Menu; 124 import dwt.widgets.Menu;
121 import dwt.widgets.Shell; 125 import dwt.widgets.Shell;
122 import dwt.widgets.Control; 126 import dwt.widgets.Control;
123 127
128 import dwt.dwthelper.array;
129
124 class Mozilla : WebBrowser, 130 class Mozilla : WebBrowser,
125 nsIWeakReference, 131 nsIWeakReference,
126 nsIWebProgressListener, 132 nsIWebProgressListener,
127 nsIWebBrowserChrome, 133 nsIWebBrowserChrome,
128 nsIWebBrowserChromeFocus, 134 nsIWebBrowserChromeFocus,
132 nsIContextMenuListener, 138 nsIContextMenuListener,
133 nsIURIContentListener, 139 nsIURIContentListener,
134 nsITooltipListener, 140 nsITooltipListener,
135 nsIDOMEventListener { 141 nsIDOMEventListener {
136 142
137 GtkWidget* embedHandle; 143 version (linux)
144 GtkWidget* embedHandle;
145 else version (darwin)
146 objc.id embedHandle;
147
138 nsIWebBrowser webBrowser; 148 nsIWebBrowser webBrowser;
139 Object webBrowserObject; 149 Object webBrowserObject;
140 MozillaDelegate mozDelegate; 150 MozillaDelegate mozDelegate;
141 151
142 int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT; 152 int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT;
153 static WindowCreator2 WindowCreator; 163 static WindowCreator2 WindowCreator;
154 static int BrowserCount; 164 static int BrowserCount;
155 static bool Initialized, IsPre_1_8, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued; 165 static bool Initialized, IsPre_1_8, PerformedVersionCheck, XPCOMWasGlued, XPCOMInitWasGlued;
156 166
157 /* XULRunner detect constants */ 167 /* XULRunner detect constants */
158 static final String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$ 168 static const String GRERANGE_LOWER = "1.8.1.2"; //$NON-NLS-1$
159 static final String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$ 169 static const String GRERANGE_LOWER_FALLBACK = "1.8"; //$NON-NLS-1$
160 static final bool LowerRangeInclusive = true; 170 static const bool LowerRangeInclusive = true;
161 static final String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$ 171 static const String GRERANGE_UPPER = "1.9.*"; //$NON-NLS-1$
162 static final bool UpperRangeInclusive = true; 172 static const bool UpperRangeInclusive = true;
163 173
164 static final int MAX_PORT = 65535; 174 static const int MAX_PORT = 65535;
165 static final String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$ 175 static const String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$
166 static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$ 176 static const String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
167 static final String DISPOSE_LISTENER_HOOKED = "dwt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$ 177 static const String DISPOSE_LISTENER_HOOKED = "dwt.browser.Mozilla.disposeListenerHooked"; //$NON-NLS-1$
168 static final String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$ 178 static const String PREFIX_JAVASCRIPT = "javascript:"; //$NON-NLS-1$
169 static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$ 179 static const String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
170 static final String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$ 180 static const String PREFERENCE_DISABLEOPENDURINGLOAD = "dom.disable_open_during_load"; //$NON-NLS-1$
171 static final String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$ 181 static const String PREFERENCE_DISABLEWINDOWSTATUSCHANGE = "dom.disable_window_status_change"; //$NON-NLS-1$
172 static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$ 182 static const String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
173 static final String PREFERENCE_PROXYHOST_FTP = "network.proxy.ftp"; //$NON-NLS-1$ 183 static const String PREFERENCE_PROXYHOST_FTP = "network.proxy.ftp"; //$NON-NLS-1$
174 static final String PREFERENCE_PROXYPORT_FTP = "network.proxy.ftp_port"; //$NON-NLS-1$ 184 static const String PREFERENCE_PROXYPORT_FTP = "network.proxy.ftp_port"; //$NON-NLS-1$
175 static final String PREFERENCE_PROXYHOST_HTTP = "network.proxy.http"; //$NON-NLS-1$ 185 static const String PREFERENCE_PROXYHOST_HTTP = "network.proxy.http"; //$NON-NLS-1$
176 static final String PREFERENCE_PROXYPORT_HTTP = "network.proxy.http_port"; //$NON-NLS-1$ 186 static const String PREFERENCE_PROXYPORT_HTTP = "network.proxy.http_port"; //$NON-NLS-1$
177 static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$ 187 static const String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$
178 static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$ 188 static const String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$
179 static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$ 189 static const String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
180 static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$ 190 static const String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
181 static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$ 191 static const String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
182 static String PROFILE_DIR; //= SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$ 192 static String PROFILE_DIR; //= SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$
183 static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$ 193 static const String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
184 static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$ 194 static const String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$
185 static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$ 195 static const String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$
186 static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$ 196 static const String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
187 static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$ 197 static const String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
188 static final String STARTUP = "startup"; //$NON-NLS-1$ 198 static const String STARTUP = "startup"; //$NON-NLS-1$
189 static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$ 199 static const String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
190 static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$ 200 static const String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
191 static final String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$ 201 static const String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$
192 202
193 // TEMPORARY CODE 203 // TEMPORARY CODE
194 static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$ 204 static const String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$
195 205
196 this () { 206 this () {
197 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; 207 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS;
198 MozillaClearSessions = new class() Runnable { 208 MozillaClearSessions = new class() Runnable {
199 public void run () { 209 public void run () {
1241 return rc is XPCOM.NS_OK; 1251 return rc is XPCOM.NS_OK;
1242 } 1252 }
1243 1253
1244 extern(D) 1254 extern(D)
1245 static Browser findBrowser (void* handle) { 1255 static Browser findBrowser (void* handle) {
1246 return MozillaDelegate.findBrowser (cast(GtkWidget*)handle); 1256 version (linux) return MozillaDelegate.findBrowser (cast(GtkWidget*)handle);
1257 version (darwin) return MozillaDelegate.findBrowser (cast(objc.id)handle);
1247 } 1258 }
1248 1259
1249 extern(D) 1260 extern(D)
1250 public bool forward () { 1261 public bool forward () {
1251 if (awaitingNavigate) return false; 1262 if (awaitingNavigate) return false;