]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/MouseListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / MouseListener.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  *     Lars Vogel <Lars.Vogel@vogella.com>  - Bug 513037
14  *******************************************************************************/
15 package org.eclipse.swt.events;
16
17
18 import java.util.function.*;
19
20 import org.eclipse.swt.internal.*;
21
22 /**
23  * Classes which implement this interface provide methods
24  * that deal with the events that are generated as mouse buttons
25  * are pressed.
26  * <p>
27  * After creating an instance of a class that implements
28  * this interface it can be added to a control using the
29  * <code>addMouseListener</code> method and removed using
30  * the <code>removeMouseListener</code> method. When a
31  * mouse button is pressed or released, the appropriate method
32  * will be invoked.
33  * </p>
34  *
35  * @see MouseAdapter
36  * @see MouseEvent
37  */
38 public interface MouseListener extends SWTEventListener {
39
40 /**
41  * Sent when a mouse button is pressed twice within the
42  * (operating system specified) double click period.
43  *
44  * @param e an event containing information about the mouse double click
45  *
46  * @see org.eclipse.swt.widgets.Display#getDoubleClickTime()
47  */
48 void mouseDoubleClick(MouseEvent e);
49
50 /**
51  * Sent when a mouse button is pressed.
52  *
53  * @param e an event containing information about the mouse button press
54  */
55 void mouseDown(MouseEvent e);
56
57 /**
58  * Sent when a mouse button is released.
59  *
60  * @param e an event containing information about the mouse button release
61  */
62 void mouseUp(MouseEvent e);
63
64
65 /**
66  * Static helper method to create a <code>MouseListener</code> for the
67  * {@link #mouseDoubleClick(MouseEvent e)}) method with a lambda expression.
68  *
69  * @param c the consumer of the event
70  * @return MouseListener
71  * @since 3.106
72  */
73
74 static MouseListener mouseDoubleClickAdapter(Consumer<MouseEvent> c) {
75         return new MouseAdapter() {
76                 @Override
77                 public void mouseDoubleClick(MouseEvent e) {
78                         c.accept(e);
79                 }
80         };
81 }
82
83 /**
84  * Static helper method to create a <code>MouseListener</code> for the
85  * {@link #mouseDown(MouseEvent e)}) method with a lambda expression.
86  *
87  * @param c the consumer of the event
88  * @return MouseListener
89  * @since 3.106
90  */
91
92 static MouseListener mouseDownAdapter(Consumer<MouseEvent> c) {
93         return new MouseAdapter() {
94                 @Override
95                 public void mouseDown(MouseEvent e) {
96                         c.accept(e);
97                 }
98         };
99 }
100
101 /**
102  * Static helper method to create a <code>MouseListener</code> for the
103  * {@link #mouseUp(MouseEvent e)}) method with a lambda expression.
104  *
105  * @param c the consumer of the event
106  * @return MouseListener
107  * @since 3.106
108  */
109
110 static MouseListener mouseUpAdapter(Consumer<MouseEvent> c) {
111         return new MouseAdapter() {
112                 @Override
113                 public void mouseUp(MouseEvent e) {
114                         c.accept(e);
115                 }
116         };
117 }
118
119 }