]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/ControlListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / ControlListener.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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 events that are generated by moving
24  * and resizing controls.
25  * <p>
26  * After creating an instance of a class that implements
27  * this interface it can be added to a control using the
28  * <code>addControlListener</code> method and removed using
29  * the <code>removeControlListener</code> method. When a
30  * control is moved or resized, the appropriate method will
31  * be invoked.
32  * </p>
33  *
34  * @see ControlAdapter
35  * @see ControlEvent
36  */
37 public interface ControlListener extends SWTEventListener {
38
39 /**
40  * Sent when the location (x, y) of a control changes relative
41  * to its parent (or relative to the display, for <code>Shell</code>s).
42  *
43  * @param e an event containing information about the move
44  */
45 void controlMoved(ControlEvent e);
46
47 /**
48  * Sent when the size (width, height) of a control changes.
49  *
50  * @param e an event containing information about the resize
51  */
52 void controlResized(ControlEvent e);
53
54 /**
55  * Static helper method to create a <code>ControlListener</code> for the
56  * {@link #controlMoved(ControlEvent e)}) method, given a lambda expression or a method reference.
57  *
58  * @param c the consumer of the event
59  * @return ControlListener
60  * @since 3.107
61  */
62 static ControlListener controlMovedAdapter(Consumer<ControlEvent> c) {
63         return new ControlAdapter() {
64                 @Override
65                 public void controlMoved(ControlEvent e) {
66                         c.accept(e);
67                 }
68         };
69 }
70
71 /**
72  * Static helper method to create a <code>ControlListener</code> for the
73  * {@link #controlResized(ControlEvent e)}) method, given a lambda expression or a method reference.
74  *
75  * @param c the consumer of the event
76  * @return ControlListener
77  * @since 3.107
78  */
79 static ControlListener controlResizedAdapter(Consumer<ControlEvent> c) {
80         return new ControlAdapter() {
81                 @Override
82                 public void controlResized(ControlEvent e) {
83                         c.accept(e);
84                 }
85         };
86 }
87 }