1 /*******************************************************************************
2 * Copyright (c) 2000, 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.events;
17 import java.util.function.*;
19 import org.eclipse.swt.internal.*;
22 * Classes which implement this interface provide methods
23 * that deal with changes in state of <code>Shell</code>s.
25 * After creating an instance of a class that implements
26 * this interface it can be added to a shell using the
27 * <code>addShellListener</code> method and removed using
28 * the <code>removeShellListener</code> method. When the
29 * state of the shell changes, the appropriate method will
36 public interface ShellListener extends SWTEventListener {
39 * Sent when a shell becomes the active window.
41 * @param e an event containing information about the activation
43 void shellActivated(ShellEvent e);
46 * Sent when a shell is closed.
48 * @param e an event containing information about the close
50 void shellClosed(ShellEvent e);
53 * Sent when a shell stops being the active window.
55 * @param e an event containing information about the deactivation
57 void shellDeactivated(ShellEvent e);
60 * Sent when a shell is un-minimized.
62 * @param e an event containing information about the un-minimization
64 void shellDeiconified(ShellEvent e);
67 * Sent when a shell is minimized.
69 * @param e an event containing information about the minimization
71 void shellIconified(ShellEvent e);
74 * Static helper method to create a <code>ShellListener</code> for the
75 * {@link #shellActivated(ShellEvent e)}) method, given a lambda expression or a method reference.
77 * @param c the consumer of the event
78 * @return ShellListener
81 static ShellListener shellActivatedAdapter(Consumer<ShellEvent> c) {
82 return new ShellAdapter() {
84 public void shellActivated(ShellEvent e) {
91 * Static helper method to create a <code>ShellListener</code> for the
92 * {@link #shellClosed(ShellEvent e)}) method, given a lambda expression or a method reference.
94 * @param c the consumer of the event
95 * @return ShellListener
98 static ShellListener shellClosedAdapter(Consumer<ShellEvent> c) {
99 return new ShellAdapter() {
101 public void shellClosed(ShellEvent e) {
108 * Static helper method to create a <code>ShellListener</code> for the
109 * {@link #shellDeactivated(ShellEvent e)}) method, given a lambda expression or a method reference.
111 * @param c the consumer of the event
112 * @return ShellListener
115 static ShellListener shellDeactivatedAdapter(Consumer<ShellEvent> c) {
116 return new ShellAdapter() {
118 public void shellDeactivated(ShellEvent e) {
125 * Static helper method to create a <code>ShellListener</code> for the
126 * {@link #shellDeiconified(ShellEvent e)}) method, given a lambda expression or a method reference.
128 * @param c the consumer of the event
129 * @return ShellListener
132 static ShellListener shellDeiconifiedAdapter(Consumer<ShellEvent> c) {
133 return new ShellAdapter() {
135 public void shellDeiconified(ShellEvent e) {
142 * Static helper method to create a <code>ShellListener</code> for the
143 * {@link #shellIconified(ShellEvent e)}) method, given a lambda expression or a method reference.
145 * @param c the consumer of the event
146 * @return ShellListener
149 static ShellListener shellIconifiedAdapter(Consumer<ShellEvent> c) {
150 return new ShellAdapter() {
152 public void shellIconified(ShellEvent e) {