1 /*******************************************************************************
2 * Copyright (c) 2003, 2017 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.browser;
16 import java.util.function.*;
18 import org.eclipse.swt.internal.*;
21 * This listener interface may be implemented in order to receive
22 * a {@link WindowEvent} notification when a window hosting a
23 * {@link Browser} needs to be displayed or hidden.
25 * @see Browser#addVisibilityWindowListener(VisibilityWindowListener)
26 * @see Browser#removeVisibilityWindowListener(VisibilityWindowListener)
27 * @see OpenWindowListener
28 * @see CloseWindowListener
32 public interface VisibilityWindowListener extends SWTEventListener {
35 * This method is called when the window hosting a <code>Browser</code>
36 * is requested to be hidden. Application would typically hide the
37 * {@link org.eclipse.swt.widgets.Shell} that hosts the <code>Browser</code>.
39 * <p>The following fields in the <code>WindowEvent</code> apply:</p>
41 * <li>(in) widget the <code>Browser</code> that needs to be hidden
44 * @param event the <code>WindowEvent</code> that specifies the
45 * <code>Browser</code> that needs to be hidden
47 * @see org.eclipse.swt.widgets.Shell#setVisible(boolean)
51 public void hide(WindowEvent event);
54 * This method is called when the window hosting a <code>Browser</code>
55 * is requested to be displayed. Application would typically set the
56 * location and the size of the {@link org.eclipse.swt.widgets.Shell}
57 * that hosts the <code>Browser</code>, if a particular location and size
58 * are specified. The application would then open that <code>Shell</code>.
60 * <p>The following fields in the <code>WindowEvent</code> apply:</p>
62 * <li>(in) widget the <code>Browser</code> to display
63 * <li>(in) location the requested location for the <code>Shell</code>
64 * hosting the browser. It is <code>null</code> if no location is set.
65 * <li>(in) size the requested size for the <code>Browser</code>.
66 * The client area of the <code>Shell</code> hosting the
67 * <code>Browser</code> should be large enough to accommodate that size.
68 * It is <code>null</code> if no size is set.
69 * <li>(in) addressBar <code>true</code> if the <code>Shell</code>
70 * hosting the <code>Browser</code> should display an address bar or
71 * <code>false</code> otherwise
72 * <li>(in) menuBar <code>true</code> if the <code>Shell</code>
73 * hosting the <code>Browser</code> should display a menu bar or
74 * <code>false</code> otherwise
75 * <li>(in) statusBar <code>true</code> if the <code>Shell</code>
76 * hosting the <code>Browser</code> should display a status bar or
77 * <code>false</code> otherwise
78 * <li>(in) toolBar <code>true</code> if the <code>Shell</code>
79 * hosting the <code>Browser</code> should display a tool bar or
80 * <code>false</code> otherwise
83 * @param event the <code>WindowEvent</code> that specifies the
84 * <code>Browser</code> that needs to be displayed
86 * @see org.eclipse.swt.widgets.Control#setLocation(org.eclipse.swt.graphics.Point)
87 * @see org.eclipse.swt.widgets.Control#setSize(org.eclipse.swt.graphics.Point)
88 * @see org.eclipse.swt.widgets.Shell#open()
92 public void show(WindowEvent event);
95 * Static helper method to create a <code>VisibilityWindowListener</code> for thehide
96 * {@link #hide(WindowEvent e)}) method, given a lambda expression or a method reference.
98 * @param c the consumer of the event
99 * @return LocationListener
102 public static VisibilityWindowListener hideAdapter(Consumer<WindowEvent> c) {
103 return new VisibilityWindowAdapter() {
105 public void hide(WindowEvent e) {
112 * Static helper method to create a <code>VisibilityWindowListener</code> for the
113 * {@link #show(WindowEvent e)}) method, given a lambda expression or a method reference.
115 * @param c the consumer of the event
116 * @return LocationListener
119 public static VisibilityWindowListener showAdapter(Consumer<WindowEvent> c) {
120 return new VisibilityWindowAdapter() {
122 public void show(WindowEvent e) {