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