]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/ExpandListener.java
Work around SWT 4.13 - 4.18 Win32 DnD bug 567422
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / ExpandListener.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2017 IBM Corporation and others.
3  *
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/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.events;
15
16
17 import java.util.function.*;
18
19 import org.eclipse.swt.internal.*;
20
21 /**
22  * Classes which implement this interface provide methods
23  * that deal with the expanding and collapsing of <code>ExpandItem</code>s.
24  *
25  * <p>
26  * After creating an instance of a class that implements
27  * this interface it can be added to a <code>ExpandBar</code>
28  * control using the <code>addExpandListener</code> method and
29  * removed using the <code>removeExpandListener</code> method.
30  * When a item of the <code>ExpandBar</code> is expanded or
31  * collapsed, the appropriate method will be invoked.
32  * </p>
33  *
34  * @see ExpandAdapter
35  * @see ExpandEvent
36  *
37  * @since 3.2
38  */
39 public interface ExpandListener extends SWTEventListener {
40
41 /**
42  * Sent when an item is collapsed.
43  *
44  * @param e an event containing information about the operation
45  */
46 void itemCollapsed(ExpandEvent e);
47
48 /**
49  * Sent when an item is expanded.
50  *
51  * @param e an event containing information about the operation
52  */
53 void itemExpanded(ExpandEvent e);
54
55 /**
56  * Static helper method to create a <code>ExpandListener</code> for the
57  * {@link #itemCollapsed(ExpandEvent e)}) method, given a lambda expression or a method reference.
58  *
59  * @param c the consumer of the event
60  * @return ExpandListener
61  * @since 3.107
62  */
63 static ExpandListener itemCollapsedAdapter(Consumer<ExpandEvent> c) {
64         return new ExpandAdapter() {
65                 @Override
66                 public void itemCollapsed(ExpandEvent e) {
67                         c.accept(e);
68                 }
69         };
70 }
71
72 /**
73  * Static helper method to create a <code>ExpandListener</code> for the
74  * {@link #itemExpanded(ExpandEvent e)}) method, given a lambda expression or a method reference.
75  *
76  * @param c the consumer of the event
77  * @return ExpandListener
78  * @since 3.107
79  */
80 static ExpandListener itemExpandedAdapter(Consumer<ExpandEvent> c) {
81         return new ExpandAdapter() {
82                 @Override
83                 public void itemExpanded(ExpandEvent e) {
84                         c.accept(e);
85                 }
86         };
87 }
88 }