Mercurial > projects > dwt2
annotate org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/WindowEvent.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | 7a2dd761a8b2 |
children |
rev | line source |
---|---|
25 | 1 /******************************************************************************* |
2 * Copyright (c) 2003, 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * John Reimer <terminal.node@gmail.com> | |
12 *******************************************************************************/ | |
13 module org.eclipse.swt.browser.WindowEvent; | |
14 | |
15 | |
16 import java.lang.all; | |
17 | |
18 import org.eclipse.swt.events.TypedEvent; | |
19 import org.eclipse.swt.graphics.Point; | |
20 import org.eclipse.swt.widgets.Widget; | |
21 import org.eclipse.swt.browser.Browser; | |
22 | |
23 /** | |
24 * A <code>WindowEvent</code> is sent by a {@link Browser} when | |
25 * a new window needs to be created or when an existing window needs to be | |
26 * closed. This notification occurs when a javascript command such as | |
27 * <code>window.open</code> or <code>window.close</code> gets executed by | |
28 * a <code>Browser</code>. | |
29 * | |
30 * <p> | |
31 * The following example shows how <code>WindowEvent</code>'s are typically | |
32 * handled. | |
33 * | |
34 * <code><pre> | |
35 * public static void main(String[] args) { | |
36 * Display display = new Display(); | |
37 * Shell shell = new Shell(display); | |
38 * shell.setText("Main Window"); | |
39 * shell.setLayout(new FillLayout()); | |
40 * Browser browser = new Browser(shell, SWT.NONE); | |
41 * initialize(display, browser); | |
42 * shell.open(); | |
43 * browser.setUrl("http://www.eclipse.org"); | |
44 * while (!shell.isDisposed()) { | |
45 * if (!display.readAndDispatch()) | |
46 * display.sleep(); | |
47 * } | |
48 * display.dispose(); | |
49 * } | |
50 * | |
51 * static void initialize(final Display display, Browser browser) { | |
52 * browser.addOpenWindowListener(new OpenWindowListener() { | |
53 * public void open(WindowEvent event) { | |
54 * // Certain platforms can provide a default full browser. | |
55 * // simply return in that case if the application prefers | |
56 * // the default full browser to the embedded one set below. | |
57 * if (!event.required) return; | |
58 * | |
59 * // Embed the new window | |
60 * Shell shell = new Shell(display); | |
61 * shell.setText("New Window"); | |
62 * shell.setLayout(new FillLayout()); | |
63 * Browser browser = new Browser(shell, SWT.NONE); | |
64 * initialize(display, browser); | |
65 * event.browser = browser; | |
66 * } | |
67 * }); | |
68 * browser.addVisibilityWindowListener(new VisibilityWindowListener() { | |
69 * public void hide(WindowEvent event) { | |
70 * Browser browser = (Browser)event.widget; | |
71 * Shell shell = browser.getShell(); | |
72 * shell.setVisible(false); | |
73 * } | |
74 * public void show(WindowEvent event) { | |
75 * Browser browser = (Browser)event.widget; | |
76 * Shell shell = browser.getShell(); | |
77 * if (event.location !is null) shell.setLocation(event.location); | |
78 * if (event.size !is null) { | |
79 * Point size = event.size; | |
80 * shell.setSize(shell.computeSize(size.x, size.y)); | |
81 * } | |
82 * if (event.addressBar || event.menuBar || event.statusBar || event.toolBar) { | |
83 * // Create widgets for the address bar, menu bar, status bar and/or tool bar | |
84 * // leave enough space in the Shell to accommodate a Browser of the size | |
85 * // given by event.size | |
86 * } | |
87 * shell.open(); | |
88 * } | |
89 * }); | |
90 * browser.addCloseWindowListener(new CloseWindowListener() { | |
91 * public void close(WindowEvent event) { | |
92 * Browser browser = (Browser)event.widget; | |
93 * Shell shell = browser.getShell(); | |
94 * shell.close(); | |
95 * } | |
96 * }); | |
97 * } | |
98 * </pre></code> | |
99 * | |
100 * The following notifications are emitted when the user selects a hyperlink that targets a new window | |
101 * or as the result of a javascript that executes window.open. | |
102 * | |
103 * <p>Main Browser | |
104 * <ul> | |
105 * <li>User selects a link that opens in a new window or javascript requests a new window</li> | |
106 * <li>OpenWindowListener.open() notified</li> | |
107 * <ul> | |
108 * <li>Application creates a new Shell and a second Browser inside that Shell</li> | |
109 * <li>Application registers WindowListener's on that second Browser, such as VisibilityWindowListener</li> | |
110 * <li>Application returns the second Browser as the host for the new window content</li> | |
111 * </ul> | |
112 * </ul> | |
113 * | |
114 * <p>Second Browser | |
115 * <ul> | |
116 * <li>VisibilityWindowListener.show() notified</li> | |
117 * <ul> | |
118 * <li>Application sets navigation tool bar, status bar, menu bar and Shell size | |
119 * <li>Application makes the Shell hosting the second Browser visible | |
120 * <li>User now sees the new window | |
121 * </ul> | |
122 * </ul> | |
123 * | |
124 * @see CloseWindowListener | |
125 * @see OpenWindowListener | |
126 * @see VisibilityWindowListener | |
127 * | |
128 * @since 3.0 | |
129 */ | |
130 public class WindowEvent : TypedEvent { | |
131 | |
132 /** | |
133 * Specifies whether the platform requires the user to provide a | |
134 * <code>Browser</code> to handle the new window. | |
135 * | |
136 * @since 3.1 | |
137 */ | |
138 public bool required; | |
139 | |
140 | |
141 /** | |
142 * <code>Browser</code> provided by the application. | |
143 */ | |
144 public Browser browser; | |
145 | |
146 /** | |
147 * Requested location for the <code>Shell</code> hosting the <code>Browser</code>. | |
148 * It is <code>null</code> if no location has been requested. | |
149 */ | |
150 public Point location; | |
151 | |
152 /** | |
153 * Requested <code>Browser</code> size. The client area of the <code>Shell</code> | |
154 * hosting the <code>Browser</code> should be large enough to accommodate that size. | |
155 * It is <code>null</code> if no size has been requested. | |
156 */ | |
157 public Point size; | |
158 | |
159 /** | |
160 * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should | |
161 * display an address bar. | |
162 * | |
163 * @since 3.1 | |
164 */ | |
165 public bool addressBar; | |
166 | |
167 /** | |
168 * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should | |
169 * display a menu bar. | |
170 * | |
171 * @since 3.1 | |
172 */ | |
173 public bool menuBar; | |
174 | |
175 /** | |
176 * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should | |
177 * display a status bar. | |
178 * | |
179 * @since 3.1 | |
180 */ | |
181 public bool statusBar; | |
182 | |
183 /** | |
184 * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should | |
185 * display a tool bar. | |
186 * | |
187 * @since 3.1 | |
188 */ | |
189 public bool toolBar; | |
190 | |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
26
diff
changeset
|
191 static const long serialVersionUID = 3617851997387174969L; |
25 | 192 |
193 this(Widget w) { | |
194 super(w); | |
195 } | |
196 | |
197 /** | |
198 * Returns a string containing a concise, human-readable | |
199 * description of the receiver. | |
200 * | |
201 * @return a string representation of the event | |
202 */ | |
203 | |
204 public String toString() { | |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
49
diff
changeset
|
205 return Format( "{} required={} browser={} location={} size={} addressbar={} menubar={} statusbar={} toolbar={}}", |
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
49
diff
changeset
|
206 super.toString[0 .. $-1], |
25 | 207 required, browser, |
208 location, size, addressBar, | |
209 menuBar, statusBar, toolBar ); | |
210 } | |
211 } |