01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.swt.events;
11:
12: import org.eclipse.swt.widgets.Event;
13:
14: /**
15: * Instances of this class are sent whenever the platform-
16: * specific trigger for showing a context menu is detected.
17: *
18: * @see MenuDetectListener
19: *
20: * @since 3.3
21: */
22:
23: public final class MenuDetectEvent extends TypedEvent {
24:
25: /**
26: * the display-relative x coordinate of the pointer
27: * at the time the context menu trigger occurred
28: */
29: public int x;
30:
31: /**
32: * the display-relative y coordinate of the pointer
33: * at the time the context menu trigger occurred
34: */
35: public int y;
36:
37: /**
38: * A flag indicating whether the operation should be allowed.
39: * Setting this field to <code>false</code> will cancel the operation.
40: */
41: public boolean doit;
42:
43: private static final long serialVersionUID = -3061660596590828941L;
44:
45: /**
46: * Constructs a new instance of this class based on the
47: * information in the given untyped event.
48: *
49: * @param e the untyped event containing the information
50: */
51: public MenuDetectEvent(Event e) {
52: super (e);
53: this .x = e.x;
54: this .y = e.y;
55: this .doit = e.doit;
56: }
57:
58: /**
59: * Returns a string containing a concise, human-readable
60: * description of the receiver.
61: *
62: * @return a string representation of the event
63: */
64: public String toString() {
65: String string = super .toString();
66: return string.substring(0, string.length() - 1) // remove trailing '}'
67: + " x=" + x + " y=" + y + " doit=" + doit + "}";
68: }
69: }
|