KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > events > MenuDetectEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.events;
12
13
14 import org.eclipse.swt.widgets.Event;
15
16 /**
17  * Instances of this class are sent whenever the platform-
18  * specific trigger for showing a context menu is detected.
19  *
20  * @see MenuDetectListener
21  *
22  * @since 3.3
23  */

24
25 public final class MenuDetectEvent extends TypedEvent {
26
27     /**
28      * the display-relative x coordinate of the pointer
29      * at the time the context menu trigger occurred
30      */

31     public int x;
32     
33     /**
34      * the display-relative y coordinate of the pointer
35      * at the time the context menu trigger occurred
36      */

37     public int y;
38     
39     /**
40      * A flag indicating whether the operation should be allowed.
41      * Setting this field to <code>false</code> will cancel the operation.
42      */

43     public boolean doit;
44
45     private static final long serialVersionUID = -3061660596590828941L;
46
47 /**
48  * Constructs a new instance of this class based on the
49  * information in the given untyped event.
50  *
51  * @param e the untyped event containing the information
52  */

53 public MenuDetectEvent(Event e) {
54     super(e);
55     this.x = e.x;
56     this.y = e.y;
57     this.doit = e.doit;
58 }
59
60 /**
61  * Returns a string containing a concise, human-readable
62  * description of the receiver.
63  *
64  * @return a string representation of the event
65  */

66 public String JavaDoc toString() {
67     String JavaDoc string = super.toString ();
68     return string.substring (0, string.length() - 1) // remove trailing '}'
69
+ " x=" + x
70         + " y=" + y
71         + " doit=" + doit
72         + "}";
73 }
74 }
75
Popular Tags