Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Cornu2003-12-08 22:03:03 +0000
committerChristophe Cornu2003-12-08 22:03:03 +0000
commit9f963bfbea4d5fb9e9cfb300aed51e5121e608b5 (patch)
tree3fa49cea28239c2a9a467b19aae134ea514b0264 /examples
parent15237bdb74ffd796ae75eb6ad21aee15b364de97 (diff)
downloadeclipse.platform.swt-9f963bfbea4d5fb9e9cfb300aed51e5121e608b5.tar.gz
eclipse.platform.swt-9f963bfbea4d5fb9e9cfb300aed51e5121e608b5.tar.xz
eclipse.platform.swt-9f963bfbea4d5fb9e9cfb300aed51e5121e608b5.zip
new window handling
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java
index 694a5cc4d3..3ab86486b4 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/browserexample/BrowserExample.java
@@ -181,6 +181,7 @@ public BrowserExample(Composite parent) {
}
});
+ initialize(display, browser);
browser.setUrl(getResourceString("Startup"));
}
}
@@ -215,6 +216,39 @@ static String getResourceString(String key, Object[] args) {
}
}
+static void initialize(final Display display, Browser browser) {
+ browser.addOpenWindowListener(new OpenWindowListener() {
+ public void open(WindowEvent event) {
+ Shell shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+ Browser browser = new Browser(shell, SWT.NONE);
+ initialize(display, browser);
+ event.browser = browser;
+ }
+ });
+ browser.addVisibilityWindowListener(new VisibilityWindowListener() {
+ public void hide(WindowEvent event) {
+ }
+ public void show(WindowEvent event) {
+ Browser browser = (Browser)event.widget;
+ Shell shell = browser.getShell();
+ if (event.location != null) shell.setLocation(event.location);
+ if (event.size != null) {
+ Point size = event.size;
+ shell.setSize(shell.computeSize(size.x, size.y));
+ }
+ shell.open();
+ }
+ });
+ browser.addCloseWindowListener(new CloseWindowListener() {
+ public void close(WindowEvent event) {
+ Browser browser = (Browser)event.widget;
+ Shell shell = browser.getShell();
+ shell.close();
+ }
+ });
+}
+
/**
* Disposes of all resources associated with a particular
* instance of the BrowserExample.

Back to the top