comparison dwt/events/MouseEvent.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 649b8e223d5a
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
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 dwt.events.MouseEvent;
12
13 import dwt.dwthelper.utils;
14
15
16 import dwt.widgets.Event;
17
18 /**
19 * Instances of this class are sent whenever mouse
20 * related actions occur. This includes mouse buttons
21 * being pressed and released, the mouse pointer being
22 * moved and the mouse pointer crossing widget boundaries.
23 * <p>
24 * Note: The <code>button</code> field is an integer that
25 * represents the mouse button number. This is not the same
26 * as the <code>DWT</code> mask constants <code>BUTTONx</code>.
27 * </p>
28 *
29 * @see MouseListener
30 * @see MouseMoveListener
31 * @see MouseTrackListener
32 */
33
34 public class MouseEvent extends TypedEvent {
35
36 /**
37 * the button that was pressed or released; 1 for the
38 * first button, 2 for the second button, and 3 for the
39 * third button, etc.
40 */
41 public int button;
42
43 /**
44 * the state of the keyboard modifier keys at the time
45 * the event was generated
46 */
47 public int stateMask;
48
49 /**
50 * the widget-relative, x coordinate of the pointer
51 * at the time the mouse button was pressed or released
52 */
53 public int x;
54
55 /**
56 * the widget-relative, y coordinate of the pointer
57 * at the time the mouse button was pressed or released
58 */
59 public int y;
60
61 /**
62 * the number times the mouse has been clicked, as defined
63 * by the operating system; 1 for the first click, 2 for the
64 * second click and so on.
65 *
66 * @since 3.3
67 */
68 public int count;
69
70 static final long serialVersionUID = 3257288037011566898L;
71
72 /**
73 * Constructs a new instance of this class based on the
74 * information in the given untyped event.
75 *
76 * @param e the untyped event containing the information
77 */
78 public MouseEvent(Event e) {
79 super(e);
80 this.x = e.x;
81 this.y = e.y;
82 this.button = e.button;
83 this.stateMask = e.stateMask;
84 this.count = e.count;
85 }
86
87 /**
88 * Returns a string containing a concise, human-readable
89 * description of the receiver.
90 *
91 * @return a string representation of the event
92 */
93 public String toString() {
94 String string = super.toString ();
95 return string.substring (0, string.length() - 1) // remove trailing '}'
96 + " button=" + button
97 + " stateMask=" + stateMask
98 + " x=" + x
99 + " y=" + y
100 + " count=" + count
101 + "}";
102 }
103 }