]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/events/MenuDetectEvent.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / events / MenuDetectEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2012 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 org.eclipse.swt.widgets.*;
18
19 /**
20  * Instances of this class are sent whenever the platform-
21  * specific trigger for showing a context menu is detected.
22  *
23  * @see MenuDetectListener
24  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
25  *
26  * @since 3.3
27  */
28
29 public final class MenuDetectEvent extends TypedEvent {
30
31         /**
32          * The display-relative x coordinate of the pointer
33          * at the time the context menu trigger occurred.
34          */
35         public int x;
36
37         /**
38          * The display-relative y coordinate of the pointer
39          * at the time the context menu trigger occurred.
40          */
41         public int y;
42
43         /**
44          * A flag indicating whether the operation should be allowed.
45          * Setting this field to <code>false</code> will cancel the operation.
46          */
47         public boolean doit;
48
49         /**
50          * The context menu trigger type.
51          * <ul>
52          * <li>{@link org.eclipse.swt.SWT#MENU_MOUSE}</li>
53          * <li>{@link org.eclipse.swt.SWT#MENU_KEYBOARD}</li>
54          * </ul>
55          *
56          * A field indicating whether the context menu was triggered by a
57          * pointing device such as a mouse (indicated by <code>MENU_MOUSE</code>),
58          * or by a focus-based device such as a keyboard (<code>MENU_KEYBOARD</code>).
59          * If the trigger was <code>MENU_KEYBOARD</code>, then the application should
60          * provide new display-relative x and y coordinates based on the current
61          * selection or the current focus.
62          *
63          * @since 3.8
64          */
65         public int detail;
66
67
68         private static final long serialVersionUID = -3061660596590828941L;
69
70 /**
71  * Constructs a new instance of this class based on the
72  * information in the given untyped event.
73  *
74  * @param e the untyped event containing the information
75  */
76 public MenuDetectEvent(Event e) {
77         super(e);
78         this.x = e.x;
79         this.y = e.y;
80         this.doit = e.doit;
81         this.detail = e.detail;
82 }
83
84 /**
85  * Returns a string containing a concise, human-readable
86  * description of the receiver.
87  *
88  * @return a string representation of the event
89  */
90 @Override
91 public String toString() {
92         String string = super.toString ();
93         return string.substring (0, string.length() - 1) // remove trailing '}'
94                 + " x=" + x
95                 + " y=" + y
96                 + " doit=" + doit
97                 + " detail=" + detail
98                 + "}";
99 }
100 }