comparison dwt/events/MouseEvent.d @ 9:ad2b69216039

moved org.eclipse.swt to dwt
author Frank Benoit <benoit@tionex.de>
date Sat, 05 Jan 2008 17:39:49 +0100
parents org/eclipse/swt/events/MouseEvent.d@088b30eabff3
children 63c023465156
comparison
equal deleted inserted replaced
8:a1f832ca7d17 9:ad2b69216039
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 module org.eclipse.swt.events.MouseEvent;
12
13
14 import org.eclipse.swt.widgets.Event;
15 import org.eclipse.swt.events.TypedEvent;
16
17 import tango.text.convert.Format;
18
19 /**
20 * Instances of this class are sent whenever mouse
21 * related actions occur. This includes mouse buttons
22 * being pressed and released, the mouse pointer being
23 * moved and the mouse pointer crossing widget boundaries.
24 * <p>
25 * Note: The <code>button</code> field is an integer that
26 * represents the mouse button number. This is not the same
27 * as the <code>SWT</code> mask constants <code>BUTTONx</code>.
28 * </p>
29 *
30 * @see MouseListener
31 * @see MouseMoveListener
32 * @see MouseTrackListener
33 */
34
35 public class MouseEvent : TypedEvent {
36
37 /**
38 * the button that was pressed or released; 1 for the
39 * first button, 2 for the second button, and 3 for the
40 * third button, etc.
41 */
42 public int button;
43
44 /**
45 * the state of the keyboard modifier keys at the time
46 * the event was generated
47 */
48 public int stateMask;
49
50 /**
51 * the widget-relative, x coordinate of the pointer
52 * at the time the mouse button was pressed or released
53 */
54 public int x;
55
56 /**
57 * the widget-relative, y coordinate of the pointer
58 * at the time the mouse button was pressed or released
59 */
60 public int y;
61
62 /**
63 * the number times the mouse has been clicked, as defined
64 * by the operating system; 1 for the first click, 2 for the
65 * second click and so on.
66 *
67 * @since 3.3
68 */
69 public int count;
70
71 //static final long serialVersionUID = 3257288037011566898L;
72
73 /**
74 * Constructs a new instance of this class based on the
75 * information in the given untyped event.
76 *
77 * @param e the untyped event containing the information
78 */
79 public this(Event e) {
80 super(e);
81 this.x = e.x;
82 this.y = e.y;
83 this.button = e.button;
84 this.stateMask = e.stateMask;
85 this.count = e.count;
86 }
87
88 /**
89 * Returns a string containing a concise, human-readable
90 * description of the receiver.
91 *
92 * @return a string representation of the event
93 */
94 public char[] toString() {
95 return Format( "{} button={} stateMask={} x={} y={} count={}}",
96 super.toString[ 0 .. $-2 ],
97 button, stateMask, x, y, count );
98 }
99 }