1 /******************************************************************************* 2 * Copyright (c) 2000, 2008 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 * Port to the D programming language: 11 * Frank Benoit <benoit@tionex.de> 12 *******************************************************************************/ 13 module org.eclipse.swt.events.MenuDetectEvent; 14 15 16 import org.eclipse.swt.widgets.Event; 17 import org.eclipse.swt.events.TypedEvent; 18 19 import java.lang.all; 20 21 /** 22 * Instances of this class are sent whenever the platform- 23 * specific trigger for showing a context menu is detected. 24 * 25 * @see MenuDetectListener 26 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 27 * 28 * @since 3.3 29 */ 30 31 public final class MenuDetectEvent : TypedEvent { 32 33 /** 34 * the display-relative x coordinate of the pointer 35 * at the time the context menu trigger occurred 36 */ 37 public int x; 38 39 /** 40 * the display-relative y coordinate of the pointer 41 * at the time the context menu trigger occurred 42 */ 43 public int y; 44 45 /** 46 * A flag indicating whether the operation should be allowed. 47 * Setting this field to <code>false</code> will cancel the operation. 48 */ 49 public bool doit; 50 51 //private static const long serialVersionUID = -3061660596590828941L; 52 53 /** 54 * Constructs a new instance of this class based on the 55 * information in the given untyped event. 56 * 57 * @param e the untyped event containing the information 58 */ 59 public this(Event e) { 60 super(e); 61 this.x = e.x; 62 this.y = e.y; 63 this.doit = e.doit; 64 } 65 66 /** 67 * Returns a string containing a concise, human-readable 68 * description of the receiver. 69 * 70 * @return a string representation of the event 71 */ 72 public override String toString() { 73 return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-1 ], x, y, doit ); 74 } 75 }