comparison dwt/browser/WindowCreator2.d @ 305:c7c696cdfec2

Mozilla module progress; fixes to other browser modules; update XPCOM interfaces
author John Reimer<terminal.node@gmail.com>
date Sat, 16 Aug 2008 22:53:35 -0700
parents b72d84d1ba95
children 3f4a5c7d138f
comparison
equal deleted inserted replaced
304:16ba3d9cb209 305:c7c696cdfec2
112 if (aParentNativeWindow is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); 112 if (aParentNativeWindow is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
113 baseWindow.Release (); 113 baseWindow.Release ();
114 114
115 src = Mozilla.findBrowser (aParentNativeWindow); 115 src = Mozilla.findBrowser (aParentNativeWindow);
116 } 116 }
117 final Browser browser; 117 Browser browser;
118 bool doit = true; 118 bool doit = true;
119 if ((chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0) { 119 if ((chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0) {
120 /* 120 /*
121 * Mozilla will request a new Browser in a modal window in order to emulate a native 121 * Mozilla will request a new Browser in a modal window in order to emulate a native
122 * dialog that is not available to it (eg.- a print dialog on Linux). For this 122 * dialog that is not available to it (eg.- a print dialog on Linux). For this
123 * reason modal requests are handled here so that the user is not exposed to them. 123 * reason modal requests are handled here so that the user is not exposed to them.
124 */ 124 */
125 int style = DWT.DIALOG_TRIM; 125 int style = DWT.DIALOG_TRIM;
126 if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0) style |= DWT.APPLICATION_MODAL; 126 if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0) style |= DWT.APPLICATION_MODAL;
127 final Shell shell = src is null ? 127 Shell shell = src is null ?
128 new Shell (style) : 128 new Shell (style) :
129 new Shell (src.getShell(), style); 129 new Shell (src.getShell(), style);
130 shell.setLayout (new FillLayout ()); 130 shell.setLayout (new FillLayout ());
131 browser = new Browser (shell, src is null ? DWT.MOZILLA : src.getStyle () & DWT.MOZILLA); 131 browser = new Browser (shell, src is null ? DWT.MOZILLA : src.getStyle () & DWT.MOZILLA);
132 browser.addVisibilityWindowListener (new VisibilityWindowListener () { 132 browser.addVisibilityWindowListener (new class(shell) VisibilityWindowListener {
133 Shell sh;
134 this (Shell shell) { this.sh = shell; }
133 public void hide (WindowEvent event) { 135 public void hide (WindowEvent event) {
134 } 136 }
135 public void show (WindowEvent event) { 137 public void show (WindowEvent event) {
136 if (event.location !is null) shell.setLocation (event.location); 138 if (event.location !is null) sh.setLocation (event.location);
137 if (event.size !is null) { 139 if (event.size !is null) {
138 Point size = event.size; 140 Point size = event.size;
139 shell.setSize (shell.computeSize (size.x, size.y)); 141 sh.setSize (sh.computeSize (size.x, size.y));
140 } 142 }
141 shell.open (); 143 shell.open ();
142 } 144 }
143 }); 145 });
144 browser.addCloseWindowListener (new CloseWindowListener () { 146 browser.addCloseWindowListener (new class(shell) CloseWindowListener {
147 Shell sh;
148 this (Shell shell) { this.shell = shell; }
145 public void close (WindowEvent event) { 149 public void close (WindowEvent event) {
146 shell.close (); 150 sh.close ();
147 } 151 }
148 }); 152 });
149 if (uri !is null) { 153 if (uri !is null) {
150 //nsIURI location = new nsIURI (uri); 154 //nsIURI location = new nsIURI (uri);
151 scope auto aSpec = new nsEmbedCString; 155 scope auto aSpec = new nsEmbedCString;