Mercurial > projects > dwt-mac
comparison dwt/events/MenuDetectEvent.d @ 34:5123b17c98ef
Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sun, 14 Sep 2008 01:45:57 +0200 |
parents | 1a8b3cb347e0 |
children | 43be986a1372 |
comparison
equal
deleted
inserted
replaced
33:965ac0a77267 | 34:5123b17c98ef |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
10 *******************************************************************************/ | 12 *******************************************************************************/ |
11 module dwt.events.MenuDetectEvent; | 13 module dwt.events.MenuDetectEvent; |
12 | 14 |
13 import dwt.dwthelper.utils; | 15 import dwt.dwthelper.utils; |
14 | 16 |
15 | 17 |
16 import dwt.widgets.Event; | 18 import dwt.widgets.Event; |
19 import dwt.events.TypedEvent; | |
17 | 20 |
21 import tango.text.convert.Format; | |
18 /** | 22 /** |
19 * Instances of this class are sent whenever the platform- | 23 * Instances of this class are sent whenever the platform- |
20 * specific trigger for showing a context menu is detected. | 24 * specific trigger for showing a context menu is detected. |
21 * | 25 * |
22 * @see MenuDetectListener | 26 * @see MenuDetectListener |
27 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
23 * | 28 * |
24 * @since 3.3 | 29 * @since 3.3 |
25 */ | 30 */ |
26 | 31 |
27 public final class MenuDetectEvent : TypedEvent { | 32 public final class MenuDetectEvent : TypedEvent { |
29 /** | 34 /** |
30 * the display-relative x coordinate of the pointer | 35 * the display-relative x coordinate of the pointer |
31 * at the time the context menu trigger occurred | 36 * at the time the context menu trigger occurred |
32 */ | 37 */ |
33 public int x; | 38 public int x; |
34 | 39 |
35 /** | 40 /** |
36 * the display-relative y coordinate of the pointer | 41 * the display-relative y coordinate of the pointer |
37 * at the time the context menu trigger occurred | 42 * at the time the context menu trigger occurred |
38 */ | 43 */ |
39 public int y; | 44 public int y; |
40 | 45 |
41 /** | 46 /** |
42 * A flag indicating whether the operation should be allowed. | 47 * A flag indicating whether the operation should be allowed. |
43 * Setting this field to <code>false</code> will cancel the operation. | 48 * Setting this field to <code>false</code> will cancel the operation. |
44 */ | 49 */ |
45 public bool doit; | 50 public bool doit; |
46 | 51 |
47 private static final long serialVersionUID = -3061660596590828941L; | 52 //private static final long serialVersionUID = -3061660596590828941L; |
48 | 53 |
49 /** | 54 /** |
50 * Constructs a new instance of this class based on the | 55 * Constructs a new instance of this class based on the |
51 * information in the given untyped event. | 56 * information in the given untyped event. |
52 * | 57 * |
63 * Returns a string containing a concise, human-readable | 68 * Returns a string containing a concise, human-readable |
64 * description of the receiver. | 69 * description of the receiver. |
65 * | 70 * |
66 * @return a string representation of the event | 71 * @return a string representation of the event |
67 */ | 72 */ |
68 public String toString() { | 73 public override String toString() { |
69 String string = super.toString (); | 74 return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit ); |
70 return string.substring (0, string.length() - 1) // remove trailing '}' | |
71 + " x=" + x | |
72 + " y=" + y | |
73 + " doit=" + doit | |
74 + "}"; | |
75 } | 75 } |
76 } | 76 } |