]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/MouseTrackListener.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / MouseTrackListener.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 events that are generated as the mouse
24  * pointer passes (or hovers) over 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>addMouseTrackListener</code> method and removed using
29  * the <code>removeMouseTrackListener</code> method. When the
30  * mouse pointer passes into or out of the area of the screen
31  * covered by a control or pauses while over a control, the
32  * appropriate method will be invoked.
33  * </p>
34  *
35  * @see MouseTrackAdapter
36  * @see MouseEvent
37  */
38 public interface MouseTrackListener extends SWTEventListener {
39
40 /**
41  * Sent when the mouse pointer passes into the area of
42  * the screen covered by a control.
43  *
44  * @param e an event containing information about the mouse enter
45  */
46 void mouseEnter(MouseEvent e);
47
48 /**
49  * Sent when the mouse pointer passes out of the area of
50  * the screen covered by a control.
51  *
52  * @param e an event containing information about the mouse exit
53  */
54 void mouseExit(MouseEvent e);
55
56 /**
57  * Sent when the mouse pointer hovers (that is, stops moving
58  * for an (operating system specified) period of time) over
59  * a control.
60  *
61  * @param e an event containing information about the hover
62  */
63 void mouseHover(MouseEvent e);
64
65 /**
66  * Static helper method to create a <code>MouseTrackListener</code> for the
67  * {@link #mouseEnter(MouseEvent e)}) method, given a lambda expression or a method reference.
68  *
69  * @param c the consumer of the event
70  * @return MouseTrackListener
71  * @since 3.107
72  */
73 static MouseTrackListener mouseEnterAdapter(Consumer<MouseEvent> c) {
74         return new MouseTrackAdapter() {
75                 @Override
76                 public void mouseEnter(MouseEvent e) {
77                         c.accept(e);
78                 }
79         };
80 }
81
82 /**
83  * Static helper method to create a <code>MouseTrackListener</code> for the
84  * {@link #mouseExit(MouseEvent e)}) method, given a lambda expression or a method reference.
85  *
86  * @param c the consumer of the event
87  * @return MouseTrackListener
88  * @since 3.107
89  */
90 static MouseTrackListener mouseExitAdapter(Consumer<MouseEvent> c) {
91         return new MouseTrackAdapter() {
92                 @Override
93                 public void mouseExit(MouseEvent e) {
94                         c.accept(e);
95                 }
96         };
97 }
98
99 /**
100  * Static helper method to create a <code>MouseTrackListener</code> for the
101  * {@link #mouseHover(MouseEvent e)}) method, given a lambda expression or a method reference.
102  *
103  * @param c the consumer of the event
104  * @return MouseTrackListener
105  * @since 3.107
106  */
107 static MouseTrackListener mouseHoverAdapter(Consumer<MouseEvent> c) {
108         return new MouseTrackAdapter() {
109                 @Override
110                 public void mouseHover(MouseEvent e) {
111                         c.accept(e);
112                 }
113         };
114 }
115 }